cola Report for recount2:SRP009862
Date: 2019-12-25 23:16:21 CET, cola version: 1.3.2
Document is loading... 
Summary
All available functions which can be applied to this res_list
object:
res_list
#> A 'ConsensusPartitionList' object with 24 methods.
#> On a matrix with 15244 rows and 71 columns.
#> Top rows are extracted by 'SD, CV, MAD, ATC' methods.
#> Subgroups are detected by 'hclust, kmeans, skmeans, pam, mclust, NMF' method.
#> Number of partitions are tried for k = 2, 3, 4, 5, 6.
#> Performed in total 30000 partitions by row resampling.
#>
#> Following methods can be applied to this 'ConsensusPartitionList' object:
#> [1] "cola_report" "collect_classes" "collect_plots" "collect_stats"
#> [5] "colnames" "functional_enrichment" "get_anno_col" "get_anno"
#> [9] "get_classes" "get_matrix" "get_membership" "get_stats"
#> [13] "is_best_k" "is_stable_k" "ncol" "nrow"
#> [17] "rownames" "show" "suggest_best_k" "test_to_known_factors"
#> [21] "top_rows_heatmap" "top_rows_overlap"
#>
#> You can get result for a single method by, e.g. object["SD", "hclust"] or object["SD:hclust"]
#> or a subset of methods by object[c("SD", "CV")], c("hclust", "kmeans")]
The call of run_all_consensus_partition_methods()
was:
#> run_all_consensus_partition_methods(data = mat, mc.cores = 4)
Dimension of the input matrix:
mat = get_matrix(res_list)
dim(mat)
#> [1] 15244 71
Density distribution
The density distribution for each sample is visualized as in one column in the
following heatmap. The clustering is based on the distance which is the
Kolmogorov-Smirnov statistic between two distributions.
library(ComplexHeatmap)
densityHeatmap(mat, ylab = "value", cluster_columns = TRUE, show_column_names = FALSE,
mc.cores = 4)

Suggest the best k
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)
**: 1-PAC > 0.95, *: 1-PAC > 0.9
CDF of consensus matrices
Cumulative distribution function curves of consensus matrix for all methods.
collect_plots(res_list, fun = plot_ecdf)

Consensus heatmap
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 heatmap
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 heatmap
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)

Statistics table
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 1.000 1.000 0.454 0.546 0.546
#> CV:NMF 2 0.696 0.940 0.950 0.454 0.546 0.546
#> MAD:NMF 2 0.941 0.905 0.964 0.477 0.522 0.522
#> ATC:NMF 2 0.856 0.901 0.959 0.437 0.556 0.556
#> SD:skmeans 2 0.797 0.865 0.945 0.478 0.546 0.546
#> CV:skmeans 2 0.775 0.904 0.950 0.489 0.495 0.495
#> MAD:skmeans 2 0.699 0.887 0.948 0.505 0.494 0.494
#> ATC:skmeans 2 1.000 0.998 0.999 0.495 0.505 0.505
#> SD:mclust 2 0.770 0.838 0.938 0.341 0.697 0.697
#> CV:mclust 2 0.526 0.908 0.925 0.351 0.697 0.697
#> MAD:mclust 2 1.000 0.996 0.998 0.269 0.734 0.734
#> ATC:mclust 2 0.546 0.914 0.927 0.338 0.697 0.697
#> SD:kmeans 2 0.140 0.385 0.657 0.414 0.505 0.505
#> CV:kmeans 2 0.141 0.256 0.597 0.373 0.590 0.590
#> MAD:kmeans 2 0.194 0.544 0.725 0.463 0.495 0.495
#> ATC:kmeans 2 0.498 0.808 0.905 0.409 0.577 0.577
#> SD:pam 2 0.834 0.876 0.950 0.359 0.697 0.697
#> CV:pam 2 1.000 1.000 1.000 0.304 0.697 0.697
#> MAD:pam 2 0.914 0.948 0.978 0.456 0.537 0.537
#> ATC:pam 2 0.385 0.757 0.877 0.412 0.577 0.577
#> SD:hclust 2 0.441 0.781 0.867 0.393 0.646 0.646
#> CV:hclust 2 0.351 0.718 0.787 0.411 0.546 0.546
#> MAD:hclust 2 0.512 0.785 0.897 0.244 0.775 0.775
#> ATC:hclust 2 0.741 0.910 0.958 0.388 0.616 0.616
get_stats(res_list, k = 3)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 3 0.704 0.819 0.913 0.3552 0.720 0.533
#> CV:NMF 3 0.535 0.857 0.874 0.3702 0.765 0.599
#> MAD:NMF 3 0.618 0.676 0.812 0.3320 0.712 0.507
#> ATC:NMF 3 0.971 0.924 0.965 0.4595 0.707 0.514
#> SD:skmeans 3 0.627 0.797 0.886 0.3619 0.758 0.577
#> CV:skmeans 3 0.598 0.718 0.834 0.3260 0.788 0.595
#> MAD:skmeans 3 0.610 0.793 0.857 0.3134 0.766 0.558
#> ATC:skmeans 3 0.951 0.947 0.973 0.3379 0.773 0.575
#> SD:mclust 3 0.628 0.800 0.870 0.7191 0.687 0.551
#> CV:mclust 3 0.432 0.553 0.760 0.7382 0.681 0.542
#> MAD:mclust 3 0.839 0.886 0.931 1.0742 0.741 0.647
#> ATC:mclust 3 0.351 0.684 0.795 0.7581 0.687 0.551
#> SD:kmeans 3 0.223 0.651 0.761 0.4167 0.660 0.450
#> CV:kmeans 3 0.110 0.559 0.654 0.4543 0.529 0.359
#> MAD:kmeans 3 0.344 0.590 0.758 0.3526 0.786 0.597
#> ATC:kmeans 3 0.554 0.781 0.878 0.4471 0.816 0.691
#> SD:pam 3 0.683 0.725 0.834 0.5318 0.710 0.584
#> CV:pam 3 1.000 1.000 1.000 0.5830 0.823 0.745
#> MAD:pam 3 0.573 0.823 0.885 0.3736 0.750 0.561
#> ATC:pam 3 0.943 0.936 0.968 0.4993 0.703 0.527
#> SD:hclust 3 0.616 0.846 0.901 0.2392 0.899 0.844
#> CV:hclust 3 0.773 0.921 0.935 0.3745 0.862 0.748
#> MAD:hclust 3 0.525 0.926 0.881 0.9423 0.568 0.473
#> ATC:hclust 3 0.766 0.879 0.947 0.0963 0.974 0.958
get_stats(res_list, k = 4)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 4 0.815 0.875 0.925 0.1445 0.831 0.593
#> CV:NMF 4 0.673 0.581 0.698 0.1537 0.828 0.597
#> MAD:NMF 4 0.741 0.790 0.879 0.1434 0.845 0.605
#> ATC:NMF 4 0.866 0.847 0.921 0.1563 0.775 0.464
#> SD:skmeans 4 0.714 0.822 0.878 0.1381 0.766 0.445
#> CV:skmeans 4 0.634 0.620 0.679 0.1289 0.765 0.464
#> MAD:skmeans 4 0.849 0.902 0.936 0.1283 0.838 0.566
#> ATC:skmeans 4 0.715 0.785 0.874 0.1183 0.799 0.501
#> SD:mclust 4 0.619 0.725 0.813 0.2069 0.756 0.449
#> CV:mclust 4 0.621 0.844 0.864 0.1267 0.847 0.626
#> MAD:mclust 4 0.649 0.647 0.831 0.2126 0.826 0.638
#> ATC:mclust 4 0.640 0.479 0.778 0.2172 0.795 0.525
#> SD:kmeans 4 0.399 0.572 0.698 0.1752 0.806 0.556
#> CV:kmeans 4 0.235 0.652 0.612 0.1755 0.942 0.859
#> MAD:kmeans 4 0.403 0.620 0.721 0.1391 0.786 0.472
#> ATC:kmeans 4 0.612 0.559 0.754 0.1848 0.876 0.722
#> SD:pam 4 0.737 0.653 0.819 0.2707 0.793 0.529
#> CV:pam 4 0.743 0.732 0.844 0.4171 0.812 0.637
#> MAD:pam 4 0.718 0.720 0.884 0.1816 0.800 0.505
#> ATC:pam 4 0.717 0.871 0.886 0.1856 0.823 0.563
#> SD:hclust 4 0.625 0.874 0.903 0.0759 0.975 0.954
#> CV:hclust 4 0.610 0.772 0.833 0.1384 0.934 0.837
#> MAD:hclust 4 0.756 0.888 0.919 0.3137 0.920 0.815
#> ATC:hclust 4 0.587 0.656 0.863 0.3019 0.840 0.731
get_stats(res_list, k = 5)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 5 0.836 0.773 0.895 0.1217 0.852 0.540
#> CV:NMF 5 0.860 0.924 0.922 0.1075 0.839 0.510
#> MAD:NMF 5 0.797 0.780 0.860 0.0730 0.939 0.785
#> ATC:NMF 5 0.749 0.665 0.810 0.0719 0.912 0.685
#> SD:skmeans 5 0.786 0.824 0.885 0.0728 0.921 0.708
#> CV:skmeans 5 0.808 0.897 0.920 0.0855 0.851 0.547
#> MAD:skmeans 5 0.803 0.756 0.821 0.0625 0.941 0.770
#> ATC:skmeans 5 0.738 0.750 0.813 0.0618 0.915 0.705
#> SD:mclust 5 0.675 0.781 0.851 0.1009 0.929 0.735
#> CV:mclust 5 0.664 0.767 0.803 0.1262 0.913 0.700
#> MAD:mclust 5 0.621 0.577 0.705 0.1142 0.763 0.382
#> ATC:mclust 5 0.621 0.530 0.731 0.0790 0.788 0.392
#> SD:kmeans 5 0.549 0.629 0.705 0.1006 0.803 0.437
#> CV:kmeans 5 0.375 0.635 0.581 0.1397 0.789 0.460
#> MAD:kmeans 5 0.562 0.687 0.741 0.0800 0.928 0.736
#> ATC:kmeans 5 0.592 0.526 0.617 0.0877 0.823 0.516
#> SD:pam 5 0.889 0.827 0.927 0.1342 0.898 0.640
#> CV:pam 5 0.910 0.908 0.958 0.1527 0.862 0.590
#> MAD:pam 5 0.886 0.846 0.933 0.0754 0.879 0.586
#> ATC:pam 5 0.905 0.892 0.957 0.0616 0.970 0.880
#> SD:hclust 5 0.681 0.657 0.843 0.3193 0.763 0.544
#> CV:hclust 5 0.686 0.877 0.846 0.1214 0.942 0.832
#> MAD:hclust 5 0.672 0.446 0.680 0.1600 0.848 0.594
#> ATC:hclust 5 0.563 0.770 0.880 0.1264 0.864 0.708
get_stats(res_list, k = 6)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> SD:NMF 6 0.871 0.827 0.892 0.0469 0.936 0.706
#> CV:NMF 6 0.908 0.894 0.913 0.0500 0.947 0.751
#> MAD:NMF 6 0.898 0.858 0.902 0.0538 0.920 0.677
#> ATC:NMF 6 0.751 0.618 0.772 0.0376 0.953 0.785
#> SD:skmeans 6 0.822 0.802 0.857 0.0478 0.922 0.649
#> CV:skmeans 6 0.867 0.877 0.907 0.0509 0.913 0.617
#> MAD:skmeans 6 0.789 0.614 0.789 0.0410 0.939 0.739
#> ATC:skmeans 6 0.749 0.644 0.780 0.0476 0.928 0.699
#> SD:mclust 6 0.810 0.726 0.855 0.0440 0.956 0.799
#> CV:mclust 6 0.860 0.841 0.848 0.0627 0.965 0.825
#> MAD:mclust 6 0.652 0.555 0.722 0.0681 0.868 0.523
#> ATC:mclust 6 0.659 0.581 0.751 0.0399 0.919 0.666
#> SD:kmeans 6 0.619 0.644 0.702 0.0557 0.982 0.917
#> CV:kmeans 6 0.629 0.743 0.666 0.0736 0.901 0.592
#> MAD:kmeans 6 0.636 0.538 0.678 0.0517 0.933 0.733
#> ATC:kmeans 6 0.644 0.536 0.665 0.0550 0.860 0.504
#> SD:pam 6 0.989 0.922 0.967 0.0521 0.930 0.677
#> CV:pam 6 0.870 0.876 0.911 0.0467 0.971 0.858
#> MAD:pam 6 0.850 0.811 0.890 0.0484 0.926 0.663
#> ATC:pam 6 0.991 0.915 0.965 0.0325 0.928 0.707
#> SD:hclust 6 0.862 0.903 0.948 0.1705 0.825 0.465
#> CV:hclust 6 0.906 0.949 0.949 0.1266 0.895 0.632
#> MAD:hclust 6 0.780 0.876 0.909 0.0994 0.812 0.402
#> ATC:hclust 6 0.623 0.692 0.795 0.0941 0.988 0.966
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)

Partition from all methods
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)

Top rows overlap
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)

Results for each method
SD:hclust
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"]
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 15244 rows and 71 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'hclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 6.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)

The plots are:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.441 0.781 0.867 0.3930 0.646 0.646
#> 3 3 0.616 0.846 0.901 0.2392 0.899 0.844
#> 4 4 0.625 0.874 0.903 0.0759 0.975 0.954
#> 5 5 0.681 0.657 0.843 0.3193 0.763 0.544
#> 6 6 0.862 0.903 0.948 0.1705 0.825 0.465
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
suggest_best_k(res)
#> [1] 6
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.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.7299 0.841 0.796 0.204
#> SRR390471 1 0.7299 0.841 0.796 0.204
#> SRR390472 1 0.7299 0.841 0.796 0.204
#> SRR390473 1 0.7299 0.841 0.796 0.204
#> SRR390474 1 0.7299 0.841 0.796 0.204
#> SRR390475 1 0.7299 0.841 0.796 0.204
#> SRR390476 1 0.7299 0.841 0.796 0.204
#> SRR390477 1 0.7299 0.841 0.796 0.204
#> SRR390478 1 0.7299 0.841 0.796 0.204
#> SRR390480 1 0.7299 0.841 0.796 0.204
#> SRR390481 1 0.7299 0.841 0.796 0.204
#> SRR390482 1 0.7299 0.841 0.796 0.204
#> SRR390483 1 0.7299 0.841 0.796 0.204
#> SRR390484 1 0.9970 -0.167 0.532 0.468
#> SRR390485 1 0.9970 -0.167 0.532 0.468
#> SRR390486 2 0.3431 0.956 0.064 0.936
#> SRR390487 2 0.3431 0.956 0.064 0.936
#> SRR390488 2 0.3431 0.956 0.064 0.936
#> SRR390489 2 0.3431 0.956 0.064 0.936
#> SRR390492 1 0.1633 0.796 0.976 0.024
#> SRR390493 1 0.1633 0.796 0.976 0.024
#> SRR390494 1 0.1633 0.796 0.976 0.024
#> SRR390495 1 0.1633 0.796 0.976 0.024
#> SRR390496 1 0.1633 0.796 0.976 0.024
#> SRR390497 1 0.9970 -0.167 0.532 0.468
#> SRR390498 1 0.9944 -0.168 0.544 0.456
#> SRR390499 1 0.7299 0.841 0.796 0.204
#> SRR390500 1 0.7299 0.841 0.796 0.204
#> SRR390501 2 0.3431 0.956 0.064 0.936
#> SRR390502 2 0.3431 0.956 0.064 0.936
#> SRR390503 2 0.3431 0.956 0.064 0.936
#> SRR390504 2 0.3431 0.956 0.064 0.936
#> SRR390505 2 0.0376 0.947 0.004 0.996
#> SRR390506 2 0.0376 0.947 0.004 0.996
#> SRR390507 1 0.0376 0.787 0.996 0.004
#> SRR390508 1 0.0376 0.787 0.996 0.004
#> SRR390509 1 0.0376 0.787 0.996 0.004
#> SRR390510 1 0.0376 0.787 0.996 0.004
#> SRR390512 1 0.0376 0.787 0.996 0.004
#> SRR390513 1 0.0376 0.787 0.996 0.004
#> SRR390514 1 0.0376 0.787 0.996 0.004
#> SRR390515 1 0.7299 0.841 0.796 0.204
#> SRR390516 2 0.3431 0.956 0.064 0.936
#> SRR390517 1 0.0376 0.787 0.996 0.004
#> SRR390519 1 0.9970 -0.167 0.532 0.468
#> SRR390520 1 0.7299 0.841 0.796 0.204
#> SRR390521 1 0.7299 0.841 0.796 0.204
#> SRR390522 1 0.7299 0.841 0.796 0.204
#> SRR390523 1 0.7299 0.841 0.796 0.204
#> SRR390524 1 0.7299 0.841 0.796 0.204
#> SRR390525 1 0.7299 0.841 0.796 0.204
#> SRR390526 1 0.7299 0.841 0.796 0.204
#> SRR390527 1 0.7299 0.841 0.796 0.204
#> SRR390528 1 0.7299 0.841 0.796 0.204
#> SRR390529 2 0.0376 0.947 0.004 0.996
#> SRR390530 1 0.7299 0.841 0.796 0.204
#> SRR390531 1 0.7299 0.841 0.796 0.204
#> SRR390532 1 0.7299 0.841 0.796 0.204
#> SRR390533 1 0.7299 0.841 0.796 0.204
#> SRR390534 1 0.7299 0.841 0.796 0.204
#> SRR390535 1 0.7299 0.841 0.796 0.204
#> SRR390536 1 0.1633 0.796 0.976 0.024
#> SRR390537 1 0.1633 0.796 0.976 0.024
#> SRR390538 2 0.0376 0.947 0.004 0.996
#> SRR390539 2 0.0376 0.947 0.004 0.996
#> SRR390540 2 0.0376 0.947 0.004 0.996
#> SRR390541 2 0.0376 0.947 0.004 0.996
#> SRR390542 1 0.0376 0.787 0.996 0.004
#> SRR390543 1 0.0376 0.787 0.996 0.004
#> SRR390544 1 0.0376 0.787 0.996 0.004
#> SRR390545 1 0.0376 0.787 0.996 0.004
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.000 0.887 1.000 0.000 0.000
#> SRR390471 1 0.000 0.887 1.000 0.000 0.000
#> SRR390472 1 0.000 0.887 1.000 0.000 0.000
#> SRR390473 1 0.000 0.887 1.000 0.000 0.000
#> SRR390474 1 0.000 0.887 1.000 0.000 0.000
#> SRR390475 1 0.000 0.887 1.000 0.000 0.000
#> SRR390476 1 0.000 0.887 1.000 0.000 0.000
#> SRR390477 1 0.000 0.887 1.000 0.000 0.000
#> SRR390478 1 0.000 0.887 1.000 0.000 0.000
#> SRR390480 1 0.000 0.887 1.000 0.000 0.000
#> SRR390481 1 0.000 0.887 1.000 0.000 0.000
#> SRR390482 1 0.000 0.887 1.000 0.000 0.000
#> SRR390483 1 0.000 0.887 1.000 0.000 0.000
#> SRR390484 2 0.203 0.980 0.032 0.952 0.016
#> SRR390485 2 0.203 0.980 0.032 0.952 0.016
#> SRR390486 3 0.250 0.850 0.068 0.004 0.928
#> SRR390487 3 0.250 0.850 0.068 0.004 0.928
#> SRR390488 3 0.250 0.850 0.068 0.004 0.928
#> SRR390489 3 0.250 0.850 0.068 0.004 0.928
#> SRR390492 1 0.506 0.795 0.800 0.184 0.016
#> SRR390493 1 0.506 0.795 0.800 0.184 0.016
#> SRR390494 1 0.506 0.795 0.800 0.184 0.016
#> SRR390495 1 0.506 0.795 0.800 0.184 0.016
#> SRR390496 1 0.506 0.795 0.800 0.184 0.016
#> SRR390497 2 0.203 0.980 0.032 0.952 0.016
#> SRR390498 2 0.000 0.923 0.000 1.000 0.000
#> SRR390499 1 0.000 0.887 1.000 0.000 0.000
#> SRR390500 1 0.000 0.887 1.000 0.000 0.000
#> SRR390501 3 0.250 0.850 0.068 0.004 0.928
#> SRR390502 3 0.250 0.850 0.068 0.004 0.928
#> SRR390503 3 0.250 0.850 0.068 0.004 0.928
#> SRR390504 3 0.250 0.850 0.068 0.004 0.928
#> SRR390505 3 0.455 0.812 0.200 0.000 0.800
#> SRR390506 3 0.455 0.812 0.200 0.000 0.800
#> SRR390507 1 0.533 0.748 0.728 0.272 0.000
#> SRR390508 1 0.533 0.748 0.728 0.272 0.000
#> SRR390509 1 0.533 0.748 0.728 0.272 0.000
#> SRR390510 1 0.533 0.748 0.728 0.272 0.000
#> SRR390512 1 0.533 0.748 0.728 0.272 0.000
#> SRR390513 1 0.533 0.748 0.728 0.272 0.000
#> SRR390514 1 0.533 0.748 0.728 0.272 0.000
#> SRR390515 1 0.000 0.887 1.000 0.000 0.000
#> SRR390516 3 0.250 0.850 0.068 0.004 0.928
#> SRR390517 1 0.608 0.573 0.612 0.388 0.000
#> SRR390519 2 0.203 0.980 0.032 0.952 0.016
#> SRR390520 1 0.000 0.887 1.000 0.000 0.000
#> SRR390521 1 0.000 0.887 1.000 0.000 0.000
#> SRR390522 1 0.000 0.887 1.000 0.000 0.000
#> SRR390523 1 0.000 0.887 1.000 0.000 0.000
#> SRR390524 1 0.000 0.887 1.000 0.000 0.000
#> SRR390525 1 0.000 0.887 1.000 0.000 0.000
#> SRR390526 1 0.000 0.887 1.000 0.000 0.000
#> SRR390527 1 0.000 0.887 1.000 0.000 0.000
#> SRR390528 1 0.000 0.887 1.000 0.000 0.000
#> SRR390529 3 0.455 0.812 0.200 0.000 0.800
#> SRR390530 1 0.000 0.887 1.000 0.000 0.000
#> SRR390531 1 0.000 0.887 1.000 0.000 0.000
#> SRR390532 1 0.000 0.887 1.000 0.000 0.000
#> SRR390533 1 0.000 0.887 1.000 0.000 0.000
#> SRR390534 1 0.000 0.887 1.000 0.000 0.000
#> SRR390535 1 0.000 0.887 1.000 0.000 0.000
#> SRR390536 1 0.506 0.795 0.800 0.184 0.016
#> SRR390537 1 0.506 0.795 0.800 0.184 0.016
#> SRR390538 3 0.455 0.812 0.200 0.000 0.800
#> SRR390539 3 0.455 0.812 0.200 0.000 0.800
#> SRR390540 3 0.455 0.812 0.200 0.000 0.800
#> SRR390541 3 0.455 0.812 0.200 0.000 0.800
#> SRR390542 1 0.533 0.748 0.728 0.272 0.000
#> SRR390543 1 0.533 0.748 0.728 0.272 0.000
#> SRR390544 1 0.533 0.748 0.728 0.272 0.000
#> SRR390545 1 0.533 0.748 0.728 0.272 0.000
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390471 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390472 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390473 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390474 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390475 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390476 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390477 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390478 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390480 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390481 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390482 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390483 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390484 2 0.112 0.913 0.0 0.964 0.036 0.000
#> SRR390485 2 0.112 0.913 0.0 0.964 0.036 0.000
#> SRR390486 3 0.112 1.000 0.0 0.000 0.964 0.036
#> SRR390487 3 0.112 1.000 0.0 0.000 0.964 0.036
#> SRR390488 3 0.112 1.000 0.0 0.000 0.964 0.036
#> SRR390489 3 0.112 1.000 0.0 0.000 0.964 0.036
#> SRR390492 4 0.361 0.782 0.0 0.200 0.000 0.800
#> SRR390493 4 0.361 0.782 0.0 0.200 0.000 0.800
#> SRR390494 4 0.361 0.782 0.0 0.200 0.000 0.800
#> SRR390495 4 0.361 0.782 0.0 0.200 0.000 0.800
#> SRR390496 4 0.361 0.782 0.0 0.200 0.000 0.800
#> SRR390497 2 0.112 0.913 0.0 0.964 0.036 0.000
#> SRR390498 2 0.467 0.645 0.2 0.764 0.036 0.000
#> SRR390499 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390500 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390501 3 0.112 1.000 0.0 0.000 0.964 0.036
#> SRR390502 3 0.112 1.000 0.0 0.000 0.964 0.036
#> SRR390503 3 0.112 1.000 0.0 0.000 0.964 0.036
#> SRR390504 3 0.112 1.000 0.0 0.000 0.964 0.036
#> SRR390505 1 0.361 1.000 0.8 0.000 0.000 0.200
#> SRR390506 1 0.361 1.000 0.8 0.000 0.000 0.200
#> SRR390507 4 0.572 0.748 0.2 0.036 0.036 0.728
#> SRR390508 4 0.572 0.748 0.2 0.036 0.036 0.728
#> SRR390509 4 0.572 0.748 0.2 0.036 0.036 0.728
#> SRR390510 4 0.572 0.748 0.2 0.036 0.036 0.728
#> SRR390512 4 0.572 0.748 0.2 0.036 0.036 0.728
#> SRR390513 4 0.572 0.748 0.2 0.036 0.036 0.728
#> SRR390514 4 0.572 0.748 0.2 0.036 0.036 0.728
#> SRR390515 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390516 3 0.112 1.000 0.0 0.000 0.964 0.036
#> SRR390517 4 0.742 0.604 0.2 0.152 0.036 0.612
#> SRR390519 2 0.112 0.913 0.0 0.964 0.036 0.000
#> SRR390520 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390521 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390522 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390523 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390524 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390525 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390526 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390527 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390528 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390529 1 0.361 1.000 0.8 0.000 0.000 0.200
#> SRR390530 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390531 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390532 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390533 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390534 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390535 4 0.000 0.886 0.0 0.000 0.000 1.000
#> SRR390536 4 0.361 0.782 0.0 0.200 0.000 0.800
#> SRR390537 4 0.361 0.782 0.0 0.200 0.000 0.800
#> SRR390538 1 0.361 1.000 0.8 0.000 0.000 0.200
#> SRR390539 1 0.361 1.000 0.8 0.000 0.000 0.200
#> SRR390540 1 0.361 1.000 0.8 0.000 0.000 0.200
#> SRR390541 1 0.361 1.000 0.8 0.000 0.000 0.200
#> SRR390542 4 0.572 0.748 0.2 0.036 0.036 0.728
#> SRR390543 4 0.572 0.748 0.2 0.036 0.036 0.728
#> SRR390544 4 0.572 0.748 0.2 0.036 0.036 0.728
#> SRR390545 4 0.572 0.748 0.2 0.036 0.036 0.728
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 4 0.000 0.6536 0 0.000 0 1.000 0.000
#> SRR390471 4 0.000 0.6536 0 0.000 0 1.000 0.000
#> SRR390472 4 0.000 0.6536 0 0.000 0 1.000 0.000
#> SRR390473 4 0.000 0.6536 0 0.000 0 1.000 0.000
#> SRR390474 4 0.420 0.4969 0 0.408 0 0.592 0.000
#> SRR390475 4 0.000 0.6536 0 0.000 0 1.000 0.000
#> SRR390476 4 0.000 0.6536 0 0.000 0 1.000 0.000
#> SRR390477 4 0.000 0.6536 0 0.000 0 1.000 0.000
#> SRR390478 4 0.000 0.6536 0 0.000 0 1.000 0.000
#> SRR390480 4 0.425 0.4679 0 0.432 0 0.568 0.000
#> SRR390481 4 0.425 0.4679 0 0.432 0 0.568 0.000
#> SRR390482 4 0.425 0.4679 0 0.432 0 0.568 0.000
#> SRR390483 4 0.425 0.4679 0 0.432 0 0.568 0.000
#> SRR390484 5 0.000 0.9098 0 0.000 0 0.000 1.000
#> SRR390485 5 0.000 0.9098 0 0.000 0 0.000 1.000
#> SRR390486 3 0.000 1.0000 0 0.000 1 0.000 0.000
#> SRR390487 3 0.000 1.0000 0 0.000 1 0.000 0.000
#> SRR390488 3 0.000 1.0000 0 0.000 1 0.000 0.000
#> SRR390489 3 0.000 1.0000 0 0.000 1 0.000 0.000
#> SRR390492 2 0.654 0.0903 0 0.432 0 0.368 0.200
#> SRR390493 2 0.654 0.0903 0 0.432 0 0.368 0.200
#> SRR390494 2 0.654 0.0903 0 0.432 0 0.368 0.200
#> SRR390495 2 0.654 0.0903 0 0.432 0 0.368 0.200
#> SRR390496 2 0.654 0.0903 0 0.432 0 0.368 0.200
#> SRR390497 5 0.000 0.9098 0 0.000 0 0.000 1.000
#> SRR390498 5 0.364 0.6275 0 0.272 0 0.000 0.728
#> SRR390499 4 0.425 0.4679 0 0.432 0 0.568 0.000
#> SRR390500 4 0.425 0.4679 0 0.432 0 0.568 0.000
#> SRR390501 3 0.000 1.0000 0 0.000 1 0.000 0.000
#> SRR390502 3 0.000 1.0000 0 0.000 1 0.000 0.000
#> SRR390503 3 0.000 1.0000 0 0.000 1 0.000 0.000
#> SRR390504 3 0.000 1.0000 0 0.000 1 0.000 0.000
#> SRR390505 1 0.000 1.0000 1 0.000 0 0.000 0.000
#> SRR390506 1 0.000 1.0000 1 0.000 0 0.000 0.000
#> SRR390507 2 0.000 0.6950 0 1.000 0 0.000 0.000
#> SRR390508 2 0.000 0.6950 0 1.000 0 0.000 0.000
#> SRR390509 2 0.000 0.6950 0 1.000 0 0.000 0.000
#> SRR390510 2 0.000 0.6950 0 1.000 0 0.000 0.000
#> SRR390512 2 0.000 0.6950 0 1.000 0 0.000 0.000
#> SRR390513 2 0.000 0.6950 0 1.000 0 0.000 0.000
#> SRR390514 2 0.000 0.6950 0 1.000 0 0.000 0.000
#> SRR390515 4 0.000 0.6536 0 0.000 0 1.000 0.000
#> SRR390516 3 0.000 1.0000 0 0.000 1 0.000 0.000
#> SRR390517 2 0.223 0.6160 0 0.884 0 0.000 0.116
#> SRR390519 5 0.000 0.9098 0 0.000 0 0.000 1.000
#> SRR390520 4 0.420 0.4969 0 0.408 0 0.592 0.000
#> SRR390521 4 0.420 0.4969 0 0.408 0 0.592 0.000
#> SRR390522 4 0.420 0.4969 0 0.408 0 0.592 0.000
#> SRR390523 4 0.420 0.4969 0 0.408 0 0.592 0.000
#> SRR390524 4 0.000 0.6536 0 0.000 0 1.000 0.000
#> SRR390525 4 0.000 0.6536 0 0.000 0 1.000 0.000
#> SRR390526 4 0.000 0.6536 0 0.000 0 1.000 0.000
#> SRR390527 4 0.000 0.6536 0 0.000 0 1.000 0.000
#> SRR390528 4 0.425 0.4679 0 0.432 0 0.568 0.000
#> SRR390529 1 0.000 1.0000 1 0.000 0 0.000 0.000
#> SRR390530 4 0.000 0.6536 0 0.000 0 1.000 0.000
#> SRR390531 4 0.000 0.6536 0 0.000 0 1.000 0.000
#> SRR390532 4 0.425 0.4679 0 0.432 0 0.568 0.000
#> SRR390533 4 0.423 0.4851 0 0.420 0 0.580 0.000
#> SRR390534 4 0.423 0.4851 0 0.420 0 0.580 0.000
#> SRR390535 4 0.423 0.4851 0 0.420 0 0.580 0.000
#> SRR390536 2 0.654 0.0903 0 0.432 0 0.368 0.200
#> SRR390537 2 0.654 0.0903 0 0.432 0 0.368 0.200
#> SRR390538 1 0.000 1.0000 1 0.000 0 0.000 0.000
#> SRR390539 1 0.000 1.0000 1 0.000 0 0.000 0.000
#> SRR390540 1 0.000 1.0000 1 0.000 0 0.000 0.000
#> SRR390541 1 0.000 1.0000 1 0.000 0 0.000 0.000
#> SRR390542 2 0.000 0.6950 0 1.000 0 0.000 0.000
#> SRR390543 2 0.000 0.6950 0 1.000 0 0.000 0.000
#> SRR390544 2 0.000 0.6950 0 1.000 0 0.000 0.000
#> SRR390545 2 0.000 0.6950 0 1.000 0 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.000 0.971 1.000 0.000 0 0.000 0.000 0
#> SRR390471 1 0.000 0.971 1.000 0.000 0 0.000 0.000 0
#> SRR390472 1 0.000 0.971 1.000 0.000 0 0.000 0.000 0
#> SRR390473 1 0.000 0.971 1.000 0.000 0 0.000 0.000 0
#> SRR390474 4 0.331 0.677 0.280 0.000 0 0.720 0.000 0
#> SRR390475 1 0.000 0.971 1.000 0.000 0 0.000 0.000 0
#> SRR390476 1 0.000 0.971 1.000 0.000 0 0.000 0.000 0
#> SRR390477 1 0.000 0.971 1.000 0.000 0 0.000 0.000 0
#> SRR390478 1 0.000 0.971 1.000 0.000 0 0.000 0.000 0
#> SRR390480 4 0.000 0.839 0.000 0.000 0 1.000 0.000 0
#> SRR390481 4 0.000 0.839 0.000 0.000 0 1.000 0.000 0
#> SRR390482 4 0.000 0.839 0.000 0.000 0 1.000 0.000 0
#> SRR390483 4 0.000 0.839 0.000 0.000 0 1.000 0.000 0
#> SRR390484 5 0.000 0.910 0.000 0.000 0 0.000 1.000 0
#> SRR390485 5 0.000 0.910 0.000 0.000 0 0.000 1.000 0
#> SRR390486 3 0.000 1.000 0.000 0.000 1 0.000 0.000 0
#> SRR390487 3 0.000 1.000 0.000 0.000 1 0.000 0.000 0
#> SRR390488 3 0.000 1.000 0.000 0.000 1 0.000 0.000 0
#> SRR390489 3 0.000 1.000 0.000 0.000 1 0.000 0.000 0
#> SRR390492 4 0.279 0.767 0.000 0.000 0 0.800 0.200 0
#> SRR390493 4 0.279 0.767 0.000 0.000 0 0.800 0.200 0
#> SRR390494 4 0.279 0.767 0.000 0.000 0 0.800 0.200 0
#> SRR390495 4 0.279 0.767 0.000 0.000 0 0.800 0.200 0
#> SRR390496 4 0.279 0.767 0.000 0.000 0 0.800 0.200 0
#> SRR390497 5 0.000 0.910 0.000 0.000 0 0.000 1.000 0
#> SRR390498 5 0.327 0.575 0.000 0.272 0 0.000 0.728 0
#> SRR390499 4 0.000 0.839 0.000 0.000 0 1.000 0.000 0
#> SRR390500 4 0.000 0.839 0.000 0.000 0 1.000 0.000 0
#> SRR390501 3 0.000 1.000 0.000 0.000 1 0.000 0.000 0
#> SRR390502 3 0.000 1.000 0.000 0.000 1 0.000 0.000 0
#> SRR390503 3 0.000 1.000 0.000 0.000 1 0.000 0.000 0
#> SRR390504 3 0.000 1.000 0.000 0.000 1 0.000 0.000 0
#> SRR390505 6 0.000 1.000 0.000 0.000 0 0.000 0.000 1
#> SRR390506 6 0.000 1.000 0.000 0.000 0 0.000 0.000 1
#> SRR390507 2 0.000 0.989 0.000 1.000 0 0.000 0.000 0
#> SRR390508 2 0.000 0.989 0.000 1.000 0 0.000 0.000 0
#> SRR390509 2 0.000 0.989 0.000 1.000 0 0.000 0.000 0
#> SRR390510 2 0.000 0.989 0.000 1.000 0 0.000 0.000 0
#> SRR390512 2 0.000 0.989 0.000 1.000 0 0.000 0.000 0
#> SRR390513 2 0.000 0.989 0.000 1.000 0 0.000 0.000 0
#> SRR390514 2 0.000 0.989 0.000 1.000 0 0.000 0.000 0
#> SRR390515 1 0.000 0.971 1.000 0.000 0 0.000 0.000 0
#> SRR390516 3 0.000 1.000 0.000 0.000 1 0.000 0.000 0
#> SRR390517 2 0.200 0.858 0.000 0.884 0 0.000 0.116 0
#> SRR390519 5 0.000 0.910 0.000 0.000 0 0.000 1.000 0
#> SRR390520 4 0.331 0.677 0.280 0.000 0 0.720 0.000 0
#> SRR390521 4 0.331 0.677 0.280 0.000 0 0.720 0.000 0
#> SRR390522 4 0.331 0.677 0.280 0.000 0 0.720 0.000 0
#> SRR390523 4 0.331 0.677 0.280 0.000 0 0.720 0.000 0
#> SRR390524 1 0.000 0.971 1.000 0.000 0 0.000 0.000 0
#> SRR390525 1 0.000 0.971 1.000 0.000 0 0.000 0.000 0
#> SRR390526 1 0.260 0.793 0.824 0.000 0 0.176 0.000 0
#> SRR390527 1 0.260 0.793 0.824 0.000 0 0.176 0.000 0
#> SRR390528 4 0.000 0.839 0.000 0.000 0 1.000 0.000 0
#> SRR390529 6 0.000 1.000 0.000 0.000 0 0.000 0.000 1
#> SRR390530 1 0.000 0.971 1.000 0.000 0 0.000 0.000 0
#> SRR390531 1 0.000 0.971 1.000 0.000 0 0.000 0.000 0
#> SRR390532 4 0.000 0.839 0.000 0.000 0 1.000 0.000 0
#> SRR390533 4 0.127 0.825 0.060 0.000 0 0.940 0.000 0
#> SRR390534 4 0.127 0.825 0.060 0.000 0 0.940 0.000 0
#> SRR390535 4 0.127 0.825 0.060 0.000 0 0.940 0.000 0
#> SRR390536 4 0.279 0.767 0.000 0.000 0 0.800 0.200 0
#> SRR390537 4 0.279 0.767 0.000 0.000 0 0.800 0.200 0
#> SRR390538 6 0.000 1.000 0.000 0.000 0 0.000 0.000 1
#> SRR390539 6 0.000 1.000 0.000 0.000 0 0.000 0.000 1
#> SRR390540 6 0.000 1.000 0.000 0.000 0 0.000 0.000 1
#> SRR390541 6 0.000 1.000 0.000 0.000 0 0.000 0.000 1
#> SRR390542 2 0.000 0.989 0.000 1.000 0 0.000 0.000 0
#> SRR390543 2 0.000 0.989 0.000 1.000 0 0.000 0.000 0
#> SRR390544 2 0.000 0.989 0.000 1.000 0 0.000 0.000 0
#> SRR390545 2 0.000 0.989 0.000 1.000 0 0.000 0.000 0
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
SD:kmeans
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"]
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 15244 rows and 71 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)

The plots are:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.140 0.385 0.657 0.4145 0.505 0.505
#> 3 3 0.223 0.651 0.761 0.4167 0.660 0.450
#> 4 4 0.399 0.572 0.698 0.1752 0.806 0.556
#> 5 5 0.549 0.629 0.705 0.1006 0.803 0.437
#> 6 6 0.619 0.644 0.702 0.0557 0.982 0.917
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
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.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.943 0.5398 0.640 0.360
#> SRR390471 1 0.943 0.5398 0.640 0.360
#> SRR390472 1 0.827 0.5635 0.740 0.260
#> SRR390473 1 0.827 0.5635 0.740 0.260
#> SRR390474 2 0.998 -0.1757 0.476 0.524
#> SRR390475 1 0.943 0.5398 0.640 0.360
#> SRR390476 1 0.943 0.5398 0.640 0.360
#> SRR390477 1 0.929 0.5574 0.656 0.344
#> SRR390478 1 0.929 0.5574 0.656 0.344
#> SRR390480 2 0.988 0.0130 0.436 0.564
#> SRR390481 2 0.988 0.0130 0.436 0.564
#> SRR390482 2 0.992 0.0136 0.448 0.552
#> SRR390483 2 0.992 0.0136 0.448 0.552
#> SRR390484 1 0.998 -0.1047 0.524 0.476
#> SRR390485 1 0.998 -0.1047 0.524 0.476
#> SRR390486 1 0.653 0.4352 0.832 0.168
#> SRR390487 1 0.653 0.4352 0.832 0.168
#> SRR390488 1 0.671 0.4440 0.824 0.176
#> SRR390489 1 0.671 0.4440 0.824 0.176
#> SRR390492 2 0.781 0.5215 0.232 0.768
#> SRR390493 2 0.781 0.5215 0.232 0.768
#> SRR390494 2 0.814 0.5106 0.252 0.748
#> SRR390495 2 0.760 0.5190 0.220 0.780
#> SRR390496 2 0.760 0.5190 0.220 0.780
#> SRR390497 1 0.998 -0.1047 0.524 0.476
#> SRR390498 2 0.917 0.2593 0.332 0.668
#> SRR390499 2 0.988 0.0130 0.436 0.564
#> SRR390500 2 0.988 0.0130 0.436 0.564
#> SRR390501 1 0.697 0.4474 0.812 0.188
#> SRR390502 1 0.697 0.4474 0.812 0.188
#> SRR390503 1 0.625 0.4347 0.844 0.156
#> SRR390504 1 0.625 0.4347 0.844 0.156
#> SRR390505 1 0.653 0.5401 0.832 0.168
#> SRR390506 1 0.469 0.4995 0.900 0.100
#> SRR390507 2 0.278 0.5720 0.048 0.952
#> SRR390508 2 0.278 0.5720 0.048 0.952
#> SRR390509 2 0.278 0.5720 0.048 0.952
#> SRR390510 2 0.278 0.5720 0.048 0.952
#> SRR390512 2 0.141 0.5875 0.020 0.980
#> SRR390513 2 0.141 0.5875 0.020 0.980
#> SRR390514 2 0.141 0.5875 0.020 0.980
#> SRR390515 1 0.850 0.5662 0.724 0.276
#> SRR390516 1 0.625 0.4347 0.844 0.156
#> SRR390517 2 0.745 0.3943 0.212 0.788
#> SRR390519 1 0.998 -0.1047 0.524 0.476
#> SRR390520 1 0.821 0.4581 0.744 0.256
#> SRR390521 2 0.998 -0.1757 0.476 0.524
#> SRR390522 2 0.998 -0.1757 0.476 0.524
#> SRR390523 2 0.998 -0.1757 0.476 0.524
#> SRR390524 1 0.929 0.5574 0.656 0.344
#> SRR390525 1 0.929 0.5574 0.656 0.344
#> SRR390526 1 0.925 0.5548 0.660 0.340
#> SRR390527 1 0.925 0.5548 0.660 0.340
#> SRR390528 1 1.000 0.1477 0.500 0.500
#> SRR390529 1 0.689 0.5467 0.816 0.184
#> SRR390530 1 0.929 0.5574 0.656 0.344
#> SRR390531 1 0.929 0.5574 0.656 0.344
#> SRR390532 1 0.904 0.3310 0.680 0.320
#> SRR390533 1 0.999 0.2501 0.516 0.484
#> SRR390534 1 0.999 0.2501 0.516 0.484
#> SRR390535 1 0.999 0.2501 0.516 0.484
#> SRR390536 2 0.760 0.5190 0.220 0.780
#> SRR390537 2 0.760 0.5190 0.220 0.780
#> SRR390538 1 0.925 0.5474 0.660 0.340
#> SRR390539 1 0.925 0.5474 0.660 0.340
#> SRR390540 1 0.925 0.5474 0.660 0.340
#> SRR390541 1 0.925 0.5474 0.660 0.340
#> SRR390542 2 0.141 0.5875 0.020 0.980
#> SRR390543 2 0.141 0.5875 0.020 0.980
#> SRR390544 2 0.141 0.5875 0.020 0.980
#> SRR390545 2 0.141 0.5875 0.020 0.980
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.134 0.7245 0.972 0.016 0.012
#> SRR390471 1 0.134 0.7245 0.972 0.016 0.012
#> SRR390472 1 0.191 0.7180 0.956 0.028 0.016
#> SRR390473 1 0.191 0.7180 0.956 0.028 0.016
#> SRR390474 1 0.802 0.6304 0.656 0.188 0.156
#> SRR390475 1 0.134 0.7245 0.972 0.016 0.012
#> SRR390476 1 0.134 0.7245 0.972 0.016 0.012
#> SRR390477 1 0.191 0.7237 0.956 0.016 0.028
#> SRR390478 1 0.191 0.7237 0.956 0.016 0.028
#> SRR390480 1 0.903 0.5400 0.556 0.248 0.196
#> SRR390481 1 0.903 0.5400 0.556 0.248 0.196
#> SRR390482 1 0.912 0.5278 0.544 0.256 0.200
#> SRR390483 1 0.912 0.5278 0.544 0.256 0.200
#> SRR390484 3 0.662 0.3934 0.024 0.316 0.660
#> SRR390485 3 0.662 0.3934 0.024 0.316 0.660
#> SRR390486 3 0.626 0.7536 0.256 0.028 0.716
#> SRR390487 3 0.626 0.7536 0.256 0.028 0.716
#> SRR390488 3 0.634 0.7489 0.264 0.028 0.708
#> SRR390489 3 0.634 0.7489 0.264 0.028 0.708
#> SRR390492 2 0.857 0.6039 0.144 0.592 0.264
#> SRR390493 2 0.857 0.6039 0.144 0.592 0.264
#> SRR390494 2 0.862 0.5926 0.144 0.584 0.272
#> SRR390495 2 0.875 0.6085 0.164 0.580 0.256
#> SRR390496 2 0.875 0.6085 0.164 0.580 0.256
#> SRR390497 3 0.662 0.3934 0.024 0.316 0.660
#> SRR390498 2 0.729 0.1030 0.040 0.604 0.356
#> SRR390499 1 0.903 0.5400 0.556 0.248 0.196
#> SRR390500 1 0.903 0.5400 0.556 0.248 0.196
#> SRR390501 3 0.634 0.7489 0.264 0.028 0.708
#> SRR390502 3 0.634 0.7489 0.264 0.028 0.708
#> SRR390503 3 0.568 0.7570 0.212 0.024 0.764
#> SRR390504 3 0.659 0.7446 0.208 0.060 0.732
#> SRR390505 1 0.604 0.5838 0.772 0.056 0.172
#> SRR390506 1 0.787 -0.0466 0.524 0.056 0.420
#> SRR390507 2 0.338 0.7840 0.100 0.892 0.008
#> SRR390508 2 0.338 0.7840 0.100 0.892 0.008
#> SRR390509 2 0.338 0.7840 0.100 0.892 0.008
#> SRR390510 2 0.338 0.7840 0.100 0.892 0.008
#> SRR390512 2 0.319 0.7886 0.112 0.888 0.000
#> SRR390513 2 0.319 0.7886 0.112 0.888 0.000
#> SRR390514 2 0.319 0.7886 0.112 0.888 0.000
#> SRR390515 1 0.215 0.7109 0.948 0.036 0.016
#> SRR390516 3 0.555 0.7564 0.212 0.020 0.768
#> SRR390517 2 0.268 0.7089 0.040 0.932 0.028
#> SRR390519 3 0.665 0.3881 0.024 0.320 0.656
#> SRR390520 1 0.829 0.5170 0.608 0.120 0.272
#> SRR390521 1 0.802 0.6304 0.656 0.188 0.156
#> SRR390522 1 0.802 0.6304 0.656 0.188 0.156
#> SRR390523 1 0.802 0.6304 0.656 0.188 0.156
#> SRR390524 1 0.191 0.7237 0.956 0.016 0.028
#> SRR390525 1 0.191 0.7237 0.956 0.016 0.028
#> SRR390526 1 0.277 0.7259 0.920 0.008 0.072
#> SRR390527 1 0.277 0.7259 0.920 0.008 0.072
#> SRR390528 1 0.936 0.5182 0.512 0.268 0.220
#> SRR390529 1 0.464 0.6734 0.848 0.036 0.116
#> SRR390530 1 0.177 0.7239 0.960 0.016 0.024
#> SRR390531 1 0.177 0.7239 0.960 0.016 0.024
#> SRR390532 1 0.948 0.4973 0.496 0.268 0.236
#> SRR390533 1 0.742 0.6654 0.700 0.128 0.172
#> SRR390534 1 0.742 0.6654 0.700 0.128 0.172
#> SRR390535 1 0.748 0.6640 0.696 0.132 0.172
#> SRR390536 2 0.875 0.6085 0.164 0.580 0.256
#> SRR390537 2 0.875 0.6085 0.164 0.580 0.256
#> SRR390538 1 0.319 0.7118 0.896 0.004 0.100
#> SRR390539 1 0.319 0.7118 0.896 0.004 0.100
#> SRR390540 1 0.319 0.7118 0.896 0.004 0.100
#> SRR390541 1 0.319 0.7118 0.896 0.004 0.100
#> SRR390542 2 0.319 0.7886 0.112 0.888 0.000
#> SRR390543 2 0.319 0.7886 0.112 0.888 0.000
#> SRR390544 2 0.319 0.7886 0.112 0.888 0.000
#> SRR390545 2 0.319 0.7886 0.112 0.888 0.000
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.2066 0.68129 0.940 0.008 0.024 0.028
#> SRR390471 1 0.2066 0.68129 0.940 0.008 0.024 0.028
#> SRR390472 1 0.2297 0.67668 0.928 0.004 0.024 0.044
#> SRR390473 1 0.2297 0.67668 0.928 0.004 0.024 0.044
#> SRR390474 1 0.9028 0.24765 0.476 0.116 0.196 0.212
#> SRR390475 1 0.2066 0.68129 0.940 0.008 0.024 0.028
#> SRR390476 1 0.2066 0.68129 0.940 0.008 0.024 0.028
#> SRR390477 1 0.2310 0.68673 0.928 0.004 0.040 0.028
#> SRR390478 1 0.2310 0.68673 0.928 0.004 0.040 0.028
#> SRR390480 4 0.9388 0.32562 0.324 0.160 0.140 0.376
#> SRR390481 4 0.9388 0.32562 0.324 0.160 0.140 0.376
#> SRR390482 4 0.9363 0.32641 0.324 0.156 0.140 0.380
#> SRR390483 4 0.9363 0.32641 0.324 0.156 0.140 0.380
#> SRR390484 4 0.7388 0.00695 0.020 0.104 0.364 0.512
#> SRR390485 4 0.7388 0.00695 0.020 0.104 0.364 0.512
#> SRR390486 3 0.4113 0.91550 0.136 0.012 0.828 0.024
#> SRR390487 3 0.4113 0.91550 0.136 0.012 0.828 0.024
#> SRR390488 3 0.4360 0.91591 0.140 0.012 0.816 0.032
#> SRR390489 3 0.4360 0.91591 0.140 0.012 0.816 0.032
#> SRR390492 4 0.7312 0.40415 0.056 0.372 0.048 0.524
#> SRR390493 4 0.7312 0.40415 0.056 0.372 0.048 0.524
#> SRR390494 4 0.7541 0.42107 0.060 0.360 0.060 0.520
#> SRR390495 4 0.7437 0.41231 0.064 0.372 0.048 0.516
#> SRR390496 4 0.7437 0.41231 0.064 0.372 0.048 0.516
#> SRR390497 4 0.7388 0.00695 0.020 0.104 0.364 0.512
#> SRR390498 2 0.7606 0.32666 0.012 0.536 0.260 0.192
#> SRR390499 4 0.9388 0.32562 0.324 0.160 0.140 0.376
#> SRR390500 4 0.9388 0.32562 0.324 0.160 0.140 0.376
#> SRR390501 3 0.4360 0.91591 0.140 0.012 0.816 0.032
#> SRR390502 3 0.4360 0.91591 0.140 0.012 0.816 0.032
#> SRR390503 3 0.4187 0.84909 0.092 0.012 0.840 0.056
#> SRR390504 3 0.5632 0.77181 0.096 0.012 0.744 0.148
#> SRR390505 1 0.6899 0.52626 0.600 0.012 0.108 0.280
#> SRR390506 1 0.8154 0.20425 0.392 0.012 0.240 0.356
#> SRR390507 2 0.1871 0.92691 0.016 0.948 0.012 0.024
#> SRR390508 2 0.1871 0.92691 0.016 0.948 0.012 0.024
#> SRR390509 2 0.1871 0.92691 0.016 0.948 0.012 0.024
#> SRR390510 2 0.1871 0.92691 0.016 0.948 0.012 0.024
#> SRR390512 2 0.0707 0.93376 0.020 0.980 0.000 0.000
#> SRR390513 2 0.0707 0.93376 0.020 0.980 0.000 0.000
#> SRR390514 2 0.0707 0.93376 0.020 0.980 0.000 0.000
#> SRR390515 1 0.2099 0.67692 0.936 0.004 0.020 0.040
#> SRR390516 3 0.4187 0.84909 0.092 0.012 0.840 0.056
#> SRR390517 2 0.2153 0.90628 0.008 0.936 0.020 0.036
#> SRR390519 4 0.7366 0.04974 0.020 0.108 0.340 0.532
#> SRR390520 1 0.8880 0.27269 0.460 0.076 0.232 0.232
#> SRR390521 1 0.9028 0.24765 0.476 0.116 0.196 0.212
#> SRR390522 1 0.9028 0.24765 0.476 0.116 0.196 0.212
#> SRR390523 1 0.9028 0.24765 0.476 0.116 0.196 0.212
#> SRR390524 1 0.2310 0.68673 0.928 0.004 0.040 0.028
#> SRR390525 1 0.2310 0.68673 0.928 0.004 0.040 0.028
#> SRR390526 1 0.4297 0.65234 0.820 0.000 0.084 0.096
#> SRR390527 1 0.4297 0.65234 0.820 0.000 0.084 0.096
#> SRR390528 4 0.9301 0.31082 0.320 0.136 0.152 0.392
#> SRR390529 1 0.6728 0.57692 0.640 0.012 0.124 0.224
#> SRR390530 1 0.2310 0.68631 0.928 0.004 0.040 0.028
#> SRR390531 1 0.2310 0.68631 0.928 0.004 0.040 0.028
#> SRR390532 4 0.9342 0.30692 0.312 0.136 0.160 0.392
#> SRR390533 1 0.8672 0.20689 0.488 0.084 0.156 0.272
#> SRR390534 1 0.8672 0.20689 0.488 0.084 0.156 0.272
#> SRR390535 1 0.8638 0.20543 0.492 0.084 0.152 0.272
#> SRR390536 4 0.7437 0.41231 0.064 0.372 0.048 0.516
#> SRR390537 4 0.7437 0.41231 0.064 0.372 0.048 0.516
#> SRR390538 1 0.6638 0.57839 0.640 0.008 0.124 0.228
#> SRR390539 1 0.6638 0.57839 0.640 0.008 0.124 0.228
#> SRR390540 1 0.6638 0.57839 0.640 0.008 0.124 0.228
#> SRR390541 1 0.6638 0.57839 0.640 0.008 0.124 0.228
#> SRR390542 2 0.0707 0.93376 0.020 0.980 0.000 0.000
#> SRR390543 2 0.0707 0.93376 0.020 0.980 0.000 0.000
#> SRR390544 2 0.0707 0.93376 0.020 0.980 0.000 0.000
#> SRR390545 2 0.0707 0.93376 0.020 0.980 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.251 0.801 0.904 0.008 0.012 0.008 0.068
#> SRR390471 1 0.251 0.801 0.904 0.008 0.012 0.008 0.068
#> SRR390472 1 0.245 0.802 0.908 0.008 0.012 0.008 0.064
#> SRR390473 1 0.245 0.802 0.908 0.008 0.012 0.008 0.064
#> SRR390474 4 0.826 0.392 0.340 0.072 0.176 0.384 0.028
#> SRR390475 1 0.251 0.801 0.904 0.008 0.012 0.008 0.068
#> SRR390476 1 0.251 0.801 0.904 0.008 0.012 0.008 0.068
#> SRR390477 1 0.383 0.803 0.844 0.004 0.040 0.048 0.064
#> SRR390478 1 0.383 0.803 0.844 0.004 0.040 0.048 0.064
#> SRR390480 4 0.680 0.605 0.164 0.080 0.080 0.644 0.032
#> SRR390481 4 0.680 0.605 0.164 0.080 0.080 0.644 0.032
#> SRR390482 4 0.680 0.605 0.164 0.080 0.080 0.644 0.032
#> SRR390483 4 0.680 0.605 0.164 0.080 0.080 0.644 0.032
#> SRR390484 5 0.762 0.154 0.004 0.044 0.216 0.356 0.380
#> SRR390485 5 0.762 0.154 0.004 0.044 0.216 0.356 0.380
#> SRR390486 3 0.261 0.924 0.068 0.008 0.896 0.028 0.000
#> SRR390487 3 0.261 0.924 0.068 0.008 0.896 0.028 0.000
#> SRR390488 3 0.261 0.924 0.068 0.008 0.896 0.028 0.000
#> SRR390489 3 0.261 0.924 0.068 0.008 0.896 0.028 0.000
#> SRR390492 4 0.631 0.376 0.004 0.204 0.036 0.632 0.124
#> SRR390493 4 0.631 0.376 0.004 0.204 0.036 0.632 0.124
#> SRR390494 4 0.645 0.369 0.004 0.188 0.052 0.632 0.124
#> SRR390495 4 0.625 0.382 0.004 0.208 0.036 0.636 0.116
#> SRR390496 4 0.625 0.382 0.004 0.208 0.036 0.636 0.116
#> SRR390497 5 0.762 0.154 0.004 0.044 0.216 0.356 0.380
#> SRR390498 2 0.711 0.366 0.004 0.500 0.140 0.044 0.312
#> SRR390499 4 0.680 0.605 0.164 0.080 0.080 0.644 0.032
#> SRR390500 4 0.680 0.605 0.164 0.080 0.080 0.644 0.032
#> SRR390501 3 0.261 0.924 0.068 0.008 0.896 0.028 0.000
#> SRR390502 3 0.261 0.924 0.068 0.008 0.896 0.028 0.000
#> SRR390503 3 0.244 0.863 0.032 0.004 0.912 0.008 0.044
#> SRR390504 3 0.492 0.663 0.028 0.004 0.720 0.028 0.220
#> SRR390505 5 0.582 0.291 0.380 0.000 0.036 0.036 0.548
#> SRR390506 5 0.492 0.337 0.200 0.000 0.040 0.032 0.728
#> SRR390507 2 0.133 0.932 0.000 0.956 0.008 0.004 0.032
#> SRR390508 2 0.133 0.932 0.000 0.956 0.008 0.004 0.032
#> SRR390509 2 0.133 0.932 0.000 0.956 0.008 0.004 0.032
#> SRR390510 2 0.133 0.932 0.000 0.956 0.008 0.004 0.032
#> SRR390512 2 0.029 0.940 0.000 0.992 0.000 0.008 0.000
#> SRR390513 2 0.029 0.940 0.000 0.992 0.000 0.008 0.000
#> SRR390514 2 0.029 0.940 0.000 0.992 0.000 0.008 0.000
#> SRR390515 1 0.234 0.802 0.912 0.008 0.008 0.008 0.064
#> SRR390516 3 0.244 0.863 0.032 0.004 0.912 0.008 0.044
#> SRR390517 2 0.230 0.905 0.000 0.912 0.008 0.020 0.060
#> SRR390519 5 0.759 0.157 0.004 0.044 0.208 0.364 0.380
#> SRR390520 4 0.798 0.367 0.336 0.036 0.200 0.396 0.032
#> SRR390521 4 0.826 0.392 0.340 0.072 0.176 0.384 0.028
#> SRR390522 4 0.826 0.392 0.340 0.072 0.176 0.384 0.028
#> SRR390523 4 0.826 0.392 0.340 0.072 0.176 0.384 0.028
#> SRR390524 1 0.383 0.803 0.844 0.004 0.040 0.048 0.064
#> SRR390525 1 0.383 0.803 0.844 0.004 0.040 0.048 0.064
#> SRR390526 1 0.608 0.602 0.672 0.000 0.096 0.156 0.076
#> SRR390527 1 0.608 0.602 0.672 0.000 0.096 0.156 0.076
#> SRR390528 4 0.667 0.595 0.160 0.064 0.084 0.656 0.036
#> SRR390529 5 0.598 0.283 0.396 0.000 0.036 0.044 0.524
#> SRR390530 1 0.369 0.805 0.852 0.004 0.040 0.048 0.056
#> SRR390531 1 0.369 0.805 0.852 0.004 0.040 0.048 0.056
#> SRR390532 4 0.667 0.595 0.160 0.064 0.084 0.656 0.036
#> SRR390533 4 0.789 0.471 0.300 0.048 0.116 0.480 0.056
#> SRR390534 4 0.789 0.471 0.300 0.048 0.116 0.480 0.056
#> SRR390535 4 0.774 0.472 0.304 0.048 0.104 0.492 0.052
#> SRR390536 4 0.625 0.382 0.004 0.208 0.036 0.636 0.116
#> SRR390537 4 0.625 0.382 0.004 0.208 0.036 0.636 0.116
#> SRR390538 5 0.592 0.284 0.396 0.000 0.036 0.040 0.528
#> SRR390539 5 0.592 0.284 0.396 0.000 0.036 0.040 0.528
#> SRR390540 5 0.592 0.284 0.396 0.000 0.036 0.040 0.528
#> SRR390541 5 0.592 0.284 0.396 0.000 0.036 0.040 0.528
#> SRR390542 2 0.029 0.940 0.000 0.992 0.000 0.008 0.000
#> SRR390543 2 0.029 0.940 0.000 0.992 0.000 0.008 0.000
#> SRR390544 2 0.029 0.940 0.000 0.992 0.000 0.008 0.000
#> SRR390545 2 0.029 0.940 0.000 0.992 0.000 0.008 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.0603 0.6777 0.980 0.000 0.016 0.004 0.000 0.000
#> SRR390471 1 0.0603 0.6777 0.980 0.000 0.016 0.004 0.000 0.000
#> SRR390472 1 0.0748 0.6758 0.976 0.000 0.016 0.004 0.000 0.004
#> SRR390473 1 0.0748 0.6758 0.976 0.000 0.016 0.004 0.000 0.004
#> SRR390474 4 0.9280 0.3863 0.196 0.040 0.164 0.316 0.148 0.136
#> SRR390475 1 0.0603 0.6777 0.980 0.000 0.016 0.004 0.000 0.000
#> SRR390476 1 0.0603 0.6777 0.980 0.000 0.016 0.004 0.000 0.000
#> SRR390477 1 0.6127 0.6472 0.632 0.004 0.036 0.028 0.128 0.172
#> SRR390478 1 0.6127 0.6472 0.632 0.004 0.036 0.028 0.128 0.172
#> SRR390480 4 0.8942 0.5283 0.112 0.052 0.060 0.324 0.200 0.252
#> SRR390481 4 0.8942 0.5283 0.112 0.052 0.060 0.324 0.200 0.252
#> SRR390482 4 0.8942 0.5283 0.112 0.052 0.060 0.324 0.200 0.252
#> SRR390483 4 0.8942 0.5283 0.112 0.052 0.060 0.324 0.200 0.252
#> SRR390484 5 0.5736 0.8486 0.004 0.020 0.092 0.364 0.520 0.000
#> SRR390485 5 0.5736 0.8486 0.004 0.020 0.092 0.364 0.520 0.000
#> SRR390486 3 0.0820 0.9190 0.012 0.000 0.972 0.016 0.000 0.000
#> SRR390487 3 0.0820 0.9190 0.012 0.000 0.972 0.016 0.000 0.000
#> SRR390488 3 0.0964 0.9192 0.012 0.000 0.968 0.016 0.000 0.004
#> SRR390489 3 0.0964 0.9192 0.012 0.000 0.968 0.016 0.000 0.004
#> SRR390492 4 0.2797 0.0925 0.000 0.140 0.004 0.844 0.008 0.004
#> SRR390493 4 0.2797 0.0925 0.000 0.140 0.004 0.844 0.008 0.004
#> SRR390494 4 0.2834 0.0820 0.000 0.128 0.008 0.848 0.016 0.000
#> SRR390495 4 0.2402 0.1081 0.000 0.140 0.004 0.856 0.000 0.000
#> SRR390496 4 0.2402 0.1081 0.000 0.140 0.004 0.856 0.000 0.000
#> SRR390497 5 0.5736 0.8486 0.004 0.020 0.092 0.364 0.520 0.000
#> SRR390498 5 0.5097 0.1822 0.000 0.344 0.052 0.000 0.584 0.020
#> SRR390499 4 0.8942 0.5283 0.112 0.052 0.060 0.324 0.200 0.252
#> SRR390500 4 0.8942 0.5283 0.112 0.052 0.060 0.324 0.200 0.252
#> SRR390501 3 0.0964 0.9192 0.012 0.000 0.968 0.016 0.000 0.004
#> SRR390502 3 0.0964 0.9192 0.012 0.000 0.968 0.016 0.000 0.004
#> SRR390503 3 0.1700 0.8644 0.004 0.000 0.916 0.000 0.080 0.000
#> SRR390504 3 0.3714 0.4794 0.004 0.000 0.656 0.000 0.340 0.000
#> SRR390505 6 0.4625 0.9056 0.256 0.000 0.036 0.004 0.020 0.684
#> SRR390506 6 0.5347 0.6089 0.112 0.000 0.020 0.000 0.240 0.628
#> SRR390507 2 0.3278 0.8929 0.004 0.848 0.008 0.004 0.076 0.060
#> SRR390508 2 0.3278 0.8929 0.004 0.848 0.008 0.004 0.076 0.060
#> SRR390509 2 0.3278 0.8929 0.004 0.848 0.008 0.004 0.076 0.060
#> SRR390510 2 0.3278 0.8929 0.004 0.848 0.008 0.004 0.076 0.060
#> SRR390512 2 0.0405 0.9257 0.000 0.988 0.000 0.008 0.000 0.004
#> SRR390513 2 0.0405 0.9257 0.000 0.988 0.000 0.008 0.000 0.004
#> SRR390514 2 0.0405 0.9257 0.000 0.988 0.000 0.008 0.000 0.004
#> SRR390515 1 0.0748 0.6758 0.976 0.000 0.016 0.004 0.000 0.004
#> SRR390516 3 0.1700 0.8644 0.004 0.000 0.916 0.000 0.080 0.000
#> SRR390517 2 0.3650 0.8660 0.004 0.812 0.004 0.004 0.116 0.060
#> SRR390519 5 0.5672 0.8429 0.004 0.020 0.084 0.372 0.520 0.000
#> SRR390520 4 0.9087 0.3761 0.200 0.020 0.172 0.316 0.156 0.136
#> SRR390521 4 0.9280 0.3863 0.196 0.040 0.164 0.316 0.148 0.136
#> SRR390522 4 0.9280 0.3863 0.196 0.040 0.164 0.316 0.148 0.136
#> SRR390523 4 0.9280 0.3863 0.196 0.040 0.164 0.316 0.148 0.136
#> SRR390524 1 0.6127 0.6472 0.632 0.004 0.036 0.028 0.128 0.172
#> SRR390525 1 0.6127 0.6472 0.632 0.004 0.036 0.028 0.128 0.172
#> SRR390526 1 0.7856 0.3298 0.416 0.004 0.068 0.068 0.168 0.276
#> SRR390527 1 0.7856 0.3298 0.416 0.004 0.068 0.068 0.168 0.276
#> SRR390528 4 0.8862 0.5236 0.108 0.044 0.060 0.324 0.212 0.252
#> SRR390529 6 0.4187 0.9185 0.256 0.000 0.032 0.004 0.004 0.704
#> SRR390530 1 0.6201 0.6429 0.624 0.004 0.036 0.028 0.140 0.168
#> SRR390531 1 0.6201 0.6429 0.624 0.004 0.036 0.028 0.140 0.168
#> SRR390532 4 0.8862 0.5236 0.108 0.044 0.060 0.324 0.212 0.252
#> SRR390533 4 0.8952 0.4292 0.204 0.016 0.104 0.316 0.156 0.204
#> SRR390534 4 0.8952 0.4292 0.204 0.016 0.104 0.316 0.156 0.204
#> SRR390535 4 0.8867 0.4196 0.204 0.016 0.080 0.308 0.164 0.228
#> SRR390536 4 0.2402 0.1081 0.000 0.140 0.004 0.856 0.000 0.000
#> SRR390537 4 0.2402 0.1081 0.000 0.140 0.004 0.856 0.000 0.000
#> SRR390538 6 0.4209 0.9225 0.260 0.004 0.032 0.004 0.000 0.700
#> SRR390539 6 0.4209 0.9225 0.260 0.004 0.032 0.004 0.000 0.700
#> SRR390540 6 0.4209 0.9225 0.260 0.004 0.032 0.004 0.000 0.700
#> SRR390541 6 0.4209 0.9225 0.260 0.004 0.032 0.004 0.000 0.700
#> SRR390542 2 0.0260 0.9259 0.000 0.992 0.000 0.008 0.000 0.000
#> SRR390543 2 0.0260 0.9259 0.000 0.992 0.000 0.008 0.000 0.000
#> SRR390544 2 0.0260 0.9259 0.000 0.992 0.000 0.008 0.000 0.000
#> SRR390545 2 0.0260 0.9259 0.000 0.992 0.000 0.008 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
SD:skmeans
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"]
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 15244 rows and 71 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:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.797 0.865 0.945 0.4778 0.546 0.546
#> 3 3 0.627 0.797 0.886 0.3619 0.758 0.577
#> 4 4 0.714 0.822 0.878 0.1381 0.766 0.445
#> 5 5 0.786 0.824 0.885 0.0728 0.921 0.708
#> 6 6 0.822 0.802 0.857 0.0478 0.922 0.649
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
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.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.0000 0.909 1.000 0.000
#> SRR390471 1 0.0000 0.909 1.000 0.000
#> SRR390472 1 0.0000 0.909 1.000 0.000
#> SRR390473 1 0.0000 0.909 1.000 0.000
#> SRR390474 1 0.0376 0.908 0.996 0.004
#> SRR390475 1 0.0000 0.909 1.000 0.000
#> SRR390476 1 0.0000 0.909 1.000 0.000
#> SRR390477 1 0.0000 0.909 1.000 0.000
#> SRR390478 1 0.0000 0.909 1.000 0.000
#> SRR390480 1 0.9970 0.254 0.532 0.468
#> SRR390481 1 0.9970 0.254 0.532 0.468
#> SRR390482 1 0.9970 0.254 0.532 0.468
#> SRR390483 1 0.9970 0.254 0.532 0.468
#> SRR390484 2 0.0376 0.996 0.004 0.996
#> SRR390485 2 0.0376 0.996 0.004 0.996
#> SRR390486 1 0.1184 0.903 0.984 0.016
#> SRR390487 1 0.1184 0.903 0.984 0.016
#> SRR390488 1 0.1184 0.903 0.984 0.016
#> SRR390489 1 0.1184 0.903 0.984 0.016
#> SRR390492 2 0.0000 0.999 0.000 1.000
#> SRR390493 2 0.0000 0.999 0.000 1.000
#> SRR390494 2 0.0000 0.999 0.000 1.000
#> SRR390495 2 0.0000 0.999 0.000 1.000
#> SRR390496 2 0.0000 0.999 0.000 1.000
#> SRR390497 2 0.0376 0.996 0.004 0.996
#> SRR390498 2 0.0376 0.996 0.004 0.996
#> SRR390499 1 0.9970 0.254 0.532 0.468
#> SRR390500 1 0.9970 0.254 0.532 0.468
#> SRR390501 1 0.1184 0.903 0.984 0.016
#> SRR390502 1 0.1184 0.903 0.984 0.016
#> SRR390503 1 0.1184 0.903 0.984 0.016
#> SRR390504 1 0.1184 0.903 0.984 0.016
#> SRR390505 1 0.0000 0.909 1.000 0.000
#> SRR390506 1 0.0000 0.909 1.000 0.000
#> SRR390507 2 0.0000 0.999 0.000 1.000
#> SRR390508 2 0.0000 0.999 0.000 1.000
#> SRR390509 2 0.0000 0.999 0.000 1.000
#> SRR390510 2 0.0000 0.999 0.000 1.000
#> SRR390512 2 0.0000 0.999 0.000 1.000
#> SRR390513 2 0.0000 0.999 0.000 1.000
#> SRR390514 2 0.0000 0.999 0.000 1.000
#> SRR390515 1 0.0000 0.909 1.000 0.000
#> SRR390516 1 0.1184 0.903 0.984 0.016
#> SRR390517 2 0.0000 0.999 0.000 1.000
#> SRR390519 2 0.0376 0.996 0.004 0.996
#> SRR390520 1 0.0000 0.909 1.000 0.000
#> SRR390521 1 0.0376 0.908 0.996 0.004
#> SRR390522 1 0.0376 0.908 0.996 0.004
#> SRR390523 1 0.0376 0.908 0.996 0.004
#> SRR390524 1 0.0000 0.909 1.000 0.000
#> SRR390525 1 0.0000 0.909 1.000 0.000
#> SRR390526 1 0.0000 0.909 1.000 0.000
#> SRR390527 1 0.0000 0.909 1.000 0.000
#> SRR390528 1 0.9970 0.254 0.532 0.468
#> SRR390529 1 0.0000 0.909 1.000 0.000
#> SRR390530 1 0.0000 0.909 1.000 0.000
#> SRR390531 1 0.0000 0.909 1.000 0.000
#> SRR390532 1 0.9970 0.254 0.532 0.468
#> SRR390533 1 0.0376 0.908 0.996 0.004
#> SRR390534 1 0.0376 0.908 0.996 0.004
#> SRR390535 1 0.0376 0.908 0.996 0.004
#> SRR390536 2 0.0000 0.999 0.000 1.000
#> SRR390537 2 0.0000 0.999 0.000 1.000
#> SRR390538 1 0.0000 0.909 1.000 0.000
#> SRR390539 1 0.0000 0.909 1.000 0.000
#> SRR390540 1 0.0000 0.909 1.000 0.000
#> SRR390541 1 0.0000 0.909 1.000 0.000
#> SRR390542 2 0.0000 0.999 0.000 1.000
#> SRR390543 2 0.0000 0.999 0.000 1.000
#> SRR390544 2 0.0000 0.999 0.000 1.000
#> SRR390545 2 0.0000 0.999 0.000 1.000
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.0747 0.8736 0.984 0.000 0.016
#> SRR390471 1 0.0747 0.8736 0.984 0.000 0.016
#> SRR390472 1 0.1964 0.8581 0.944 0.000 0.056
#> SRR390473 1 0.1964 0.8581 0.944 0.000 0.056
#> SRR390474 1 0.4960 0.8151 0.832 0.040 0.128
#> SRR390475 1 0.0747 0.8736 0.984 0.000 0.016
#> SRR390476 1 0.0747 0.8736 0.984 0.000 0.016
#> SRR390477 1 0.0747 0.8736 0.984 0.000 0.016
#> SRR390478 1 0.0747 0.8736 0.984 0.000 0.016
#> SRR390480 1 0.7485 0.6858 0.680 0.096 0.224
#> SRR390481 1 0.7485 0.6858 0.680 0.096 0.224
#> SRR390482 1 0.7485 0.6858 0.680 0.096 0.224
#> SRR390483 1 0.7485 0.6858 0.680 0.096 0.224
#> SRR390484 3 0.5178 0.6138 0.000 0.256 0.744
#> SRR390485 3 0.5178 0.6138 0.000 0.256 0.744
#> SRR390486 3 0.0424 0.8209 0.008 0.000 0.992
#> SRR390487 3 0.0424 0.8209 0.008 0.000 0.992
#> SRR390488 3 0.0424 0.8209 0.008 0.000 0.992
#> SRR390489 3 0.0424 0.8209 0.008 0.000 0.992
#> SRR390492 2 0.4178 0.8500 0.000 0.828 0.172
#> SRR390493 2 0.4178 0.8500 0.000 0.828 0.172
#> SRR390494 2 0.4178 0.8500 0.000 0.828 0.172
#> SRR390495 2 0.4178 0.8500 0.000 0.828 0.172
#> SRR390496 2 0.4178 0.8500 0.000 0.828 0.172
#> SRR390497 3 0.5178 0.6138 0.000 0.256 0.744
#> SRR390498 3 0.6280 0.3314 0.000 0.460 0.540
#> SRR390499 1 0.7485 0.6858 0.680 0.096 0.224
#> SRR390500 1 0.7485 0.6858 0.680 0.096 0.224
#> SRR390501 3 0.0424 0.8209 0.008 0.000 0.992
#> SRR390502 3 0.0424 0.8209 0.008 0.000 0.992
#> SRR390503 3 0.0424 0.8209 0.008 0.000 0.992
#> SRR390504 3 0.0424 0.8209 0.008 0.000 0.992
#> SRR390505 1 0.6260 -0.0222 0.552 0.000 0.448
#> SRR390506 3 0.6192 0.3771 0.420 0.000 0.580
#> SRR390507 2 0.0000 0.9182 0.000 1.000 0.000
#> SRR390508 2 0.0000 0.9182 0.000 1.000 0.000
#> SRR390509 2 0.0000 0.9182 0.000 1.000 0.000
#> SRR390510 2 0.0000 0.9182 0.000 1.000 0.000
#> SRR390512 2 0.0000 0.9182 0.000 1.000 0.000
#> SRR390513 2 0.0000 0.9182 0.000 1.000 0.000
#> SRR390514 2 0.0000 0.9182 0.000 1.000 0.000
#> SRR390515 1 0.1964 0.8581 0.944 0.000 0.056
#> SRR390516 3 0.0424 0.8209 0.008 0.000 0.992
#> SRR390517 2 0.1529 0.8876 0.000 0.960 0.040
#> SRR390519 3 0.5178 0.6138 0.000 0.256 0.744
#> SRR390520 3 0.5327 0.5963 0.272 0.000 0.728
#> SRR390521 1 0.4960 0.8151 0.832 0.040 0.128
#> SRR390522 1 0.4960 0.8151 0.832 0.040 0.128
#> SRR390523 1 0.4960 0.8151 0.832 0.040 0.128
#> SRR390524 1 0.0747 0.8736 0.984 0.000 0.016
#> SRR390525 1 0.0747 0.8736 0.984 0.000 0.016
#> SRR390526 1 0.1411 0.8707 0.964 0.000 0.036
#> SRR390527 1 0.1411 0.8707 0.964 0.000 0.036
#> SRR390528 3 0.4887 0.6191 0.228 0.000 0.772
#> SRR390529 1 0.1964 0.8571 0.944 0.000 0.056
#> SRR390530 1 0.0747 0.8736 0.984 0.000 0.016
#> SRR390531 1 0.0747 0.8736 0.984 0.000 0.016
#> SRR390532 3 0.4235 0.6913 0.176 0.000 0.824
#> SRR390533 1 0.4121 0.8061 0.832 0.000 0.168
#> SRR390534 1 0.4121 0.8061 0.832 0.000 0.168
#> SRR390535 1 0.4121 0.8061 0.832 0.000 0.168
#> SRR390536 2 0.4178 0.8500 0.000 0.828 0.172
#> SRR390537 2 0.4178 0.8500 0.000 0.828 0.172
#> SRR390538 1 0.0592 0.8719 0.988 0.000 0.012
#> SRR390539 1 0.0592 0.8719 0.988 0.000 0.012
#> SRR390540 1 0.0592 0.8719 0.988 0.000 0.012
#> SRR390541 1 0.0592 0.8719 0.988 0.000 0.012
#> SRR390542 2 0.0000 0.9182 0.000 1.000 0.000
#> SRR390543 2 0.0000 0.9182 0.000 1.000 0.000
#> SRR390544 2 0.0000 0.9182 0.000 1.000 0.000
#> SRR390545 2 0.0000 0.9182 0.000 1.000 0.000
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.0000 0.945 1.000 0.000 0.000 0.000
#> SRR390471 1 0.0000 0.945 1.000 0.000 0.000 0.000
#> SRR390472 1 0.0188 0.944 0.996 0.000 0.004 0.000
#> SRR390473 1 0.0188 0.944 0.996 0.000 0.004 0.000
#> SRR390474 4 0.6966 0.565 0.268 0.000 0.160 0.572
#> SRR390475 1 0.0000 0.945 1.000 0.000 0.000 0.000
#> SRR390476 1 0.0000 0.945 1.000 0.000 0.000 0.000
#> SRR390477 1 0.0000 0.945 1.000 0.000 0.000 0.000
#> SRR390478 1 0.0000 0.945 1.000 0.000 0.000 0.000
#> SRR390480 4 0.3570 0.736 0.048 0.000 0.092 0.860
#> SRR390481 4 0.3570 0.736 0.048 0.000 0.092 0.860
#> SRR390482 4 0.3570 0.736 0.048 0.000 0.092 0.860
#> SRR390483 4 0.3570 0.736 0.048 0.000 0.092 0.860
#> SRR390484 3 0.5574 0.661 0.000 0.048 0.668 0.284
#> SRR390485 3 0.5574 0.661 0.000 0.048 0.668 0.284
#> SRR390486 3 0.0469 0.858 0.012 0.000 0.988 0.000
#> SRR390487 3 0.0469 0.858 0.012 0.000 0.988 0.000
#> SRR390488 3 0.0469 0.858 0.012 0.000 0.988 0.000
#> SRR390489 3 0.0469 0.858 0.012 0.000 0.988 0.000
#> SRR390492 4 0.4944 0.623 0.000 0.160 0.072 0.768
#> SRR390493 4 0.4944 0.623 0.000 0.160 0.072 0.768
#> SRR390494 4 0.4944 0.623 0.000 0.160 0.072 0.768
#> SRR390495 4 0.4944 0.623 0.000 0.160 0.072 0.768
#> SRR390496 4 0.4944 0.623 0.000 0.160 0.072 0.768
#> SRR390497 3 0.5574 0.661 0.000 0.048 0.668 0.284
#> SRR390498 2 0.2149 0.886 0.000 0.912 0.088 0.000
#> SRR390499 4 0.3570 0.736 0.048 0.000 0.092 0.860
#> SRR390500 4 0.3570 0.736 0.048 0.000 0.092 0.860
#> SRR390501 3 0.0469 0.858 0.012 0.000 0.988 0.000
#> SRR390502 3 0.0469 0.858 0.012 0.000 0.988 0.000
#> SRR390503 3 0.0469 0.858 0.012 0.000 0.988 0.000
#> SRR390504 3 0.0469 0.858 0.012 0.000 0.988 0.000
#> SRR390505 1 0.2401 0.914 0.904 0.000 0.004 0.092
#> SRR390506 1 0.5174 0.765 0.756 0.000 0.152 0.092
#> SRR390507 2 0.0000 0.991 0.000 1.000 0.000 0.000
#> SRR390508 2 0.0000 0.991 0.000 1.000 0.000 0.000
#> SRR390509 2 0.0000 0.991 0.000 1.000 0.000 0.000
#> SRR390510 2 0.0000 0.991 0.000 1.000 0.000 0.000
#> SRR390512 2 0.0000 0.991 0.000 1.000 0.000 0.000
#> SRR390513 2 0.0000 0.991 0.000 1.000 0.000 0.000
#> SRR390514 2 0.0000 0.991 0.000 1.000 0.000 0.000
#> SRR390515 1 0.0188 0.944 0.996 0.000 0.004 0.000
#> SRR390516 3 0.0469 0.858 0.012 0.000 0.988 0.000
#> SRR390517 2 0.0000 0.991 0.000 1.000 0.000 0.000
#> SRR390519 3 0.5599 0.656 0.000 0.048 0.664 0.288
#> SRR390520 3 0.6514 0.498 0.212 0.000 0.636 0.152
#> SRR390521 4 0.6966 0.565 0.268 0.000 0.160 0.572
#> SRR390522 4 0.6966 0.565 0.268 0.000 0.160 0.572
#> SRR390523 4 0.6966 0.565 0.268 0.000 0.160 0.572
#> SRR390524 1 0.0000 0.945 1.000 0.000 0.000 0.000
#> SRR390525 1 0.0000 0.945 1.000 0.000 0.000 0.000
#> SRR390526 1 0.3047 0.882 0.872 0.000 0.012 0.116
#> SRR390527 1 0.3047 0.882 0.872 0.000 0.012 0.116
#> SRR390528 4 0.3308 0.733 0.036 0.000 0.092 0.872
#> SRR390529 1 0.2401 0.914 0.904 0.000 0.004 0.092
#> SRR390530 1 0.0000 0.945 1.000 0.000 0.000 0.000
#> SRR390531 1 0.0000 0.945 1.000 0.000 0.000 0.000
#> SRR390532 4 0.3372 0.731 0.036 0.000 0.096 0.868
#> SRR390533 4 0.5664 0.649 0.228 0.000 0.076 0.696
#> SRR390534 4 0.5664 0.649 0.228 0.000 0.076 0.696
#> SRR390535 4 0.5664 0.649 0.228 0.000 0.076 0.696
#> SRR390536 4 0.4944 0.623 0.000 0.160 0.072 0.768
#> SRR390537 4 0.4944 0.623 0.000 0.160 0.072 0.768
#> SRR390538 1 0.2216 0.915 0.908 0.000 0.000 0.092
#> SRR390539 1 0.2216 0.915 0.908 0.000 0.000 0.092
#> SRR390540 1 0.2216 0.915 0.908 0.000 0.000 0.092
#> SRR390541 1 0.2216 0.915 0.908 0.000 0.000 0.092
#> SRR390542 2 0.0000 0.991 0.000 1.000 0.000 0.000
#> SRR390543 2 0.0000 0.991 0.000 1.000 0.000 0.000
#> SRR390544 2 0.0000 0.991 0.000 1.000 0.000 0.000
#> SRR390545 2 0.0000 0.991 0.000 1.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.0898 0.841 0.972 0.000 0.000 0.020 0.008
#> SRR390471 1 0.0898 0.841 0.972 0.000 0.000 0.020 0.008
#> SRR390472 1 0.0798 0.842 0.976 0.000 0.000 0.016 0.008
#> SRR390473 1 0.0798 0.842 0.976 0.000 0.000 0.016 0.008
#> SRR390474 4 0.7662 0.492 0.212 0.000 0.136 0.500 0.152
#> SRR390475 1 0.0898 0.841 0.972 0.000 0.000 0.020 0.008
#> SRR390476 1 0.0898 0.841 0.972 0.000 0.000 0.020 0.008
#> SRR390477 1 0.0486 0.842 0.988 0.000 0.004 0.004 0.004
#> SRR390478 1 0.0486 0.842 0.988 0.000 0.004 0.004 0.004
#> SRR390480 4 0.1928 0.769 0.004 0.000 0.004 0.920 0.072
#> SRR390481 4 0.1928 0.769 0.004 0.000 0.004 0.920 0.072
#> SRR390482 4 0.1928 0.769 0.004 0.000 0.004 0.920 0.072
#> SRR390483 4 0.1928 0.769 0.004 0.000 0.004 0.920 0.072
#> SRR390484 5 0.3086 0.784 0.000 0.004 0.180 0.000 0.816
#> SRR390485 5 0.3086 0.784 0.000 0.004 0.180 0.000 0.816
#> SRR390486 3 0.0162 0.991 0.000 0.000 0.996 0.000 0.004
#> SRR390487 3 0.0162 0.991 0.000 0.000 0.996 0.000 0.004
#> SRR390488 3 0.0162 0.991 0.000 0.000 0.996 0.000 0.004
#> SRR390489 3 0.0162 0.991 0.000 0.000 0.996 0.000 0.004
#> SRR390492 5 0.2464 0.885 0.000 0.012 0.004 0.092 0.892
#> SRR390493 5 0.2464 0.885 0.000 0.012 0.004 0.092 0.892
#> SRR390494 5 0.2464 0.885 0.000 0.012 0.004 0.092 0.892
#> SRR390495 5 0.2464 0.885 0.000 0.012 0.004 0.092 0.892
#> SRR390496 5 0.2464 0.885 0.000 0.012 0.004 0.092 0.892
#> SRR390497 5 0.3086 0.784 0.000 0.004 0.180 0.000 0.816
#> SRR390498 2 0.1877 0.921 0.000 0.924 0.012 0.000 0.064
#> SRR390499 4 0.1928 0.769 0.004 0.000 0.004 0.920 0.072
#> SRR390500 4 0.1928 0.769 0.004 0.000 0.004 0.920 0.072
#> SRR390501 3 0.0162 0.991 0.000 0.000 0.996 0.000 0.004
#> SRR390502 3 0.0162 0.991 0.000 0.000 0.996 0.000 0.004
#> SRR390503 3 0.0000 0.989 0.000 0.000 1.000 0.000 0.000
#> SRR390504 3 0.1270 0.940 0.000 0.000 0.948 0.000 0.052
#> SRR390505 1 0.5544 0.692 0.680 0.000 0.024 0.208 0.088
#> SRR390506 1 0.5927 0.682 0.668 0.000 0.052 0.192 0.088
#> SRR390507 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390508 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390509 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390510 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390512 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390513 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390514 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390515 1 0.0798 0.842 0.976 0.000 0.000 0.016 0.008
#> SRR390516 3 0.0000 0.989 0.000 0.000 1.000 0.000 0.000
#> SRR390517 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390519 5 0.3010 0.789 0.000 0.004 0.172 0.000 0.824
#> SRR390520 4 0.8294 0.398 0.204 0.000 0.196 0.396 0.204
#> SRR390521 4 0.7662 0.492 0.212 0.000 0.136 0.500 0.152
#> SRR390522 4 0.7662 0.492 0.212 0.000 0.136 0.500 0.152
#> SRR390523 4 0.7662 0.492 0.212 0.000 0.136 0.500 0.152
#> SRR390524 1 0.0486 0.842 0.988 0.000 0.004 0.004 0.004
#> SRR390525 1 0.0486 0.842 0.988 0.000 0.004 0.004 0.004
#> SRR390526 1 0.4531 0.329 0.568 0.000 0.004 0.424 0.004
#> SRR390527 1 0.4531 0.329 0.568 0.000 0.004 0.424 0.004
#> SRR390528 4 0.2787 0.741 0.004 0.000 0.004 0.856 0.136
#> SRR390529 1 0.4509 0.743 0.744 0.000 0.024 0.208 0.024
#> SRR390530 1 0.0613 0.841 0.984 0.000 0.004 0.008 0.004
#> SRR390531 1 0.0613 0.841 0.984 0.000 0.004 0.008 0.004
#> SRR390532 4 0.2787 0.741 0.004 0.000 0.004 0.856 0.136
#> SRR390533 4 0.0579 0.760 0.008 0.000 0.000 0.984 0.008
#> SRR390534 4 0.0579 0.760 0.008 0.000 0.000 0.984 0.008
#> SRR390535 4 0.0693 0.760 0.008 0.000 0.000 0.980 0.012
#> SRR390536 5 0.2464 0.885 0.000 0.012 0.004 0.092 0.892
#> SRR390537 5 0.2464 0.885 0.000 0.012 0.004 0.092 0.892
#> SRR390538 1 0.4391 0.742 0.744 0.000 0.016 0.216 0.024
#> SRR390539 1 0.4391 0.742 0.744 0.000 0.016 0.216 0.024
#> SRR390540 1 0.4391 0.742 0.744 0.000 0.016 0.216 0.024
#> SRR390541 1 0.4391 0.742 0.744 0.000 0.016 0.216 0.024
#> SRR390542 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390543 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390544 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390545 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.1327 0.794 0.936 0.000 0.000 0.000 0.000 0.064
#> SRR390471 1 0.1327 0.794 0.936 0.000 0.000 0.000 0.000 0.064
#> SRR390472 1 0.1327 0.794 0.936 0.000 0.000 0.000 0.000 0.064
#> SRR390473 1 0.1327 0.794 0.936 0.000 0.000 0.000 0.000 0.064
#> SRR390474 6 0.8347 0.325 0.220 0.000 0.116 0.228 0.084 0.352
#> SRR390475 1 0.1327 0.794 0.936 0.000 0.000 0.000 0.000 0.064
#> SRR390476 1 0.1327 0.794 0.936 0.000 0.000 0.000 0.000 0.064
#> SRR390477 1 0.2234 0.784 0.872 0.000 0.000 0.000 0.004 0.124
#> SRR390478 1 0.2234 0.784 0.872 0.000 0.000 0.000 0.004 0.124
#> SRR390480 4 0.0146 0.900 0.000 0.000 0.000 0.996 0.004 0.000
#> SRR390481 4 0.0146 0.900 0.000 0.000 0.000 0.996 0.004 0.000
#> SRR390482 4 0.0146 0.900 0.000 0.000 0.000 0.996 0.004 0.000
#> SRR390483 4 0.0146 0.900 0.000 0.000 0.000 0.996 0.004 0.000
#> SRR390484 5 0.2493 0.899 0.000 0.000 0.036 0.004 0.884 0.076
#> SRR390485 5 0.2493 0.899 0.000 0.000 0.036 0.004 0.884 0.076
#> SRR390486 3 0.0000 0.987 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390487 3 0.0000 0.987 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390488 3 0.0000 0.987 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390489 3 0.0000 0.987 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390492 5 0.0790 0.944 0.000 0.000 0.000 0.032 0.968 0.000
#> SRR390493 5 0.0790 0.944 0.000 0.000 0.000 0.032 0.968 0.000
#> SRR390494 5 0.0790 0.944 0.000 0.000 0.000 0.032 0.968 0.000
#> SRR390495 5 0.0790 0.944 0.000 0.000 0.000 0.032 0.968 0.000
#> SRR390496 5 0.0790 0.944 0.000 0.000 0.000 0.032 0.968 0.000
#> SRR390497 5 0.2493 0.899 0.000 0.000 0.036 0.004 0.884 0.076
#> SRR390498 2 0.2201 0.888 0.000 0.896 0.000 0.000 0.028 0.076
#> SRR390499 4 0.0146 0.900 0.000 0.000 0.000 0.996 0.004 0.000
#> SRR390500 4 0.0146 0.900 0.000 0.000 0.000 0.996 0.004 0.000
#> SRR390501 3 0.0000 0.987 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390502 3 0.0000 0.987 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390503 3 0.0000 0.987 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390504 3 0.2145 0.889 0.000 0.000 0.900 0.000 0.028 0.072
#> SRR390505 6 0.3815 0.512 0.132 0.000 0.004 0.044 0.020 0.800
#> SRR390506 6 0.3972 0.509 0.132 0.000 0.004 0.044 0.028 0.792
#> SRR390507 2 0.0000 0.991 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390508 2 0.0000 0.991 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390509 2 0.0000 0.991 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390510 2 0.0000 0.991 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390512 2 0.0000 0.991 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390513 2 0.0000 0.991 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390514 2 0.0000 0.991 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390515 1 0.1387 0.794 0.932 0.000 0.000 0.000 0.000 0.068
#> SRR390516 3 0.0000 0.987 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390517 2 0.0000 0.991 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390519 5 0.2493 0.899 0.000 0.000 0.036 0.004 0.884 0.076
#> SRR390520 6 0.7944 0.323 0.216 0.000 0.120 0.196 0.052 0.416
#> SRR390521 6 0.8347 0.325 0.220 0.000 0.116 0.228 0.084 0.352
#> SRR390522 6 0.8347 0.325 0.220 0.000 0.116 0.228 0.084 0.352
#> SRR390523 6 0.8347 0.325 0.220 0.000 0.116 0.228 0.084 0.352
#> SRR390524 1 0.2234 0.784 0.872 0.000 0.000 0.000 0.004 0.124
#> SRR390525 1 0.2234 0.784 0.872 0.000 0.000 0.000 0.004 0.124
#> SRR390526 1 0.5540 0.239 0.468 0.000 0.000 0.412 0.004 0.116
#> SRR390527 1 0.5540 0.239 0.468 0.000 0.000 0.412 0.004 0.116
#> SRR390528 4 0.0725 0.888 0.000 0.000 0.000 0.976 0.012 0.012
#> SRR390529 6 0.3941 0.508 0.208 0.000 0.004 0.044 0.000 0.744
#> SRR390530 1 0.2234 0.784 0.872 0.000 0.000 0.000 0.004 0.124
#> SRR390531 1 0.2234 0.784 0.872 0.000 0.000 0.000 0.004 0.124
#> SRR390532 4 0.0725 0.888 0.000 0.000 0.000 0.976 0.012 0.012
#> SRR390533 4 0.3919 0.669 0.016 0.000 0.000 0.708 0.008 0.268
#> SRR390534 4 0.3919 0.669 0.016 0.000 0.000 0.708 0.008 0.268
#> SRR390535 4 0.3559 0.711 0.012 0.000 0.000 0.744 0.004 0.240
#> SRR390536 5 0.0790 0.944 0.000 0.000 0.000 0.032 0.968 0.000
#> SRR390537 5 0.0790 0.944 0.000 0.000 0.000 0.032 0.968 0.000
#> SRR390538 6 0.4091 0.510 0.212 0.000 0.004 0.052 0.000 0.732
#> SRR390539 6 0.4091 0.510 0.212 0.000 0.004 0.052 0.000 0.732
#> SRR390540 6 0.4091 0.510 0.212 0.000 0.004 0.052 0.000 0.732
#> SRR390541 6 0.4091 0.510 0.212 0.000 0.004 0.052 0.000 0.732
#> SRR390542 2 0.0000 0.991 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390543 2 0.0000 0.991 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390544 2 0.0000 0.991 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390545 2 0.0000 0.991 0.000 1.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
SD:pam**
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"]
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 15244 rows and 71 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'SD' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 6.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)

The plots are:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.834 0.876 0.950 0.3591 0.697 0.697
#> 3 3 0.683 0.725 0.834 0.5318 0.710 0.584
#> 4 4 0.737 0.653 0.819 0.2707 0.793 0.529
#> 5 5 0.889 0.827 0.927 0.1342 0.898 0.640
#> 6 6 0.989 0.922 0.967 0.0521 0.930 0.677
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
suggest_best_k(res)
#> [1] 6
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.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.0000 0.934 1.000 0.000
#> SRR390471 1 0.0000 0.934 1.000 0.000
#> SRR390472 1 0.0000 0.934 1.000 0.000
#> SRR390473 1 0.0000 0.934 1.000 0.000
#> SRR390474 1 0.0000 0.934 1.000 0.000
#> SRR390475 1 0.0000 0.934 1.000 0.000
#> SRR390476 1 0.0000 0.934 1.000 0.000
#> SRR390477 1 0.0000 0.934 1.000 0.000
#> SRR390478 1 0.0000 0.934 1.000 0.000
#> SRR390480 1 0.0000 0.934 1.000 0.000
#> SRR390481 1 0.0000 0.934 1.000 0.000
#> SRR390482 1 0.0376 0.932 0.996 0.004
#> SRR390483 1 0.0000 0.934 1.000 0.000
#> SRR390484 1 0.4815 0.851 0.896 0.104
#> SRR390485 1 0.5737 0.817 0.864 0.136
#> SRR390486 1 0.0000 0.934 1.000 0.000
#> SRR390487 1 0.0000 0.934 1.000 0.000
#> SRR390488 1 0.0000 0.934 1.000 0.000
#> SRR390489 1 0.0000 0.934 1.000 0.000
#> SRR390492 1 0.9996 0.151 0.512 0.488
#> SRR390493 1 0.9954 0.237 0.540 0.460
#> SRR390494 1 0.9988 0.177 0.520 0.480
#> SRR390495 1 0.9996 0.151 0.512 0.488
#> SRR390496 1 0.9815 0.343 0.580 0.420
#> SRR390497 1 0.4690 0.855 0.900 0.100
#> SRR390498 2 0.0000 1.000 0.000 1.000
#> SRR390499 1 0.0000 0.934 1.000 0.000
#> SRR390500 1 0.0000 0.934 1.000 0.000
#> SRR390501 1 0.0000 0.934 1.000 0.000
#> SRR390502 1 0.0000 0.934 1.000 0.000
#> SRR390503 1 0.0000 0.934 1.000 0.000
#> SRR390504 1 0.3879 0.873 0.924 0.076
#> SRR390505 1 0.0000 0.934 1.000 0.000
#> SRR390506 1 0.0000 0.934 1.000 0.000
#> SRR390507 2 0.0000 1.000 0.000 1.000
#> SRR390508 2 0.0000 1.000 0.000 1.000
#> SRR390509 2 0.0000 1.000 0.000 1.000
#> SRR390510 2 0.0000 1.000 0.000 1.000
#> SRR390512 2 0.0000 1.000 0.000 1.000
#> SRR390513 2 0.0000 1.000 0.000 1.000
#> SRR390514 2 0.0000 1.000 0.000 1.000
#> SRR390515 1 0.0000 0.934 1.000 0.000
#> SRR390516 1 0.0000 0.934 1.000 0.000
#> SRR390517 2 0.0000 1.000 0.000 1.000
#> SRR390519 1 0.1843 0.916 0.972 0.028
#> SRR390520 1 0.0000 0.934 1.000 0.000
#> SRR390521 1 0.0000 0.934 1.000 0.000
#> SRR390522 1 0.0000 0.934 1.000 0.000
#> SRR390523 1 0.0000 0.934 1.000 0.000
#> SRR390524 1 0.0000 0.934 1.000 0.000
#> SRR390525 1 0.0000 0.934 1.000 0.000
#> SRR390526 1 0.0000 0.934 1.000 0.000
#> SRR390527 1 0.0000 0.934 1.000 0.000
#> SRR390528 1 0.1414 0.920 0.980 0.020
#> SRR390529 1 0.0000 0.934 1.000 0.000
#> SRR390530 1 0.0000 0.934 1.000 0.000
#> SRR390531 1 0.0000 0.934 1.000 0.000
#> SRR390532 1 0.0000 0.934 1.000 0.000
#> SRR390533 1 0.0000 0.934 1.000 0.000
#> SRR390534 1 0.0000 0.934 1.000 0.000
#> SRR390535 1 0.0000 0.934 1.000 0.000
#> SRR390536 1 0.9323 0.498 0.652 0.348
#> SRR390537 1 0.9833 0.333 0.576 0.424
#> SRR390538 1 0.0000 0.934 1.000 0.000
#> SRR390539 1 0.0000 0.934 1.000 0.000
#> SRR390540 1 0.0000 0.934 1.000 0.000
#> SRR390541 1 0.0000 0.934 1.000 0.000
#> SRR390542 2 0.0000 1.000 0.000 1.000
#> SRR390543 2 0.0000 1.000 0.000 1.000
#> SRR390544 2 0.0000 1.000 0.000 1.000
#> SRR390545 2 0.0000 1.000 0.000 1.000
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390471 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390472 3 0.236 0.6868 0.072 0.000 0.928
#> SRR390473 3 0.271 0.6627 0.088 0.000 0.912
#> SRR390474 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390475 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390476 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390477 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390478 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390480 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390481 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390482 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390483 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390484 3 0.631 0.3262 0.488 0.000 0.512
#> SRR390485 3 0.631 0.3262 0.488 0.000 0.512
#> SRR390486 3 0.000 0.7579 0.000 0.000 1.000
#> SRR390487 3 0.000 0.7579 0.000 0.000 1.000
#> SRR390488 3 0.000 0.7579 0.000 0.000 1.000
#> SRR390489 3 0.000 0.7579 0.000 0.000 1.000
#> SRR390492 1 0.000 0.3335 1.000 0.000 0.000
#> SRR390493 1 0.000 0.3335 1.000 0.000 0.000
#> SRR390494 1 0.000 0.3335 1.000 0.000 0.000
#> SRR390495 1 0.000 0.3335 1.000 0.000 0.000
#> SRR390496 1 0.000 0.3335 1.000 0.000 0.000
#> SRR390497 3 0.631 0.3262 0.488 0.000 0.512
#> SRR390498 2 0.000 1.0000 0.000 1.000 0.000
#> SRR390499 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390500 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390501 3 0.000 0.7579 0.000 0.000 1.000
#> SRR390502 3 0.000 0.7579 0.000 0.000 1.000
#> SRR390503 3 0.000 0.7579 0.000 0.000 1.000
#> SRR390504 3 0.000 0.7579 0.000 0.000 1.000
#> SRR390505 3 0.568 -0.1336 0.316 0.000 0.684
#> SRR390506 3 0.153 0.7241 0.040 0.000 0.960
#> SRR390507 2 0.000 1.0000 0.000 1.000 0.000
#> SRR390508 2 0.000 1.0000 0.000 1.000 0.000
#> SRR390509 2 0.000 1.0000 0.000 1.000 0.000
#> SRR390510 2 0.000 1.0000 0.000 1.000 0.000
#> SRR390512 2 0.000 1.0000 0.000 1.000 0.000
#> SRR390513 2 0.000 1.0000 0.000 1.000 0.000
#> SRR390514 2 0.000 1.0000 0.000 1.000 0.000
#> SRR390515 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390516 3 0.000 0.7579 0.000 0.000 1.000
#> SRR390517 2 0.000 1.0000 0.000 1.000 0.000
#> SRR390519 1 0.486 0.0588 0.800 0.192 0.008
#> SRR390520 3 0.510 0.2090 0.248 0.000 0.752
#> SRR390521 1 0.595 0.7023 0.640 0.000 0.360
#> SRR390522 1 0.597 0.7071 0.636 0.000 0.364
#> SRR390523 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390524 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390525 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390526 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390527 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390528 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390529 3 0.400 0.5084 0.160 0.000 0.840
#> SRR390530 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390531 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390532 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390533 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390534 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390535 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390536 1 0.000 0.3335 1.000 0.000 0.000
#> SRR390537 1 0.000 0.3335 1.000 0.000 0.000
#> SRR390538 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390539 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390540 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390541 1 0.627 0.8068 0.548 0.000 0.452
#> SRR390542 2 0.000 1.0000 0.000 1.000 0.000
#> SRR390543 2 0.000 1.0000 0.000 1.000 0.000
#> SRR390544 2 0.000 1.0000 0.000 1.000 0.000
#> SRR390545 2 0.000 1.0000 0.000 1.000 0.000
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.4855 0.9889 0.600 0.000 0.000 0.400
#> SRR390471 1 0.4855 0.9889 0.600 0.000 0.000 0.400
#> SRR390472 1 0.4855 0.9889 0.600 0.000 0.000 0.400
#> SRR390473 1 0.4855 0.9889 0.600 0.000 0.000 0.400
#> SRR390474 4 0.3444 0.2730 0.184 0.000 0.000 0.816
#> SRR390475 1 0.4855 0.9889 0.600 0.000 0.000 0.400
#> SRR390476 1 0.4855 0.9889 0.600 0.000 0.000 0.400
#> SRR390477 1 0.4855 0.9889 0.600 0.000 0.000 0.400
#> SRR390478 1 0.4855 0.9889 0.600 0.000 0.000 0.400
#> SRR390480 4 0.0000 0.5882 0.000 0.000 0.000 1.000
#> SRR390481 4 0.0000 0.5882 0.000 0.000 0.000 1.000
#> SRR390482 4 0.0000 0.5882 0.000 0.000 0.000 1.000
#> SRR390483 4 0.0000 0.5882 0.000 0.000 0.000 1.000
#> SRR390484 3 0.4431 0.1976 0.000 0.000 0.696 0.304
#> SRR390485 3 0.4868 0.1840 0.012 0.000 0.684 0.304
#> SRR390486 3 0.4855 0.7744 0.000 0.400 0.600 0.000
#> SRR390487 3 0.4855 0.7744 0.000 0.400 0.600 0.000
#> SRR390488 3 0.4855 0.7744 0.000 0.400 0.600 0.000
#> SRR390489 3 0.4855 0.7744 0.000 0.400 0.600 0.000
#> SRR390492 4 0.4855 0.3797 0.000 0.000 0.400 0.600
#> SRR390493 4 0.4855 0.3797 0.000 0.000 0.400 0.600
#> SRR390494 4 0.4855 0.3797 0.000 0.000 0.400 0.600
#> SRR390495 4 0.4855 0.3797 0.000 0.000 0.400 0.600
#> SRR390496 4 0.4855 0.3797 0.000 0.000 0.400 0.600
#> SRR390497 3 0.4431 0.1976 0.000 0.000 0.696 0.304
#> SRR390498 2 0.4855 1.0000 0.400 0.600 0.000 0.000
#> SRR390499 4 0.0000 0.5882 0.000 0.000 0.000 1.000
#> SRR390500 4 0.0000 0.5882 0.000 0.000 0.000 1.000
#> SRR390501 3 0.4855 0.7744 0.000 0.400 0.600 0.000
#> SRR390502 3 0.4855 0.7744 0.000 0.400 0.600 0.000
#> SRR390503 3 0.4855 0.7744 0.000 0.400 0.600 0.000
#> SRR390504 3 0.4855 0.7744 0.000 0.400 0.600 0.000
#> SRR390505 1 0.4855 0.9889 0.600 0.000 0.000 0.400
#> SRR390506 3 0.5837 0.0283 0.036 0.000 0.564 0.400
#> SRR390507 2 0.4855 1.0000 0.400 0.600 0.000 0.000
#> SRR390508 2 0.4855 1.0000 0.400 0.600 0.000 0.000
#> SRR390509 2 0.4855 1.0000 0.400 0.600 0.000 0.000
#> SRR390510 2 0.4855 1.0000 0.400 0.600 0.000 0.000
#> SRR390512 2 0.4855 1.0000 0.400 0.600 0.000 0.000
#> SRR390513 2 0.4855 1.0000 0.400 0.600 0.000 0.000
#> SRR390514 2 0.4855 1.0000 0.400 0.600 0.000 0.000
#> SRR390515 1 0.4855 0.9889 0.600 0.000 0.000 0.400
#> SRR390516 3 0.4855 0.7744 0.000 0.400 0.600 0.000
#> SRR390517 2 0.4855 1.0000 0.400 0.600 0.000 0.000
#> SRR390519 4 0.5387 0.3632 0.000 0.016 0.400 0.584
#> SRR390520 4 0.5972 -0.3166 0.304 0.000 0.064 0.632
#> SRR390521 4 0.3123 0.3446 0.156 0.000 0.000 0.844
#> SRR390522 4 0.2469 0.4418 0.108 0.000 0.000 0.892
#> SRR390523 4 0.0000 0.5882 0.000 0.000 0.000 1.000
#> SRR390524 1 0.4855 0.9889 0.600 0.000 0.000 0.400
#> SRR390525 1 0.4855 0.9889 0.600 0.000 0.000 0.400
#> SRR390526 4 0.4522 -0.2350 0.320 0.000 0.000 0.680
#> SRR390527 4 0.4500 -0.2204 0.316 0.000 0.000 0.684
#> SRR390528 4 0.0000 0.5882 0.000 0.000 0.000 1.000
#> SRR390529 1 0.4855 0.9889 0.600 0.000 0.000 0.400
#> SRR390530 1 0.4855 0.9889 0.600 0.000 0.000 0.400
#> SRR390531 1 0.4855 0.9889 0.600 0.000 0.000 0.400
#> SRR390532 4 0.0000 0.5882 0.000 0.000 0.000 1.000
#> SRR390533 4 0.4483 -0.1019 0.284 0.000 0.004 0.712
#> SRR390534 4 0.4483 -0.1019 0.284 0.000 0.004 0.712
#> SRR390535 4 0.0707 0.5673 0.020 0.000 0.000 0.980
#> SRR390536 4 0.4855 0.3797 0.000 0.000 0.400 0.600
#> SRR390537 4 0.4855 0.3797 0.000 0.000 0.400 0.600
#> SRR390538 1 0.4916 0.9548 0.576 0.000 0.000 0.424
#> SRR390539 1 0.4985 0.8669 0.532 0.000 0.000 0.468
#> SRR390540 4 0.4999 -0.7919 0.492 0.000 0.000 0.508
#> SRR390541 1 0.4888 0.9727 0.588 0.000 0.000 0.412
#> SRR390542 2 0.4855 1.0000 0.400 0.600 0.000 0.000
#> SRR390543 2 0.4855 1.0000 0.400 0.600 0.000 0.000
#> SRR390544 2 0.4855 1.0000 0.400 0.600 0.000 0.000
#> SRR390545 2 0.4855 1.0000 0.400 0.600 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.0404 0.8314 0.988 0 0.000 0.012 0.000
#> SRR390471 1 0.0404 0.8314 0.988 0 0.000 0.012 0.000
#> SRR390472 1 0.0404 0.8314 0.988 0 0.000 0.012 0.000
#> SRR390473 1 0.0404 0.8314 0.988 0 0.000 0.012 0.000
#> SRR390474 4 0.4123 0.7066 0.104 0 0.000 0.788 0.108
#> SRR390475 1 0.0404 0.8314 0.988 0 0.000 0.012 0.000
#> SRR390476 1 0.0404 0.8314 0.988 0 0.000 0.012 0.000
#> SRR390477 1 0.0404 0.8314 0.988 0 0.000 0.012 0.000
#> SRR390478 1 0.0404 0.8314 0.988 0 0.000 0.012 0.000
#> SRR390480 4 0.0000 0.8783 0.000 0 0.000 1.000 0.000
#> SRR390481 4 0.0000 0.8783 0.000 0 0.000 1.000 0.000
#> SRR390482 4 0.0000 0.8783 0.000 0 0.000 1.000 0.000
#> SRR390483 4 0.0000 0.8783 0.000 0 0.000 1.000 0.000
#> SRR390484 5 0.0000 0.9605 0.000 0 0.000 0.000 1.000
#> SRR390485 5 0.0000 0.9605 0.000 0 0.000 0.000 1.000
#> SRR390486 3 0.0000 0.9671 0.000 0 1.000 0.000 0.000
#> SRR390487 3 0.0000 0.9671 0.000 0 1.000 0.000 0.000
#> SRR390488 3 0.0000 0.9671 0.000 0 1.000 0.000 0.000
#> SRR390489 3 0.0000 0.9671 0.000 0 1.000 0.000 0.000
#> SRR390492 5 0.0000 0.9605 0.000 0 0.000 0.000 1.000
#> SRR390493 5 0.0000 0.9605 0.000 0 0.000 0.000 1.000
#> SRR390494 5 0.0000 0.9605 0.000 0 0.000 0.000 1.000
#> SRR390495 5 0.0000 0.9605 0.000 0 0.000 0.000 1.000
#> SRR390496 5 0.0000 0.9605 0.000 0 0.000 0.000 1.000
#> SRR390497 5 0.0000 0.9605 0.000 0 0.000 0.000 1.000
#> SRR390498 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000
#> SRR390499 4 0.0000 0.8783 0.000 0 0.000 1.000 0.000
#> SRR390500 4 0.0000 0.8783 0.000 0 0.000 1.000 0.000
#> SRR390501 3 0.0000 0.9671 0.000 0 1.000 0.000 0.000
#> SRR390502 3 0.0000 0.9671 0.000 0 1.000 0.000 0.000
#> SRR390503 3 0.0000 0.9671 0.000 0 1.000 0.000 0.000
#> SRR390504 3 0.0000 0.9671 0.000 0 1.000 0.000 0.000
#> SRR390505 1 0.4126 0.4297 0.620 0 0.000 0.380 0.000
#> SRR390506 3 0.4333 0.6297 0.048 0 0.740 0.212 0.000
#> SRR390507 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000
#> SRR390508 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000
#> SRR390509 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000
#> SRR390510 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000
#> SRR390512 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000
#> SRR390513 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000
#> SRR390514 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000
#> SRR390515 1 0.0404 0.8314 0.988 0 0.000 0.012 0.000
#> SRR390516 3 0.0000 0.9671 0.000 0 1.000 0.000 0.000
#> SRR390517 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000
#> SRR390519 5 0.0000 0.9605 0.000 0 0.000 0.000 1.000
#> SRR390520 4 0.6715 -0.0918 0.412 0 0.076 0.456 0.056
#> SRR390521 4 0.6491 0.2666 0.264 0 0.000 0.492 0.244
#> SRR390522 4 0.6353 0.3154 0.172 0 0.000 0.480 0.348
#> SRR390523 5 0.4356 0.3534 0.012 0 0.000 0.340 0.648
#> SRR390524 1 0.0404 0.8314 0.988 0 0.000 0.012 0.000
#> SRR390525 1 0.0404 0.8314 0.988 0 0.000 0.012 0.000
#> SRR390526 4 0.0609 0.8639 0.020 0 0.000 0.980 0.000
#> SRR390527 4 0.0609 0.8639 0.020 0 0.000 0.980 0.000
#> SRR390528 4 0.0000 0.8783 0.000 0 0.000 1.000 0.000
#> SRR390529 1 0.3895 0.5239 0.680 0 0.000 0.320 0.000
#> SRR390530 1 0.0404 0.8314 0.988 0 0.000 0.012 0.000
#> SRR390531 1 0.0404 0.8314 0.988 0 0.000 0.012 0.000
#> SRR390532 4 0.0000 0.8783 0.000 0 0.000 1.000 0.000
#> SRR390533 4 0.0000 0.8783 0.000 0 0.000 1.000 0.000
#> SRR390534 4 0.0000 0.8783 0.000 0 0.000 1.000 0.000
#> SRR390535 4 0.0000 0.8783 0.000 0 0.000 1.000 0.000
#> SRR390536 5 0.0000 0.9605 0.000 0 0.000 0.000 1.000
#> SRR390537 5 0.0000 0.9605 0.000 0 0.000 0.000 1.000
#> SRR390538 1 0.4192 0.3855 0.596 0 0.000 0.404 0.000
#> SRR390539 1 0.4287 0.2355 0.540 0 0.000 0.460 0.000
#> SRR390540 1 0.4306 0.1392 0.508 0 0.000 0.492 0.000
#> SRR390541 1 0.4192 0.3833 0.596 0 0.000 0.404 0.000
#> SRR390542 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000
#> SRR390543 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000
#> SRR390544 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000
#> SRR390545 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.000 0.956 1.000 0 0.00 0.000 0.000 0
#> SRR390471 1 0.000 0.956 1.000 0 0.00 0.000 0.000 0
#> SRR390472 1 0.000 0.956 1.000 0 0.00 0.000 0.000 0
#> SRR390473 1 0.000 0.956 1.000 0 0.00 0.000 0.000 0
#> SRR390474 4 0.493 0.493 0.136 0 0.00 0.648 0.216 0
#> SRR390475 1 0.000 0.956 1.000 0 0.00 0.000 0.000 0
#> SRR390476 1 0.000 0.956 1.000 0 0.00 0.000 0.000 0
#> SRR390477 1 0.000 0.956 1.000 0 0.00 0.000 0.000 0
#> SRR390478 1 0.000 0.956 1.000 0 0.00 0.000 0.000 0
#> SRR390480 4 0.000 0.972 0.000 0 0.00 1.000 0.000 0
#> SRR390481 4 0.000 0.972 0.000 0 0.00 1.000 0.000 0
#> SRR390482 4 0.000 0.972 0.000 0 0.00 1.000 0.000 0
#> SRR390483 4 0.000 0.972 0.000 0 0.00 1.000 0.000 0
#> SRR390484 5 0.000 0.883 0.000 0 0.00 0.000 1.000 0
#> SRR390485 5 0.000 0.883 0.000 0 0.00 0.000 1.000 0
#> SRR390486 3 0.000 1.000 0.000 0 1.00 0.000 0.000 0
#> SRR390487 3 0.000 1.000 0.000 0 1.00 0.000 0.000 0
#> SRR390488 3 0.000 1.000 0.000 0 1.00 0.000 0.000 0
#> SRR390489 3 0.000 1.000 0.000 0 1.00 0.000 0.000 0
#> SRR390492 5 0.000 0.883 0.000 0 0.00 0.000 1.000 0
#> SRR390493 5 0.000 0.883 0.000 0 0.00 0.000 1.000 0
#> SRR390494 5 0.000 0.883 0.000 0 0.00 0.000 1.000 0
#> SRR390495 5 0.000 0.883 0.000 0 0.00 0.000 1.000 0
#> SRR390496 5 0.000 0.883 0.000 0 0.00 0.000 1.000 0
#> SRR390497 5 0.000 0.883 0.000 0 0.00 0.000 1.000 0
#> SRR390498 2 0.000 1.000 0.000 1 0.00 0.000 0.000 0
#> SRR390499 4 0.000 0.972 0.000 0 0.00 1.000 0.000 0
#> SRR390500 4 0.000 0.972 0.000 0 0.00 1.000 0.000 0
#> SRR390501 3 0.000 1.000 0.000 0 1.00 0.000 0.000 0
#> SRR390502 3 0.000 1.000 0.000 0 1.00 0.000 0.000 0
#> SRR390503 3 0.000 1.000 0.000 0 1.00 0.000 0.000 0
#> SRR390504 3 0.000 1.000 0.000 0 1.00 0.000 0.000 0
#> SRR390505 6 0.000 1.000 0.000 0 0.00 0.000 0.000 1
#> SRR390506 6 0.000 1.000 0.000 0 0.00 0.000 0.000 1
#> SRR390507 2 0.000 1.000 0.000 1 0.00 0.000 0.000 0
#> SRR390508 2 0.000 1.000 0.000 1 0.00 0.000 0.000 0
#> SRR390509 2 0.000 1.000 0.000 1 0.00 0.000 0.000 0
#> SRR390510 2 0.000 1.000 0.000 1 0.00 0.000 0.000 0
#> SRR390512 2 0.000 1.000 0.000 1 0.00 0.000 0.000 0
#> SRR390513 2 0.000 1.000 0.000 1 0.00 0.000 0.000 0
#> SRR390514 2 0.000 1.000 0.000 1 0.00 0.000 0.000 0
#> SRR390515 1 0.000 0.956 1.000 0 0.00 0.000 0.000 0
#> SRR390516 3 0.000 1.000 0.000 0 1.00 0.000 0.000 0
#> SRR390517 2 0.000 1.000 0.000 1 0.00 0.000 0.000 0
#> SRR390519 5 0.000 0.883 0.000 0 0.00 0.000 1.000 0
#> SRR390520 1 0.661 0.108 0.444 0 0.12 0.356 0.080 0
#> SRR390521 5 0.609 0.188 0.292 0 0.00 0.316 0.392 0
#> SRR390522 5 0.579 0.325 0.204 0 0.00 0.308 0.488 0
#> SRR390523 5 0.378 0.581 0.020 0 0.00 0.272 0.708 0
#> SRR390524 1 0.000 0.956 1.000 0 0.00 0.000 0.000 0
#> SRR390525 1 0.000 0.956 1.000 0 0.00 0.000 0.000 0
#> SRR390526 4 0.000 0.972 0.000 0 0.00 1.000 0.000 0
#> SRR390527 4 0.000 0.972 0.000 0 0.00 1.000 0.000 0
#> SRR390528 4 0.000 0.972 0.000 0 0.00 1.000 0.000 0
#> SRR390529 6 0.000 1.000 0.000 0 0.00 0.000 0.000 1
#> SRR390530 1 0.000 0.956 1.000 0 0.00 0.000 0.000 0
#> SRR390531 1 0.000 0.956 1.000 0 0.00 0.000 0.000 0
#> SRR390532 4 0.000 0.972 0.000 0 0.00 1.000 0.000 0
#> SRR390533 4 0.000 0.972 0.000 0 0.00 1.000 0.000 0
#> SRR390534 4 0.000 0.972 0.000 0 0.00 1.000 0.000 0
#> SRR390535 4 0.000 0.972 0.000 0 0.00 1.000 0.000 0
#> SRR390536 5 0.000 0.883 0.000 0 0.00 0.000 1.000 0
#> SRR390537 5 0.000 0.883 0.000 0 0.00 0.000 1.000 0
#> SRR390538 6 0.000 1.000 0.000 0 0.00 0.000 0.000 1
#> SRR390539 6 0.000 1.000 0.000 0 0.00 0.000 0.000 1
#> SRR390540 6 0.000 1.000 0.000 0 0.00 0.000 0.000 1
#> SRR390541 6 0.000 1.000 0.000 0 0.00 0.000 0.000 1
#> SRR390542 2 0.000 1.000 0.000 1 0.00 0.000 0.000 0
#> SRR390543 2 0.000 1.000 0.000 1 0.00 0.000 0.000 0
#> SRR390544 2 0.000 1.000 0.000 1 0.00 0.000 0.000 0
#> SRR390545 2 0.000 1.000 0.000 1 0.00 0.000 0.000 0
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
SD:mclust
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"]
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 15244 rows and 71 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 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:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.770 0.838 0.938 0.341 0.697 0.697
#> 3 3 0.628 0.800 0.870 0.719 0.687 0.551
#> 4 4 0.619 0.725 0.813 0.207 0.756 0.449
#> 5 5 0.675 0.781 0.851 0.101 0.929 0.735
#> 6 6 0.810 0.726 0.855 0.044 0.956 0.799
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
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.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.0000 0.928 1.000 0.000
#> SRR390471 1 0.0000 0.928 1.000 0.000
#> SRR390472 1 0.0000 0.928 1.000 0.000
#> SRR390473 1 0.0000 0.928 1.000 0.000
#> SRR390474 1 0.0000 0.928 1.000 0.000
#> SRR390475 1 0.0000 0.928 1.000 0.000
#> SRR390476 1 0.0000 0.928 1.000 0.000
#> SRR390477 1 0.0000 0.928 1.000 0.000
#> SRR390478 1 0.0000 0.928 1.000 0.000
#> SRR390480 1 0.0000 0.928 1.000 0.000
#> SRR390481 1 0.0000 0.928 1.000 0.000
#> SRR390482 1 0.0000 0.928 1.000 0.000
#> SRR390483 1 0.0000 0.928 1.000 0.000
#> SRR390484 1 0.0376 0.926 0.996 0.004
#> SRR390485 1 0.0376 0.926 0.996 0.004
#> SRR390486 1 0.9686 0.365 0.604 0.396
#> SRR390487 1 0.9552 0.409 0.624 0.376
#> SRR390488 1 0.9686 0.365 0.604 0.396
#> SRR390489 1 0.9686 0.365 0.604 0.396
#> SRR390492 1 0.0376 0.926 0.996 0.004
#> SRR390493 1 0.0376 0.926 0.996 0.004
#> SRR390494 1 0.0376 0.926 0.996 0.004
#> SRR390495 1 0.0376 0.926 0.996 0.004
#> SRR390496 1 0.0376 0.926 0.996 0.004
#> SRR390497 1 0.0376 0.926 0.996 0.004
#> SRR390498 2 0.9686 0.289 0.396 0.604
#> SRR390499 1 0.0000 0.928 1.000 0.000
#> SRR390500 1 0.0000 0.928 1.000 0.000
#> SRR390501 1 0.9686 0.365 0.604 0.396
#> SRR390502 1 0.9686 0.365 0.604 0.396
#> SRR390503 1 0.9686 0.365 0.604 0.396
#> SRR390504 1 0.9661 0.374 0.608 0.392
#> SRR390505 1 0.0000 0.928 1.000 0.000
#> SRR390506 1 0.0000 0.928 1.000 0.000
#> SRR390507 2 0.0000 0.924 0.000 1.000
#> SRR390508 2 0.0000 0.924 0.000 1.000
#> SRR390509 2 0.0000 0.924 0.000 1.000
#> SRR390510 2 0.0000 0.924 0.000 1.000
#> SRR390512 2 0.0000 0.924 0.000 1.000
#> SRR390513 2 0.0000 0.924 0.000 1.000
#> SRR390514 2 0.0000 0.924 0.000 1.000
#> SRR390515 1 0.0000 0.928 1.000 0.000
#> SRR390516 1 0.9686 0.365 0.604 0.396
#> SRR390517 2 0.9686 0.289 0.396 0.604
#> SRR390519 1 0.0376 0.926 0.996 0.004
#> SRR390520 1 0.0000 0.928 1.000 0.000
#> SRR390521 1 0.0000 0.928 1.000 0.000
#> SRR390522 1 0.0000 0.928 1.000 0.000
#> SRR390523 1 0.0000 0.928 1.000 0.000
#> SRR390524 1 0.0000 0.928 1.000 0.000
#> SRR390525 1 0.0000 0.928 1.000 0.000
#> SRR390526 1 0.0000 0.928 1.000 0.000
#> SRR390527 1 0.0000 0.928 1.000 0.000
#> SRR390528 1 0.0000 0.928 1.000 0.000
#> SRR390529 1 0.0000 0.928 1.000 0.000
#> SRR390530 1 0.0000 0.928 1.000 0.000
#> SRR390531 1 0.0000 0.928 1.000 0.000
#> SRR390532 1 0.0000 0.928 1.000 0.000
#> SRR390533 1 0.0000 0.928 1.000 0.000
#> SRR390534 1 0.0000 0.928 1.000 0.000
#> SRR390535 1 0.0000 0.928 1.000 0.000
#> SRR390536 1 0.0376 0.926 0.996 0.004
#> SRR390537 1 0.0376 0.926 0.996 0.004
#> SRR390538 1 0.0000 0.928 1.000 0.000
#> SRR390539 1 0.0000 0.928 1.000 0.000
#> SRR390540 1 0.0000 0.928 1.000 0.000
#> SRR390541 1 0.0000 0.928 1.000 0.000
#> SRR390542 2 0.0000 0.924 0.000 1.000
#> SRR390543 2 0.0000 0.924 0.000 1.000
#> SRR390544 2 0.0000 0.924 0.000 1.000
#> SRR390545 2 0.0000 0.924 0.000 1.000
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.000 0.742 1.000 0.000 0.000
#> SRR390471 1 0.000 0.742 1.000 0.000 0.000
#> SRR390472 1 0.518 0.789 0.744 0.000 0.256
#> SRR390473 1 0.518 0.789 0.744 0.000 0.256
#> SRR390474 1 0.556 0.778 0.700 0.000 0.300
#> SRR390475 1 0.000 0.742 1.000 0.000 0.000
#> SRR390476 1 0.000 0.742 1.000 0.000 0.000
#> SRR390477 1 0.000 0.742 1.000 0.000 0.000
#> SRR390478 1 0.000 0.742 1.000 0.000 0.000
#> SRR390480 1 0.593 0.745 0.644 0.000 0.356
#> SRR390481 1 0.593 0.745 0.644 0.000 0.356
#> SRR390482 1 0.595 0.741 0.640 0.000 0.360
#> SRR390483 1 0.595 0.741 0.640 0.000 0.360
#> SRR390484 3 0.000 0.903 0.000 0.000 1.000
#> SRR390485 3 0.000 0.903 0.000 0.000 1.000
#> SRR390486 3 0.186 0.913 0.052 0.000 0.948
#> SRR390487 3 0.186 0.913 0.052 0.000 0.948
#> SRR390488 3 0.186 0.913 0.052 0.000 0.948
#> SRR390489 3 0.186 0.913 0.052 0.000 0.948
#> SRR390492 3 0.141 0.902 0.036 0.000 0.964
#> SRR390493 3 0.141 0.902 0.036 0.000 0.964
#> SRR390494 3 0.129 0.902 0.032 0.000 0.968
#> SRR390495 3 0.263 0.869 0.084 0.000 0.916
#> SRR390496 3 0.271 0.864 0.088 0.000 0.912
#> SRR390497 3 0.000 0.903 0.000 0.000 1.000
#> SRR390498 2 0.553 0.484 0.000 0.704 0.296
#> SRR390499 1 0.593 0.745 0.644 0.000 0.356
#> SRR390500 1 0.593 0.745 0.644 0.000 0.356
#> SRR390501 3 0.186 0.913 0.052 0.000 0.948
#> SRR390502 3 0.186 0.913 0.052 0.000 0.948
#> SRR390503 3 0.186 0.913 0.052 0.000 0.948
#> SRR390504 3 0.186 0.913 0.052 0.000 0.948
#> SRR390505 1 0.550 0.774 0.708 0.000 0.292
#> SRR390506 1 0.586 0.737 0.656 0.000 0.344
#> SRR390507 2 0.000 0.936 0.000 1.000 0.000
#> SRR390508 2 0.000 0.936 0.000 1.000 0.000
#> SRR390509 2 0.000 0.936 0.000 1.000 0.000
#> SRR390510 2 0.000 0.936 0.000 1.000 0.000
#> SRR390512 2 0.000 0.936 0.000 1.000 0.000
#> SRR390513 2 0.000 0.936 0.000 1.000 0.000
#> SRR390514 2 0.000 0.936 0.000 1.000 0.000
#> SRR390515 1 0.529 0.788 0.732 0.000 0.268
#> SRR390516 3 0.186 0.913 0.052 0.000 0.948
#> SRR390517 2 0.553 0.484 0.000 0.704 0.296
#> SRR390519 3 0.000 0.903 0.000 0.000 1.000
#> SRR390520 1 0.595 0.726 0.640 0.000 0.360
#> SRR390521 1 0.553 0.781 0.704 0.000 0.296
#> SRR390522 1 0.553 0.781 0.704 0.000 0.296
#> SRR390523 1 0.553 0.781 0.704 0.000 0.296
#> SRR390524 1 0.000 0.742 1.000 0.000 0.000
#> SRR390525 1 0.000 0.742 1.000 0.000 0.000
#> SRR390526 1 0.529 0.790 0.732 0.000 0.268
#> SRR390527 1 0.529 0.790 0.732 0.000 0.268
#> SRR390528 1 0.603 0.716 0.624 0.000 0.376
#> SRR390529 1 0.533 0.787 0.728 0.000 0.272
#> SRR390530 1 0.116 0.747 0.972 0.000 0.028
#> SRR390531 1 0.116 0.747 0.972 0.000 0.028
#> SRR390532 3 0.630 -0.429 0.476 0.000 0.524
#> SRR390533 1 0.568 0.770 0.684 0.000 0.316
#> SRR390534 1 0.568 0.770 0.684 0.000 0.316
#> SRR390535 1 0.553 0.781 0.704 0.000 0.296
#> SRR390536 3 0.263 0.869 0.084 0.000 0.916
#> SRR390537 3 0.263 0.869 0.084 0.000 0.916
#> SRR390538 1 0.000 0.742 1.000 0.000 0.000
#> SRR390539 1 0.000 0.742 1.000 0.000 0.000
#> SRR390540 1 0.000 0.742 1.000 0.000 0.000
#> SRR390541 1 0.000 0.742 1.000 0.000 0.000
#> SRR390542 2 0.000 0.936 0.000 1.000 0.000
#> SRR390543 2 0.000 0.936 0.000 1.000 0.000
#> SRR390544 2 0.000 0.936 0.000 1.000 0.000
#> SRR390545 2 0.000 0.936 0.000 1.000 0.000
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.4406 0.7969 0.700 0.000 0.000 0.300
#> SRR390471 1 0.4406 0.7969 0.700 0.000 0.000 0.300
#> SRR390472 1 0.7706 0.4951 0.452 0.000 0.280 0.268
#> SRR390473 1 0.7706 0.4951 0.452 0.000 0.280 0.268
#> SRR390474 4 0.0707 0.7913 0.000 0.000 0.020 0.980
#> SRR390475 1 0.4406 0.7969 0.700 0.000 0.000 0.300
#> SRR390476 1 0.4406 0.7969 0.700 0.000 0.000 0.300
#> SRR390477 1 0.4454 0.7936 0.692 0.000 0.000 0.308
#> SRR390478 1 0.4406 0.7969 0.700 0.000 0.000 0.300
#> SRR390480 4 0.0000 0.7921 0.000 0.000 0.000 1.000
#> SRR390481 4 0.0000 0.7921 0.000 0.000 0.000 1.000
#> SRR390482 4 0.1716 0.7802 0.000 0.000 0.064 0.936
#> SRR390483 4 0.1792 0.7790 0.000 0.000 0.068 0.932
#> SRR390484 3 0.1211 0.7408 0.000 0.000 0.960 0.040
#> SRR390485 3 0.1211 0.7408 0.000 0.000 0.960 0.040
#> SRR390486 3 0.5598 0.8137 0.220 0.000 0.704 0.076
#> SRR390487 3 0.5598 0.8137 0.220 0.000 0.704 0.076
#> SRR390488 3 0.5566 0.8143 0.224 0.000 0.704 0.072
#> SRR390489 3 0.5566 0.8143 0.224 0.000 0.704 0.072
#> SRR390492 4 0.4585 0.5870 0.000 0.000 0.332 0.668
#> SRR390493 4 0.4585 0.5870 0.000 0.000 0.332 0.668
#> SRR390494 3 0.4972 -0.1883 0.000 0.000 0.544 0.456
#> SRR390495 4 0.4543 0.5971 0.000 0.000 0.324 0.676
#> SRR390496 4 0.4564 0.5926 0.000 0.000 0.328 0.672
#> SRR390497 3 0.1211 0.7408 0.000 0.000 0.960 0.040
#> SRR390498 3 0.6840 0.0972 0.100 0.432 0.468 0.000
#> SRR390499 4 0.0000 0.7921 0.000 0.000 0.000 1.000
#> SRR390500 4 0.0000 0.7921 0.000 0.000 0.000 1.000
#> SRR390501 3 0.5566 0.8143 0.224 0.000 0.704 0.072
#> SRR390502 3 0.5566 0.8143 0.224 0.000 0.704 0.072
#> SRR390503 3 0.5566 0.8143 0.224 0.000 0.704 0.072
#> SRR390504 3 0.5598 0.8137 0.220 0.000 0.704 0.076
#> SRR390505 1 0.7845 0.4392 0.404 0.000 0.304 0.292
#> SRR390506 1 0.7746 0.3380 0.392 0.000 0.376 0.232
#> SRR390507 2 0.0000 1.0000 0.000 1.000 0.000 0.000
#> SRR390508 2 0.0000 1.0000 0.000 1.000 0.000 0.000
#> SRR390509 2 0.0000 1.0000 0.000 1.000 0.000 0.000
#> SRR390510 2 0.0000 1.0000 0.000 1.000 0.000 0.000
#> SRR390512 2 0.0000 1.0000 0.000 1.000 0.000 0.000
#> SRR390513 2 0.0000 1.0000 0.000 1.000 0.000 0.000
#> SRR390514 2 0.0000 1.0000 0.000 1.000 0.000 0.000
#> SRR390515 1 0.7862 0.4681 0.388 0.000 0.280 0.332
#> SRR390516 3 0.5566 0.8143 0.224 0.000 0.704 0.072
#> SRR390517 3 0.6840 0.0972 0.100 0.432 0.468 0.000
#> SRR390519 3 0.1302 0.7404 0.000 0.000 0.956 0.044
#> SRR390520 4 0.4713 0.3674 0.000 0.000 0.360 0.640
#> SRR390521 4 0.0000 0.7921 0.000 0.000 0.000 1.000
#> SRR390522 4 0.0000 0.7921 0.000 0.000 0.000 1.000
#> SRR390523 4 0.0000 0.7921 0.000 0.000 0.000 1.000
#> SRR390524 1 0.4406 0.7969 0.700 0.000 0.000 0.300
#> SRR390525 1 0.4406 0.7969 0.700 0.000 0.000 0.300
#> SRR390526 4 0.0707 0.7732 0.020 0.000 0.000 0.980
#> SRR390527 4 0.0707 0.7732 0.020 0.000 0.000 0.980
#> SRR390528 4 0.1940 0.7749 0.000 0.000 0.076 0.924
#> SRR390529 1 0.7883 0.4276 0.384 0.000 0.300 0.316
#> SRR390530 1 0.4972 0.6361 0.544 0.000 0.000 0.456
#> SRR390531 1 0.4972 0.6361 0.544 0.000 0.000 0.456
#> SRR390532 4 0.4898 0.2301 0.000 0.000 0.416 0.584
#> SRR390533 4 0.0188 0.7909 0.000 0.000 0.004 0.996
#> SRR390534 4 0.0188 0.7909 0.000 0.000 0.004 0.996
#> SRR390535 4 0.0000 0.7921 0.000 0.000 0.000 1.000
#> SRR390536 4 0.4585 0.5870 0.000 0.000 0.332 0.668
#> SRR390537 4 0.4564 0.5926 0.000 0.000 0.328 0.672
#> SRR390538 1 0.4477 0.7916 0.688 0.000 0.000 0.312
#> SRR390539 1 0.4431 0.7952 0.696 0.000 0.000 0.304
#> SRR390540 1 0.4431 0.7952 0.696 0.000 0.000 0.304
#> SRR390541 1 0.4477 0.7909 0.688 0.000 0.000 0.312
#> SRR390542 2 0.0000 1.0000 0.000 1.000 0.000 0.000
#> SRR390543 2 0.0000 1.0000 0.000 1.000 0.000 0.000
#> SRR390544 2 0.0000 1.0000 0.000 1.000 0.000 0.000
#> SRR390545 2 0.0000 1.0000 0.000 1.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.0162 0.850 0.996 0.0 0.000 0.004 0.000
#> SRR390471 1 0.0162 0.850 0.996 0.0 0.000 0.004 0.000
#> SRR390472 1 0.4926 0.734 0.712 0.0 0.176 0.112 0.000
#> SRR390473 1 0.5016 0.730 0.704 0.0 0.176 0.120 0.000
#> SRR390474 4 0.3857 0.818 0.044 0.0 0.016 0.820 0.120
#> SRR390475 1 0.0162 0.850 0.996 0.0 0.000 0.004 0.000
#> SRR390476 1 0.0162 0.850 0.996 0.0 0.000 0.004 0.000
#> SRR390477 1 0.0609 0.850 0.980 0.0 0.000 0.020 0.000
#> SRR390478 1 0.0510 0.850 0.984 0.0 0.000 0.016 0.000
#> SRR390480 4 0.0162 0.880 0.004 0.0 0.000 0.996 0.000
#> SRR390481 4 0.0162 0.880 0.004 0.0 0.000 0.996 0.000
#> SRR390482 4 0.3368 0.820 0.016 0.0 0.020 0.844 0.120
#> SRR390483 4 0.3685 0.796 0.016 0.0 0.020 0.816 0.148
#> SRR390484 3 0.4649 0.151 0.000 0.0 0.580 0.016 0.404
#> SRR390485 3 0.4576 0.201 0.000 0.0 0.608 0.016 0.376
#> SRR390486 3 0.6047 0.716 0.012 0.0 0.596 0.124 0.268
#> SRR390487 3 0.6047 0.716 0.012 0.0 0.596 0.124 0.268
#> SRR390488 3 0.6047 0.716 0.012 0.0 0.596 0.124 0.268
#> SRR390489 3 0.6047 0.716 0.012 0.0 0.596 0.124 0.268
#> SRR390492 5 0.0000 0.978 0.000 0.0 0.000 0.000 1.000
#> SRR390493 5 0.0000 0.978 0.000 0.0 0.000 0.000 1.000
#> SRR390494 5 0.1357 0.892 0.000 0.0 0.048 0.004 0.948
#> SRR390495 5 0.0162 0.980 0.000 0.0 0.000 0.004 0.996
#> SRR390496 5 0.0162 0.980 0.000 0.0 0.000 0.004 0.996
#> SRR390497 3 0.4649 0.151 0.000 0.0 0.580 0.016 0.404
#> SRR390498 2 0.4182 0.553 0.000 0.6 0.400 0.000 0.000
#> SRR390499 4 0.0162 0.880 0.004 0.0 0.000 0.996 0.000
#> SRR390500 4 0.0324 0.881 0.004 0.0 0.000 0.992 0.004
#> SRR390501 3 0.6047 0.716 0.012 0.0 0.596 0.124 0.268
#> SRR390502 3 0.6047 0.716 0.012 0.0 0.596 0.124 0.268
#> SRR390503 3 0.5963 0.712 0.012 0.0 0.612 0.124 0.252
#> SRR390504 3 0.4367 0.606 0.012 0.0 0.784 0.128 0.076
#> SRR390505 1 0.5956 0.641 0.592 0.0 0.212 0.196 0.000
#> SRR390506 1 0.6174 0.589 0.552 0.0 0.256 0.192 0.000
#> SRR390507 2 0.0000 0.937 0.000 1.0 0.000 0.000 0.000
#> SRR390508 2 0.0000 0.937 0.000 1.0 0.000 0.000 0.000
#> SRR390509 2 0.0000 0.937 0.000 1.0 0.000 0.000 0.000
#> SRR390510 2 0.0000 0.937 0.000 1.0 0.000 0.000 0.000
#> SRR390512 2 0.0000 0.937 0.000 1.0 0.000 0.000 0.000
#> SRR390513 2 0.0000 0.937 0.000 1.0 0.000 0.000 0.000
#> SRR390514 2 0.0000 0.937 0.000 1.0 0.000 0.000 0.000
#> SRR390515 1 0.6138 0.561 0.552 0.0 0.176 0.272 0.000
#> SRR390516 3 0.5943 0.712 0.008 0.0 0.604 0.128 0.260
#> SRR390517 2 0.4182 0.553 0.000 0.6 0.400 0.000 0.000
#> SRR390519 3 0.4821 0.089 0.000 0.0 0.516 0.020 0.464
#> SRR390520 4 0.4833 0.738 0.020 0.0 0.096 0.756 0.128
#> SRR390521 4 0.1041 0.876 0.032 0.0 0.004 0.964 0.000
#> SRR390522 4 0.1041 0.876 0.032 0.0 0.004 0.964 0.000
#> SRR390523 4 0.1041 0.876 0.032 0.0 0.004 0.964 0.000
#> SRR390524 1 0.0510 0.850 0.984 0.0 0.000 0.016 0.000
#> SRR390525 1 0.0510 0.850 0.984 0.0 0.000 0.016 0.000
#> SRR390526 4 0.3278 0.792 0.156 0.0 0.020 0.824 0.000
#> SRR390527 4 0.3278 0.792 0.156 0.0 0.020 0.824 0.000
#> SRR390528 4 0.4256 0.779 0.016 0.0 0.068 0.796 0.120
#> SRR390529 1 0.4558 0.717 0.724 0.0 0.216 0.060 0.000
#> SRR390530 1 0.3876 0.577 0.684 0.0 0.000 0.316 0.000
#> SRR390531 1 0.3876 0.577 0.684 0.0 0.000 0.316 0.000
#> SRR390532 4 0.5116 0.679 0.016 0.0 0.100 0.724 0.160
#> SRR390533 4 0.0404 0.880 0.012 0.0 0.000 0.988 0.000
#> SRR390534 4 0.0404 0.880 0.012 0.0 0.000 0.988 0.000
#> SRR390535 4 0.1408 0.874 0.044 0.0 0.008 0.948 0.000
#> SRR390536 5 0.0162 0.980 0.000 0.0 0.000 0.004 0.996
#> SRR390537 5 0.0162 0.980 0.000 0.0 0.000 0.004 0.996
#> SRR390538 1 0.0290 0.851 0.992 0.0 0.000 0.008 0.000
#> SRR390539 1 0.0290 0.851 0.992 0.0 0.000 0.008 0.000
#> SRR390540 1 0.0290 0.851 0.992 0.0 0.000 0.008 0.000
#> SRR390541 1 0.0404 0.851 0.988 0.0 0.000 0.012 0.000
#> SRR390542 2 0.0000 0.937 0.000 1.0 0.000 0.000 0.000
#> SRR390543 2 0.0000 0.937 0.000 1.0 0.000 0.000 0.000
#> SRR390544 2 0.0000 0.937 0.000 1.0 0.000 0.000 0.000
#> SRR390545 2 0.0000 0.937 0.000 1.0 0.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.0405 0.8163 0.988 0.000 0.008 0.000 0.000 0.004
#> SRR390471 1 0.0405 0.8163 0.988 0.000 0.008 0.000 0.000 0.004
#> SRR390472 1 0.5348 0.6361 0.680 0.000 0.064 0.100 0.000 0.156
#> SRR390473 1 0.5390 0.6335 0.676 0.000 0.064 0.104 0.000 0.156
#> SRR390474 4 0.3091 0.8254 0.004 0.000 0.044 0.856 0.084 0.012
#> SRR390475 1 0.0405 0.8163 0.988 0.000 0.008 0.000 0.000 0.004
#> SRR390476 1 0.0405 0.8163 0.988 0.000 0.008 0.000 0.000 0.004
#> SRR390477 1 0.0146 0.8173 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR390478 1 0.0291 0.8171 0.992 0.000 0.000 0.004 0.000 0.004
#> SRR390480 4 0.0458 0.8675 0.000 0.000 0.000 0.984 0.000 0.016
#> SRR390481 4 0.0458 0.8675 0.000 0.000 0.000 0.984 0.000 0.016
#> SRR390482 4 0.3717 0.7914 0.000 0.000 0.092 0.808 0.084 0.016
#> SRR390483 4 0.3765 0.7886 0.000 0.000 0.096 0.804 0.084 0.016
#> SRR390484 6 0.5976 0.2314 0.000 0.000 0.364 0.000 0.228 0.408
#> SRR390485 6 0.5973 0.2341 0.000 0.000 0.360 0.000 0.228 0.412
#> SRR390486 3 0.1267 0.7967 0.000 0.000 0.940 0.060 0.000 0.000
#> SRR390487 3 0.1267 0.7967 0.000 0.000 0.940 0.060 0.000 0.000
#> SRR390488 3 0.1204 0.7974 0.000 0.000 0.944 0.056 0.000 0.000
#> SRR390489 3 0.1204 0.7974 0.000 0.000 0.944 0.056 0.000 0.000
#> SRR390492 5 0.0000 0.9455 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390493 5 0.0000 0.9455 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390494 5 0.3171 0.6061 0.000 0.000 0.204 0.000 0.784 0.012
#> SRR390495 5 0.0000 0.9455 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390496 5 0.0000 0.9455 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390497 6 0.5978 0.2285 0.000 0.000 0.368 0.000 0.228 0.404
#> SRR390498 6 0.3593 0.3489 0.000 0.228 0.024 0.000 0.000 0.748
#> SRR390499 4 0.0458 0.8675 0.000 0.000 0.000 0.984 0.000 0.016
#> SRR390500 4 0.0603 0.8675 0.000 0.000 0.004 0.980 0.000 0.016
#> SRR390501 3 0.1204 0.7974 0.000 0.000 0.944 0.056 0.000 0.000
#> SRR390502 3 0.1204 0.7974 0.000 0.000 0.944 0.056 0.000 0.000
#> SRR390503 3 0.1984 0.7825 0.000 0.000 0.912 0.056 0.000 0.032
#> SRR390504 3 0.4191 0.5406 0.000 0.000 0.704 0.056 0.000 0.240
#> SRR390505 1 0.6841 0.2067 0.392 0.000 0.084 0.148 0.000 0.376
#> SRR390506 6 0.7047 -0.1919 0.304 0.000 0.108 0.164 0.000 0.424
#> SRR390507 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390508 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390509 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390510 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390512 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390513 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390514 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390515 1 0.6430 0.4763 0.528 0.000 0.064 0.248 0.000 0.160
#> SRR390516 3 0.2277 0.7725 0.000 0.000 0.892 0.076 0.000 0.032
#> SRR390517 6 0.3670 0.3371 0.000 0.240 0.024 0.000 0.000 0.736
#> SRR390519 3 0.6002 -0.2926 0.000 0.000 0.396 0.000 0.368 0.236
#> SRR390520 4 0.4952 0.5687 0.000 0.000 0.252 0.652 0.084 0.012
#> SRR390521 4 0.0622 0.8672 0.008 0.000 0.000 0.980 0.000 0.012
#> SRR390522 4 0.0622 0.8672 0.008 0.000 0.000 0.980 0.000 0.012
#> SRR390523 4 0.0622 0.8672 0.008 0.000 0.000 0.980 0.000 0.012
#> SRR390524 1 0.0291 0.8171 0.992 0.000 0.000 0.004 0.000 0.004
#> SRR390525 1 0.0291 0.8171 0.992 0.000 0.000 0.004 0.000 0.004
#> SRR390526 4 0.5482 0.5431 0.192 0.000 0.016 0.620 0.000 0.172
#> SRR390527 4 0.5482 0.5431 0.192 0.000 0.016 0.620 0.000 0.172
#> SRR390528 4 0.3903 0.7829 0.000 0.000 0.108 0.792 0.084 0.016
#> SRR390529 1 0.5562 0.3804 0.528 0.000 0.080 0.024 0.000 0.368
#> SRR390530 1 0.4513 0.4766 0.636 0.000 0.016 0.324 0.000 0.024
#> SRR390531 1 0.4513 0.4766 0.636 0.000 0.016 0.324 0.000 0.024
#> SRR390532 3 0.5541 -0.0911 0.000 0.000 0.456 0.444 0.084 0.016
#> SRR390533 4 0.0862 0.8670 0.008 0.000 0.016 0.972 0.000 0.004
#> SRR390534 4 0.0862 0.8670 0.008 0.000 0.016 0.972 0.000 0.004
#> SRR390535 4 0.1225 0.8597 0.036 0.000 0.000 0.952 0.000 0.012
#> SRR390536 5 0.0000 0.9455 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390537 5 0.0000 0.9455 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390538 1 0.0000 0.8166 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390539 1 0.0146 0.8159 0.996 0.000 0.004 0.000 0.000 0.000
#> SRR390540 1 0.0458 0.8135 0.984 0.000 0.016 0.000 0.000 0.000
#> SRR390541 1 0.0291 0.8171 0.992 0.000 0.000 0.004 0.000 0.004
#> SRR390542 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390543 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390544 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390545 2 0.0000 1.0000 0.000 1.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
SD:NMF**
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"]
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 15244 rows and 71 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:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.4545 0.546 0.546
#> 3 3 0.704 0.819 0.913 0.3552 0.720 0.533
#> 4 4 0.815 0.875 0.925 0.1445 0.831 0.593
#> 5 5 0.836 0.773 0.895 0.1217 0.852 0.540
#> 6 6 0.871 0.827 0.892 0.0469 0.936 0.706
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
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.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0 1 1 0
#> SRR390471 1 0 1 1 0
#> SRR390472 1 0 1 1 0
#> SRR390473 1 0 1 1 0
#> SRR390474 1 0 1 1 0
#> SRR390475 1 0 1 1 0
#> SRR390476 1 0 1 1 0
#> SRR390477 1 0 1 1 0
#> SRR390478 1 0 1 1 0
#> SRR390480 1 0 1 1 0
#> SRR390481 1 0 1 1 0
#> SRR390482 1 0 1 1 0
#> SRR390483 1 0 1 1 0
#> SRR390484 2 0 1 0 1
#> SRR390485 2 0 1 0 1
#> SRR390486 1 0 1 1 0
#> SRR390487 1 0 1 1 0
#> SRR390488 1 0 1 1 0
#> SRR390489 1 0 1 1 0
#> SRR390492 2 0 1 0 1
#> SRR390493 2 0 1 0 1
#> SRR390494 2 0 1 0 1
#> SRR390495 2 0 1 0 1
#> SRR390496 2 0 1 0 1
#> SRR390497 2 0 1 0 1
#> SRR390498 2 0 1 0 1
#> SRR390499 1 0 1 1 0
#> SRR390500 1 0 1 1 0
#> SRR390501 1 0 1 1 0
#> SRR390502 1 0 1 1 0
#> SRR390503 1 0 1 1 0
#> SRR390504 1 0 1 1 0
#> SRR390505 1 0 1 1 0
#> SRR390506 1 0 1 1 0
#> SRR390507 2 0 1 0 1
#> SRR390508 2 0 1 0 1
#> SRR390509 2 0 1 0 1
#> SRR390510 2 0 1 0 1
#> SRR390512 2 0 1 0 1
#> SRR390513 2 0 1 0 1
#> SRR390514 2 0 1 0 1
#> SRR390515 1 0 1 1 0
#> SRR390516 1 0 1 1 0
#> SRR390517 2 0 1 0 1
#> SRR390519 2 0 1 0 1
#> SRR390520 1 0 1 1 0
#> SRR390521 1 0 1 1 0
#> SRR390522 1 0 1 1 0
#> SRR390523 1 0 1 1 0
#> SRR390524 1 0 1 1 0
#> SRR390525 1 0 1 1 0
#> SRR390526 1 0 1 1 0
#> SRR390527 1 0 1 1 0
#> SRR390528 1 0 1 1 0
#> SRR390529 1 0 1 1 0
#> SRR390530 1 0 1 1 0
#> SRR390531 1 0 1 1 0
#> SRR390532 1 0 1 1 0
#> SRR390533 1 0 1 1 0
#> SRR390534 1 0 1 1 0
#> SRR390535 1 0 1 1 0
#> SRR390536 2 0 1 0 1
#> SRR390537 2 0 1 0 1
#> SRR390538 1 0 1 1 0
#> SRR390539 1 0 1 1 0
#> SRR390540 1 0 1 1 0
#> SRR390541 1 0 1 1 0
#> SRR390542 2 0 1 0 1
#> SRR390543 2 0 1 0 1
#> SRR390544 2 0 1 0 1
#> SRR390545 2 0 1 0 1
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.0424 0.9100 0.992 0.000 0.008
#> SRR390471 1 0.0424 0.9100 0.992 0.000 0.008
#> SRR390472 1 0.0424 0.9100 0.992 0.000 0.008
#> SRR390473 1 0.0424 0.9100 0.992 0.000 0.008
#> SRR390474 3 0.6192 0.3715 0.420 0.000 0.580
#> SRR390475 1 0.0424 0.9100 0.992 0.000 0.008
#> SRR390476 1 0.0424 0.9100 0.992 0.000 0.008
#> SRR390477 1 0.0424 0.9100 0.992 0.000 0.008
#> SRR390478 1 0.0424 0.9100 0.992 0.000 0.008
#> SRR390480 1 0.4346 0.7393 0.816 0.000 0.184
#> SRR390481 1 0.4605 0.7217 0.796 0.000 0.204
#> SRR390482 1 0.6299 0.0864 0.524 0.000 0.476
#> SRR390483 3 0.6235 0.1907 0.436 0.000 0.564
#> SRR390484 3 0.0424 0.7952 0.000 0.008 0.992
#> SRR390485 3 0.0424 0.7952 0.000 0.008 0.992
#> SRR390486 3 0.5216 0.7572 0.260 0.000 0.740
#> SRR390487 3 0.5216 0.7572 0.260 0.000 0.740
#> SRR390488 3 0.5216 0.7572 0.260 0.000 0.740
#> SRR390489 3 0.5216 0.7572 0.260 0.000 0.740
#> SRR390492 3 0.0424 0.7952 0.000 0.008 0.992
#> SRR390493 3 0.0424 0.7952 0.000 0.008 0.992
#> SRR390494 3 0.0424 0.7952 0.000 0.008 0.992
#> SRR390495 3 0.0424 0.7952 0.000 0.008 0.992
#> SRR390496 3 0.0424 0.7952 0.000 0.008 0.992
#> SRR390497 3 0.0424 0.7952 0.000 0.008 0.992
#> SRR390498 2 0.0000 1.0000 0.000 1.000 0.000
#> SRR390499 1 0.4931 0.6908 0.768 0.000 0.232
#> SRR390500 1 0.4974 0.6859 0.764 0.000 0.236
#> SRR390501 3 0.5216 0.7572 0.260 0.000 0.740
#> SRR390502 3 0.5216 0.7572 0.260 0.000 0.740
#> SRR390503 3 0.5216 0.7572 0.260 0.000 0.740
#> SRR390504 3 0.5216 0.7572 0.260 0.000 0.740
#> SRR390505 1 0.0237 0.9093 0.996 0.000 0.004
#> SRR390506 1 0.0237 0.9093 0.996 0.000 0.004
#> SRR390507 2 0.0000 1.0000 0.000 1.000 0.000
#> SRR390508 2 0.0000 1.0000 0.000 1.000 0.000
#> SRR390509 2 0.0000 1.0000 0.000 1.000 0.000
#> SRR390510 2 0.0000 1.0000 0.000 1.000 0.000
#> SRR390512 2 0.0000 1.0000 0.000 1.000 0.000
#> SRR390513 2 0.0000 1.0000 0.000 1.000 0.000
#> SRR390514 2 0.0000 1.0000 0.000 1.000 0.000
#> SRR390515 1 0.0424 0.9100 0.992 0.000 0.008
#> SRR390516 3 0.5216 0.7572 0.260 0.000 0.740
#> SRR390517 2 0.0000 1.0000 0.000 1.000 0.000
#> SRR390519 3 0.0424 0.7952 0.000 0.008 0.992
#> SRR390520 1 0.6291 -0.1704 0.532 0.000 0.468
#> SRR390521 1 0.4605 0.6799 0.796 0.000 0.204
#> SRR390522 1 0.2261 0.8649 0.932 0.000 0.068
#> SRR390523 1 0.2537 0.8508 0.920 0.000 0.080
#> SRR390524 1 0.0424 0.9100 0.992 0.000 0.008
#> SRR390525 1 0.0424 0.9100 0.992 0.000 0.008
#> SRR390526 1 0.0000 0.9085 1.000 0.000 0.000
#> SRR390527 1 0.0000 0.9085 1.000 0.000 0.000
#> SRR390528 1 0.4887 0.6945 0.772 0.000 0.228
#> SRR390529 1 0.0237 0.9093 0.996 0.000 0.004
#> SRR390530 1 0.0424 0.9100 0.992 0.000 0.008
#> SRR390531 1 0.0424 0.9100 0.992 0.000 0.008
#> SRR390532 3 0.5948 0.4081 0.360 0.000 0.640
#> SRR390533 1 0.0237 0.9093 0.996 0.000 0.004
#> SRR390534 1 0.0237 0.9093 0.996 0.000 0.004
#> SRR390535 1 0.0237 0.9093 0.996 0.000 0.004
#> SRR390536 3 0.0424 0.7952 0.000 0.008 0.992
#> SRR390537 3 0.0424 0.7952 0.000 0.008 0.992
#> SRR390538 1 0.0237 0.9093 0.996 0.000 0.004
#> SRR390539 1 0.0237 0.9093 0.996 0.000 0.004
#> SRR390540 1 0.0237 0.9093 0.996 0.000 0.004
#> SRR390541 1 0.0237 0.9093 0.996 0.000 0.004
#> SRR390542 2 0.0000 1.0000 0.000 1.000 0.000
#> SRR390543 2 0.0000 1.0000 0.000 1.000 0.000
#> SRR390544 2 0.0000 1.0000 0.000 1.000 0.000
#> SRR390545 2 0.0000 1.0000 0.000 1.000 0.000
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.0000 0.920 1.000 0 0.000 0.000
#> SRR390471 1 0.0000 0.920 1.000 0 0.000 0.000
#> SRR390472 1 0.0000 0.920 1.000 0 0.000 0.000
#> SRR390473 1 0.0000 0.920 1.000 0 0.000 0.000
#> SRR390474 1 0.6011 -0.203 0.484 0 0.040 0.476
#> SRR390475 1 0.0000 0.920 1.000 0 0.000 0.000
#> SRR390476 1 0.0000 0.920 1.000 0 0.000 0.000
#> SRR390477 1 0.0000 0.920 1.000 0 0.000 0.000
#> SRR390478 1 0.0000 0.920 1.000 0 0.000 0.000
#> SRR390480 4 0.4401 0.653 0.272 0 0.004 0.724
#> SRR390481 4 0.4122 0.714 0.236 0 0.004 0.760
#> SRR390482 4 0.3982 0.734 0.220 0 0.004 0.776
#> SRR390483 4 0.3945 0.738 0.216 0 0.004 0.780
#> SRR390484 4 0.2345 0.792 0.000 0 0.100 0.900
#> SRR390485 4 0.2469 0.785 0.000 0 0.108 0.892
#> SRR390486 3 0.0000 0.999 0.000 0 1.000 0.000
#> SRR390487 3 0.0000 0.999 0.000 0 1.000 0.000
#> SRR390488 3 0.0000 0.999 0.000 0 1.000 0.000
#> SRR390489 3 0.0000 0.999 0.000 0 1.000 0.000
#> SRR390492 4 0.2081 0.802 0.000 0 0.084 0.916
#> SRR390493 4 0.2081 0.802 0.000 0 0.084 0.916
#> SRR390494 4 0.1940 0.805 0.000 0 0.076 0.924
#> SRR390495 4 0.1867 0.807 0.000 0 0.072 0.928
#> SRR390496 4 0.1867 0.807 0.000 0 0.072 0.928
#> SRR390497 4 0.2345 0.792 0.000 0 0.100 0.900
#> SRR390498 2 0.0000 1.000 0.000 1 0.000 0.000
#> SRR390499 4 0.4053 0.725 0.228 0 0.004 0.768
#> SRR390500 4 0.4088 0.720 0.232 0 0.004 0.764
#> SRR390501 3 0.0000 0.999 0.000 0 1.000 0.000
#> SRR390502 3 0.0000 0.999 0.000 0 1.000 0.000
#> SRR390503 3 0.0000 0.999 0.000 0 1.000 0.000
#> SRR390504 3 0.0188 0.995 0.000 0 0.996 0.004
#> SRR390505 1 0.1557 0.914 0.944 0 0.000 0.056
#> SRR390506 1 0.1557 0.914 0.944 0 0.000 0.056
#> SRR390507 2 0.0000 1.000 0.000 1 0.000 0.000
#> SRR390508 2 0.0000 1.000 0.000 1 0.000 0.000
#> SRR390509 2 0.0000 1.000 0.000 1 0.000 0.000
#> SRR390510 2 0.0000 1.000 0.000 1 0.000 0.000
#> SRR390512 2 0.0000 1.000 0.000 1 0.000 0.000
#> SRR390513 2 0.0000 1.000 0.000 1 0.000 0.000
#> SRR390514 2 0.0000 1.000 0.000 1 0.000 0.000
#> SRR390515 1 0.0000 0.920 1.000 0 0.000 0.000
#> SRR390516 3 0.0000 0.999 0.000 0 1.000 0.000
#> SRR390517 2 0.0000 1.000 0.000 1 0.000 0.000
#> SRR390519 4 0.2345 0.792 0.000 0 0.100 0.900
#> SRR390520 1 0.5454 0.644 0.732 0 0.096 0.172
#> SRR390521 1 0.4399 0.668 0.760 0 0.016 0.224
#> SRR390522 1 0.3479 0.792 0.840 0 0.012 0.148
#> SRR390523 1 0.2988 0.837 0.876 0 0.012 0.112
#> SRR390524 1 0.0000 0.920 1.000 0 0.000 0.000
#> SRR390525 1 0.0000 0.920 1.000 0 0.000 0.000
#> SRR390526 1 0.2011 0.905 0.920 0 0.000 0.080
#> SRR390527 1 0.2011 0.905 0.920 0 0.000 0.080
#> SRR390528 4 0.3908 0.741 0.212 0 0.004 0.784
#> SRR390529 1 0.1557 0.914 0.944 0 0.000 0.056
#> SRR390530 1 0.0000 0.920 1.000 0 0.000 0.000
#> SRR390531 1 0.0000 0.920 1.000 0 0.000 0.000
#> SRR390532 4 0.3583 0.761 0.180 0 0.004 0.816
#> SRR390533 1 0.2530 0.893 0.896 0 0.004 0.100
#> SRR390534 1 0.2530 0.893 0.896 0 0.004 0.100
#> SRR390535 1 0.2530 0.893 0.896 0 0.004 0.100
#> SRR390536 4 0.1792 0.806 0.000 0 0.068 0.932
#> SRR390537 4 0.1867 0.807 0.000 0 0.072 0.928
#> SRR390538 1 0.1557 0.914 0.944 0 0.000 0.056
#> SRR390539 1 0.1557 0.914 0.944 0 0.000 0.056
#> SRR390540 1 0.1557 0.914 0.944 0 0.000 0.056
#> SRR390541 1 0.1557 0.914 0.944 0 0.000 0.056
#> SRR390542 2 0.0000 1.000 0.000 1 0.000 0.000
#> SRR390543 2 0.0000 1.000 0.000 1 0.000 0.000
#> SRR390544 2 0.0000 1.000 0.000 1 0.000 0.000
#> SRR390545 2 0.0000 1.000 0.000 1 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.4446 0.796 0.520 0 0.004 0.476 0.000
#> SRR390471 1 0.4446 0.796 0.520 0 0.004 0.476 0.000
#> SRR390472 1 0.4446 0.796 0.520 0 0.004 0.476 0.000
#> SRR390473 1 0.4446 0.796 0.520 0 0.004 0.476 0.000
#> SRR390474 1 0.6135 0.273 0.552 0 0.004 0.140 0.304
#> SRR390475 1 0.4446 0.796 0.520 0 0.004 0.476 0.000
#> SRR390476 1 0.4446 0.796 0.520 0 0.004 0.476 0.000
#> SRR390477 1 0.4446 0.796 0.520 0 0.004 0.476 0.000
#> SRR390478 1 0.4446 0.796 0.520 0 0.004 0.476 0.000
#> SRR390480 4 0.4705 0.736 0.484 0 0.008 0.504 0.004
#> SRR390481 4 0.4705 0.736 0.484 0 0.008 0.504 0.004
#> SRR390482 4 0.4912 0.733 0.480 0 0.008 0.500 0.012
#> SRR390483 4 0.5000 0.732 0.476 0 0.008 0.500 0.016
#> SRR390484 5 0.0162 0.929 0.000 0 0.004 0.000 0.996
#> SRR390485 5 0.0162 0.929 0.000 0 0.004 0.000 0.996
#> SRR390486 3 0.0404 1.000 0.000 0 0.988 0.000 0.012
#> SRR390487 3 0.0404 1.000 0.000 0 0.988 0.000 0.012
#> SRR390488 3 0.0404 1.000 0.000 0 0.988 0.000 0.012
#> SRR390489 3 0.0404 1.000 0.000 0 0.988 0.000 0.012
#> SRR390492 5 0.0000 0.931 0.000 0 0.000 0.000 1.000
#> SRR390493 5 0.0000 0.931 0.000 0 0.000 0.000 1.000
#> SRR390494 5 0.0000 0.931 0.000 0 0.000 0.000 1.000
#> SRR390495 5 0.2516 0.870 0.140 0 0.000 0.000 0.860
#> SRR390496 5 0.2929 0.830 0.180 0 0.000 0.000 0.820
#> SRR390497 5 0.0000 0.931 0.000 0 0.000 0.000 1.000
#> SRR390498 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> SRR390499 4 0.4705 0.736 0.484 0 0.008 0.504 0.004
#> SRR390500 4 0.4560 0.737 0.484 0 0.008 0.508 0.000
#> SRR390501 3 0.0404 1.000 0.000 0 0.988 0.000 0.012
#> SRR390502 3 0.0404 1.000 0.000 0 0.988 0.000 0.012
#> SRR390503 3 0.0404 1.000 0.000 0 0.988 0.000 0.012
#> SRR390504 3 0.0404 1.000 0.000 0 0.988 0.000 0.012
#> SRR390505 4 0.0000 0.384 0.000 0 0.000 1.000 0.000
#> SRR390506 4 0.0290 0.365 0.008 0 0.000 0.992 0.000
#> SRR390507 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> SRR390508 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> SRR390509 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> SRR390510 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> SRR390512 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> SRR390513 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> SRR390514 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> SRR390515 1 0.4446 0.796 0.520 0 0.004 0.476 0.000
#> SRR390516 3 0.0404 1.000 0.000 0 0.988 0.000 0.012
#> SRR390517 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> SRR390519 5 0.0000 0.931 0.000 0 0.000 0.000 1.000
#> SRR390520 1 0.7310 0.576 0.360 0 0.024 0.352 0.264
#> SRR390521 1 0.5974 0.508 0.604 0 0.004 0.224 0.168
#> SRR390522 1 0.5312 0.570 0.652 0 0.000 0.248 0.100
#> SRR390523 1 0.5216 0.575 0.660 0 0.000 0.248 0.092
#> SRR390524 1 0.4446 0.796 0.520 0 0.004 0.476 0.000
#> SRR390525 1 0.4446 0.796 0.520 0 0.004 0.476 0.000
#> SRR390526 1 0.3519 -0.324 0.776 0 0.008 0.216 0.000
#> SRR390527 1 0.3582 -0.352 0.768 0 0.008 0.224 0.000
#> SRR390528 4 0.4560 0.737 0.484 0 0.008 0.508 0.000
#> SRR390529 4 0.0000 0.384 0.000 0 0.000 1.000 0.000
#> SRR390530 1 0.4446 0.796 0.520 0 0.004 0.476 0.000
#> SRR390531 1 0.4446 0.796 0.520 0 0.004 0.476 0.000
#> SRR390532 4 0.4997 0.733 0.468 0 0.008 0.508 0.016
#> SRR390533 4 0.4302 0.735 0.480 0 0.000 0.520 0.000
#> SRR390534 4 0.4302 0.735 0.480 0 0.000 0.520 0.000
#> SRR390535 4 0.4560 0.737 0.484 0 0.008 0.508 0.000
#> SRR390536 5 0.2020 0.893 0.100 0 0.000 0.000 0.900
#> SRR390537 5 0.2561 0.866 0.144 0 0.000 0.000 0.856
#> SRR390538 4 0.0000 0.384 0.000 0 0.000 1.000 0.000
#> SRR390539 4 0.0000 0.384 0.000 0 0.000 1.000 0.000
#> SRR390540 4 0.0000 0.384 0.000 0 0.000 1.000 0.000
#> SRR390541 4 0.0000 0.384 0.000 0 0.000 1.000 0.000
#> SRR390542 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> SRR390543 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> SRR390544 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
#> SRR390545 2 0.0000 1.000 0.000 1 0.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.0000 0.7938 1.000 0 0.000 0.000 0.000 0.000
#> SRR390471 1 0.0000 0.7938 1.000 0 0.000 0.000 0.000 0.000
#> SRR390472 1 0.0000 0.7938 1.000 0 0.000 0.000 0.000 0.000
#> SRR390473 1 0.0000 0.7938 1.000 0 0.000 0.000 0.000 0.000
#> SRR390474 1 0.7691 0.1156 0.348 0 0.008 0.144 0.256 0.244
#> SRR390475 1 0.0000 0.7938 1.000 0 0.000 0.000 0.000 0.000
#> SRR390476 1 0.0000 0.7938 1.000 0 0.000 0.000 0.000 0.000
#> SRR390477 1 0.0146 0.7934 0.996 0 0.000 0.000 0.000 0.004
#> SRR390478 1 0.0146 0.7934 0.996 0 0.000 0.000 0.000 0.004
#> SRR390480 4 0.0146 0.8867 0.000 0 0.000 0.996 0.000 0.004
#> SRR390481 4 0.0000 0.8881 0.000 0 0.000 1.000 0.000 0.000
#> SRR390482 4 0.0713 0.8920 0.000 0 0.000 0.972 0.000 0.028
#> SRR390483 4 0.0713 0.8920 0.000 0 0.000 0.972 0.000 0.028
#> SRR390484 5 0.1327 0.8835 0.000 0 0.000 0.000 0.936 0.064
#> SRR390485 5 0.1327 0.8835 0.000 0 0.000 0.000 0.936 0.064
#> SRR390486 3 0.0000 1.0000 0.000 0 1.000 0.000 0.000 0.000
#> SRR390487 3 0.0000 1.0000 0.000 0 1.000 0.000 0.000 0.000
#> SRR390488 3 0.0000 1.0000 0.000 0 1.000 0.000 0.000 0.000
#> SRR390489 3 0.0000 1.0000 0.000 0 1.000 0.000 0.000 0.000
#> SRR390492 5 0.0000 0.8913 0.000 0 0.000 0.000 1.000 0.000
#> SRR390493 5 0.0000 0.8913 0.000 0 0.000 0.000 1.000 0.000
#> SRR390494 5 0.0458 0.8912 0.000 0 0.000 0.016 0.984 0.000
#> SRR390495 5 0.2814 0.8265 0.000 0 0.000 0.172 0.820 0.008
#> SRR390496 5 0.2946 0.8215 0.000 0 0.000 0.176 0.812 0.012
#> SRR390497 5 0.1327 0.8835 0.000 0 0.000 0.000 0.936 0.064
#> SRR390498 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390499 4 0.0363 0.8912 0.000 0 0.000 0.988 0.000 0.012
#> SRR390500 4 0.0547 0.8921 0.000 0 0.000 0.980 0.000 0.020
#> SRR390501 3 0.0000 1.0000 0.000 0 1.000 0.000 0.000 0.000
#> SRR390502 3 0.0000 1.0000 0.000 0 1.000 0.000 0.000 0.000
#> SRR390503 3 0.0000 1.0000 0.000 0 1.000 0.000 0.000 0.000
#> SRR390504 3 0.0000 1.0000 0.000 0 1.000 0.000 0.000 0.000
#> SRR390505 6 0.4377 0.8641 0.244 0 0.000 0.068 0.000 0.688
#> SRR390506 6 0.4377 0.8641 0.244 0 0.000 0.068 0.000 0.688
#> SRR390507 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390508 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390509 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390510 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390512 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390513 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390514 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390515 1 0.0000 0.7938 1.000 0 0.000 0.000 0.000 0.000
#> SRR390516 3 0.0000 1.0000 0.000 0 1.000 0.000 0.000 0.000
#> SRR390517 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390519 5 0.1327 0.8835 0.000 0 0.000 0.000 0.936 0.064
#> SRR390520 1 0.6906 -0.1122 0.376 0 0.052 0.000 0.292 0.280
#> SRR390521 6 0.7677 -0.1837 0.260 0 0.000 0.204 0.232 0.304
#> SRR390522 1 0.7591 0.0991 0.320 0 0.000 0.200 0.188 0.292
#> SRR390523 1 0.7389 0.1871 0.388 0 0.000 0.168 0.172 0.272
#> SRR390524 1 0.0146 0.7934 0.996 0 0.000 0.000 0.000 0.004
#> SRR390525 1 0.0146 0.7934 0.996 0 0.000 0.000 0.000 0.004
#> SRR390526 4 0.3215 0.6636 0.240 0 0.000 0.756 0.000 0.004
#> SRR390527 4 0.3136 0.6782 0.228 0 0.000 0.768 0.000 0.004
#> SRR390528 4 0.0713 0.8920 0.000 0 0.000 0.972 0.000 0.028
#> SRR390529 6 0.4377 0.8641 0.244 0 0.000 0.068 0.000 0.688
#> SRR390530 1 0.0547 0.7848 0.980 0 0.000 0.000 0.000 0.020
#> SRR390531 1 0.0547 0.7848 0.980 0 0.000 0.000 0.000 0.020
#> SRR390532 4 0.1007 0.8841 0.000 0 0.000 0.956 0.000 0.044
#> SRR390533 4 0.3151 0.7181 0.000 0 0.000 0.748 0.000 0.252
#> SRR390534 4 0.3244 0.6993 0.000 0 0.000 0.732 0.000 0.268
#> SRR390535 4 0.1141 0.8659 0.000 0 0.000 0.948 0.000 0.052
#> SRR390536 5 0.2260 0.8485 0.000 0 0.000 0.140 0.860 0.000
#> SRR390537 5 0.2814 0.8265 0.000 0 0.000 0.172 0.820 0.008
#> SRR390538 6 0.4377 0.8641 0.244 0 0.000 0.068 0.000 0.688
#> SRR390539 6 0.4377 0.8641 0.244 0 0.000 0.068 0.000 0.688
#> SRR390540 6 0.4377 0.8641 0.244 0 0.000 0.068 0.000 0.688
#> SRR390541 6 0.4377 0.8641 0.244 0 0.000 0.068 0.000 0.688
#> SRR390542 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390543 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390544 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390545 2 0.0000 1.0000 0.000 1 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
CV:hclust*
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"]
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 15244 rows and 71 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 6.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)

The plots are:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.351 0.718 0.787 0.411 0.546 0.546
#> 3 3 0.773 0.921 0.935 0.375 0.862 0.748
#> 4 4 0.610 0.772 0.833 0.138 0.934 0.837
#> 5 5 0.686 0.877 0.846 0.121 0.942 0.832
#> 6 6 0.906 0.949 0.949 0.127 0.895 0.632
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
suggest_best_k(res)
#> [1] 6
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.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.775 0.800 0.772 0.228
#> SRR390471 1 0.775 0.800 0.772 0.228
#> SRR390472 1 0.775 0.800 0.772 0.228
#> SRR390473 1 0.775 0.800 0.772 0.228
#> SRR390474 1 0.781 0.782 0.768 0.232
#> SRR390475 1 0.775 0.800 0.772 0.228
#> SRR390476 1 0.775 0.800 0.772 0.228
#> SRR390477 1 0.775 0.800 0.772 0.228
#> SRR390478 1 0.775 0.800 0.772 0.228
#> SRR390480 1 0.821 0.796 0.744 0.256
#> SRR390481 1 0.821 0.796 0.744 0.256
#> SRR390482 1 0.821 0.796 0.744 0.256
#> SRR390483 1 0.821 0.796 0.744 0.256
#> SRR390484 2 0.469 0.888 0.100 0.900
#> SRR390485 2 0.469 0.888 0.100 0.900
#> SRR390486 1 0.992 -0.116 0.552 0.448
#> SRR390487 1 0.992 -0.116 0.552 0.448
#> SRR390488 1 0.992 -0.116 0.552 0.448
#> SRR390489 1 0.992 -0.116 0.552 0.448
#> SRR390492 2 0.574 0.886 0.136 0.864
#> SRR390493 2 0.574 0.886 0.136 0.864
#> SRR390494 2 0.574 0.886 0.136 0.864
#> SRR390495 2 0.574 0.886 0.136 0.864
#> SRR390496 2 0.574 0.886 0.136 0.864
#> SRR390497 2 0.469 0.888 0.100 0.900
#> SRR390498 2 0.295 0.923 0.052 0.948
#> SRR390499 1 0.821 0.796 0.744 0.256
#> SRR390500 1 0.821 0.796 0.744 0.256
#> SRR390501 1 0.992 -0.116 0.552 0.448
#> SRR390502 1 0.992 -0.116 0.552 0.448
#> SRR390503 1 0.992 -0.116 0.552 0.448
#> SRR390504 1 0.992 -0.116 0.552 0.448
#> SRR390505 1 0.814 0.799 0.748 0.252
#> SRR390506 1 0.814 0.799 0.748 0.252
#> SRR390507 2 0.295 0.923 0.052 0.948
#> SRR390508 2 0.295 0.923 0.052 0.948
#> SRR390509 2 0.295 0.923 0.052 0.948
#> SRR390510 2 0.295 0.923 0.052 0.948
#> SRR390512 2 0.295 0.923 0.052 0.948
#> SRR390513 2 0.295 0.923 0.052 0.948
#> SRR390514 2 0.295 0.923 0.052 0.948
#> SRR390515 1 0.775 0.800 0.772 0.228
#> SRR390516 1 0.992 -0.116 0.552 0.448
#> SRR390517 2 0.295 0.923 0.052 0.948
#> SRR390519 2 0.469 0.888 0.100 0.900
#> SRR390520 1 0.781 0.782 0.768 0.232
#> SRR390521 1 0.781 0.782 0.768 0.232
#> SRR390522 1 0.781 0.782 0.768 0.232
#> SRR390523 1 0.781 0.782 0.768 0.232
#> SRR390524 1 0.775 0.800 0.772 0.228
#> SRR390525 1 0.775 0.800 0.772 0.228
#> SRR390526 1 0.814 0.799 0.748 0.252
#> SRR390527 1 0.814 0.799 0.748 0.252
#> SRR390528 1 0.821 0.796 0.744 0.256
#> SRR390529 1 0.814 0.799 0.748 0.252
#> SRR390530 1 0.775 0.800 0.772 0.228
#> SRR390531 1 0.775 0.800 0.772 0.228
#> SRR390532 1 0.821 0.796 0.744 0.256
#> SRR390533 1 0.814 0.799 0.748 0.252
#> SRR390534 1 0.814 0.799 0.748 0.252
#> SRR390535 1 0.814 0.799 0.748 0.252
#> SRR390536 2 0.574 0.886 0.136 0.864
#> SRR390537 2 0.574 0.886 0.136 0.864
#> SRR390538 1 0.814 0.799 0.748 0.252
#> SRR390539 1 0.814 0.799 0.748 0.252
#> SRR390540 1 0.814 0.799 0.748 0.252
#> SRR390541 1 0.814 0.799 0.748 0.252
#> SRR390542 2 0.295 0.923 0.052 0.948
#> SRR390543 2 0.295 0.923 0.052 0.948
#> SRR390544 2 0.295 0.923 0.052 0.948
#> SRR390545 2 0.295 0.923 0.052 0.948
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.1031 0.966 0.976 0.000 0.024
#> SRR390471 1 0.1031 0.966 0.976 0.000 0.024
#> SRR390472 1 0.1031 0.966 0.976 0.000 0.024
#> SRR390473 1 0.1031 0.966 0.976 0.000 0.024
#> SRR390474 1 0.2165 0.941 0.936 0.000 0.064
#> SRR390475 1 0.1031 0.966 0.976 0.000 0.024
#> SRR390476 1 0.1031 0.966 0.976 0.000 0.024
#> SRR390477 1 0.1031 0.966 0.976 0.000 0.024
#> SRR390478 1 0.1031 0.966 0.976 0.000 0.024
#> SRR390480 1 0.1860 0.935 0.948 0.052 0.000
#> SRR390481 1 0.1860 0.935 0.948 0.052 0.000
#> SRR390482 1 0.1860 0.935 0.948 0.052 0.000
#> SRR390483 1 0.1860 0.935 0.948 0.052 0.000
#> SRR390484 2 0.5660 0.805 0.200 0.772 0.028
#> SRR390485 2 0.5660 0.805 0.200 0.772 0.028
#> SRR390486 3 0.0475 1.000 0.004 0.004 0.992
#> SRR390487 3 0.0475 1.000 0.004 0.004 0.992
#> SRR390488 3 0.0475 1.000 0.004 0.004 0.992
#> SRR390489 3 0.0475 1.000 0.004 0.004 0.992
#> SRR390492 2 0.4654 0.820 0.208 0.792 0.000
#> SRR390493 2 0.4654 0.820 0.208 0.792 0.000
#> SRR390494 2 0.4654 0.820 0.208 0.792 0.000
#> SRR390495 2 0.4654 0.820 0.208 0.792 0.000
#> SRR390496 2 0.4654 0.820 0.208 0.792 0.000
#> SRR390497 2 0.5660 0.805 0.200 0.772 0.028
#> SRR390498 2 0.2625 0.852 0.084 0.916 0.000
#> SRR390499 1 0.1860 0.935 0.948 0.052 0.000
#> SRR390500 1 0.1860 0.935 0.948 0.052 0.000
#> SRR390501 3 0.0475 1.000 0.004 0.004 0.992
#> SRR390502 3 0.0475 1.000 0.004 0.004 0.992
#> SRR390503 3 0.0475 1.000 0.004 0.004 0.992
#> SRR390504 3 0.0475 1.000 0.004 0.004 0.992
#> SRR390505 1 0.0000 0.966 1.000 0.000 0.000
#> SRR390506 1 0.0000 0.966 1.000 0.000 0.000
#> SRR390507 2 0.2625 0.852 0.084 0.916 0.000
#> SRR390508 2 0.2625 0.852 0.084 0.916 0.000
#> SRR390509 2 0.2625 0.852 0.084 0.916 0.000
#> SRR390510 2 0.2625 0.852 0.084 0.916 0.000
#> SRR390512 2 0.2625 0.852 0.084 0.916 0.000
#> SRR390513 2 0.2625 0.852 0.084 0.916 0.000
#> SRR390514 2 0.2625 0.852 0.084 0.916 0.000
#> SRR390515 1 0.1031 0.966 0.976 0.000 0.024
#> SRR390516 3 0.0475 1.000 0.004 0.004 0.992
#> SRR390517 2 0.2625 0.852 0.084 0.916 0.000
#> SRR390519 2 0.5660 0.805 0.200 0.772 0.028
#> SRR390520 1 0.2165 0.941 0.936 0.000 0.064
#> SRR390521 1 0.2165 0.941 0.936 0.000 0.064
#> SRR390522 1 0.2165 0.941 0.936 0.000 0.064
#> SRR390523 1 0.2165 0.941 0.936 0.000 0.064
#> SRR390524 1 0.1031 0.966 0.976 0.000 0.024
#> SRR390525 1 0.1031 0.966 0.976 0.000 0.024
#> SRR390526 1 0.0592 0.962 0.988 0.012 0.000
#> SRR390527 1 0.0592 0.962 0.988 0.012 0.000
#> SRR390528 1 0.1860 0.935 0.948 0.052 0.000
#> SRR390529 1 0.0000 0.966 1.000 0.000 0.000
#> SRR390530 1 0.1031 0.966 0.976 0.000 0.024
#> SRR390531 1 0.1031 0.966 0.976 0.000 0.024
#> SRR390532 1 0.1860 0.935 0.948 0.052 0.000
#> SRR390533 1 0.0000 0.966 1.000 0.000 0.000
#> SRR390534 1 0.0000 0.966 1.000 0.000 0.000
#> SRR390535 1 0.0000 0.966 1.000 0.000 0.000
#> SRR390536 2 0.4654 0.820 0.208 0.792 0.000
#> SRR390537 2 0.4654 0.820 0.208 0.792 0.000
#> SRR390538 1 0.0000 0.966 1.000 0.000 0.000
#> SRR390539 1 0.0000 0.966 1.000 0.000 0.000
#> SRR390540 1 0.0000 0.966 1.000 0.000 0.000
#> SRR390541 1 0.0000 0.966 1.000 0.000 0.000
#> SRR390542 2 0.2625 0.852 0.084 0.916 0.000
#> SRR390543 2 0.2625 0.852 0.084 0.916 0.000
#> SRR390544 2 0.2625 0.852 0.084 0.916 0.000
#> SRR390545 2 0.2625 0.852 0.084 0.916 0.000
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.1389 0.802 0.952 0.000 0.000 0.048
#> SRR390471 1 0.1389 0.802 0.952 0.000 0.000 0.048
#> SRR390472 1 0.1389 0.802 0.952 0.000 0.000 0.048
#> SRR390473 1 0.1389 0.802 0.952 0.000 0.000 0.048
#> SRR390474 4 0.5168 1.000 0.492 0.000 0.004 0.504
#> SRR390475 1 0.1389 0.802 0.952 0.000 0.000 0.048
#> SRR390476 1 0.1389 0.802 0.952 0.000 0.000 0.048
#> SRR390477 1 0.1389 0.802 0.952 0.000 0.000 0.048
#> SRR390478 1 0.1389 0.802 0.952 0.000 0.000 0.048
#> SRR390480 1 0.1637 0.771 0.940 0.060 0.000 0.000
#> SRR390481 1 0.1637 0.771 0.940 0.060 0.000 0.000
#> SRR390482 1 0.1637 0.771 0.940 0.060 0.000 0.000
#> SRR390483 1 0.1637 0.771 0.940 0.060 0.000 0.000
#> SRR390484 2 0.5147 0.569 0.200 0.740 0.000 0.060
#> SRR390485 2 0.5147 0.569 0.200 0.740 0.000 0.060
#> SRR390486 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> SRR390487 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> SRR390488 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> SRR390489 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> SRR390492 2 0.3610 0.607 0.200 0.800 0.000 0.000
#> SRR390493 2 0.3610 0.607 0.200 0.800 0.000 0.000
#> SRR390494 2 0.3610 0.607 0.200 0.800 0.000 0.000
#> SRR390495 2 0.3610 0.607 0.200 0.800 0.000 0.000
#> SRR390496 2 0.3610 0.607 0.200 0.800 0.000 0.000
#> SRR390497 2 0.5147 0.569 0.200 0.740 0.000 0.060
#> SRR390498 2 0.6495 0.738 0.072 0.492 0.000 0.436
#> SRR390499 1 0.1637 0.771 0.940 0.060 0.000 0.000
#> SRR390500 1 0.1637 0.771 0.940 0.060 0.000 0.000
#> SRR390501 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> SRR390502 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> SRR390503 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> SRR390504 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> SRR390505 1 0.3610 0.583 0.800 0.200 0.000 0.000
#> SRR390506 1 0.3610 0.583 0.800 0.200 0.000 0.000
#> SRR390507 2 0.6495 0.738 0.072 0.492 0.000 0.436
#> SRR390508 2 0.6495 0.738 0.072 0.492 0.000 0.436
#> SRR390509 2 0.6495 0.738 0.072 0.492 0.000 0.436
#> SRR390510 2 0.6495 0.738 0.072 0.492 0.000 0.436
#> SRR390512 2 0.6495 0.738 0.072 0.492 0.000 0.436
#> SRR390513 2 0.6495 0.738 0.072 0.492 0.000 0.436
#> SRR390514 2 0.6495 0.738 0.072 0.492 0.000 0.436
#> SRR390515 1 0.1389 0.802 0.952 0.000 0.000 0.048
#> SRR390516 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> SRR390517 2 0.6495 0.738 0.072 0.492 0.000 0.436
#> SRR390519 2 0.5147 0.569 0.200 0.740 0.000 0.060
#> SRR390520 4 0.5168 1.000 0.492 0.000 0.004 0.504
#> SRR390521 4 0.5168 1.000 0.492 0.000 0.004 0.504
#> SRR390522 4 0.5168 1.000 0.492 0.000 0.004 0.504
#> SRR390523 4 0.5168 1.000 0.492 0.000 0.004 0.504
#> SRR390524 1 0.1389 0.802 0.952 0.000 0.000 0.048
#> SRR390525 1 0.1389 0.802 0.952 0.000 0.000 0.048
#> SRR390526 1 0.0469 0.806 0.988 0.012 0.000 0.000
#> SRR390527 1 0.0469 0.806 0.988 0.012 0.000 0.000
#> SRR390528 1 0.1637 0.771 0.940 0.060 0.000 0.000
#> SRR390529 1 0.3610 0.583 0.800 0.200 0.000 0.000
#> SRR390530 1 0.1389 0.802 0.952 0.000 0.000 0.048
#> SRR390531 1 0.1389 0.802 0.952 0.000 0.000 0.048
#> SRR390532 1 0.1637 0.771 0.940 0.060 0.000 0.000
#> SRR390533 1 0.0000 0.809 1.000 0.000 0.000 0.000
#> SRR390534 1 0.0000 0.809 1.000 0.000 0.000 0.000
#> SRR390535 1 0.0000 0.809 1.000 0.000 0.000 0.000
#> SRR390536 2 0.3610 0.607 0.200 0.800 0.000 0.000
#> SRR390537 2 0.3610 0.607 0.200 0.800 0.000 0.000
#> SRR390538 1 0.3610 0.583 0.800 0.200 0.000 0.000
#> SRR390539 1 0.3610 0.583 0.800 0.200 0.000 0.000
#> SRR390540 1 0.3610 0.583 0.800 0.200 0.000 0.000
#> SRR390541 1 0.3610 0.583 0.800 0.200 0.000 0.000
#> SRR390542 2 0.6495 0.738 0.072 0.492 0.000 0.436
#> SRR390543 2 0.6495 0.738 0.072 0.492 0.000 0.436
#> SRR390544 2 0.6495 0.738 0.072 0.492 0.000 0.436
#> SRR390545 2 0.6495 0.738 0.072 0.492 0.000 0.436
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.314 0.758 0.796 0.000 0 0.204 0.000
#> SRR390471 1 0.314 0.758 0.796 0.000 0 0.204 0.000
#> SRR390472 1 0.314 0.758 0.796 0.000 0 0.204 0.000
#> SRR390473 1 0.314 0.758 0.796 0.000 0 0.204 0.000
#> SRR390474 4 0.345 1.000 0.000 0.000 0 0.756 0.244
#> SRR390475 1 0.314 0.758 0.796 0.000 0 0.204 0.000
#> SRR390476 1 0.314 0.758 0.796 0.000 0 0.204 0.000
#> SRR390477 1 0.314 0.758 0.796 0.000 0 0.204 0.000
#> SRR390478 1 0.314 0.758 0.796 0.000 0 0.204 0.000
#> SRR390480 1 0.315 0.759 0.856 0.092 0 0.000 0.052
#> SRR390481 1 0.315 0.759 0.856 0.092 0 0.000 0.052
#> SRR390482 1 0.315 0.759 0.856 0.092 0 0.000 0.052
#> SRR390483 1 0.315 0.759 0.856 0.092 0 0.000 0.052
#> SRR390484 5 0.539 0.937 0.144 0.192 0 0.000 0.664
#> SRR390485 5 0.539 0.937 0.144 0.192 0 0.000 0.664
#> SRR390486 3 0.000 1.000 0.000 0.000 1 0.000 0.000
#> SRR390487 3 0.000 1.000 0.000 0.000 1 0.000 0.000
#> SRR390488 3 0.000 1.000 0.000 0.000 1 0.000 0.000
#> SRR390489 3 0.000 1.000 0.000 0.000 1 0.000 0.000
#> SRR390492 5 0.578 0.964 0.144 0.252 0 0.000 0.604
#> SRR390493 5 0.578 0.964 0.144 0.252 0 0.000 0.604
#> SRR390494 5 0.578 0.964 0.144 0.252 0 0.000 0.604
#> SRR390495 5 0.578 0.964 0.144 0.252 0 0.000 0.604
#> SRR390496 5 0.578 0.964 0.144 0.252 0 0.000 0.604
#> SRR390497 5 0.539 0.937 0.144 0.192 0 0.000 0.664
#> SRR390498 2 0.000 1.000 0.000 1.000 0 0.000 0.000
#> SRR390499 1 0.315 0.759 0.856 0.092 0 0.000 0.052
#> SRR390500 1 0.315 0.759 0.856 0.092 0 0.000 0.052
#> SRR390501 3 0.000 1.000 0.000 0.000 1 0.000 0.000
#> SRR390502 3 0.000 1.000 0.000 0.000 1 0.000 0.000
#> SRR390503 3 0.000 1.000 0.000 0.000 1 0.000 0.000
#> SRR390504 3 0.000 1.000 0.000 0.000 1 0.000 0.000
#> SRR390505 1 0.472 0.708 0.764 0.032 0 0.056 0.148
#> SRR390506 1 0.472 0.708 0.764 0.032 0 0.056 0.148
#> SRR390507 2 0.000 1.000 0.000 1.000 0 0.000 0.000
#> SRR390508 2 0.000 1.000 0.000 1.000 0 0.000 0.000
#> SRR390509 2 0.000 1.000 0.000 1.000 0 0.000 0.000
#> SRR390510 2 0.000 1.000 0.000 1.000 0 0.000 0.000
#> SRR390512 2 0.000 1.000 0.000 1.000 0 0.000 0.000
#> SRR390513 2 0.000 1.000 0.000 1.000 0 0.000 0.000
#> SRR390514 2 0.000 1.000 0.000 1.000 0 0.000 0.000
#> SRR390515 1 0.314 0.758 0.796 0.000 0 0.204 0.000
#> SRR390516 3 0.000 1.000 0.000 0.000 1 0.000 0.000
#> SRR390517 2 0.000 1.000 0.000 1.000 0 0.000 0.000
#> SRR390519 5 0.539 0.937 0.144 0.192 0 0.000 0.664
#> SRR390520 4 0.345 1.000 0.000 0.000 0 0.756 0.244
#> SRR390521 4 0.345 1.000 0.000 0.000 0 0.756 0.244
#> SRR390522 4 0.345 1.000 0.000 0.000 0 0.756 0.244
#> SRR390523 4 0.345 1.000 0.000 0.000 0 0.756 0.244
#> SRR390524 1 0.314 0.758 0.796 0.000 0 0.204 0.000
#> SRR390525 1 0.314 0.758 0.796 0.000 0 0.204 0.000
#> SRR390526 1 0.238 0.780 0.904 0.044 0 0.000 0.052
#> SRR390527 1 0.238 0.780 0.904 0.044 0 0.000 0.052
#> SRR390528 1 0.315 0.759 0.856 0.092 0 0.000 0.052
#> SRR390529 1 0.472 0.708 0.764 0.032 0 0.056 0.148
#> SRR390530 1 0.314 0.758 0.796 0.000 0 0.204 0.000
#> SRR390531 1 0.314 0.758 0.796 0.000 0 0.204 0.000
#> SRR390532 1 0.315 0.759 0.856 0.092 0 0.000 0.052
#> SRR390533 1 0.214 0.783 0.916 0.032 0 0.000 0.052
#> SRR390534 1 0.214 0.783 0.916 0.032 0 0.000 0.052
#> SRR390535 1 0.214 0.783 0.916 0.032 0 0.000 0.052
#> SRR390536 5 0.578 0.964 0.144 0.252 0 0.000 0.604
#> SRR390537 5 0.578 0.964 0.144 0.252 0 0.000 0.604
#> SRR390538 1 0.472 0.708 0.764 0.032 0 0.056 0.148
#> SRR390539 1 0.472 0.708 0.764 0.032 0 0.056 0.148
#> SRR390540 1 0.472 0.708 0.764 0.032 0 0.056 0.148
#> SRR390541 1 0.472 0.708 0.764 0.032 0 0.056 0.148
#> SRR390542 2 0.000 1.000 0.000 1.000 0 0.000 0.000
#> SRR390543 2 0.000 1.000 0.000 1.000 0 0.000 0.000
#> SRR390544 2 0.000 1.000 0.000 1.000 0 0.000 0.000
#> SRR390545 2 0.000 1.000 0.000 1.000 0 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.0000 1.000 1.000 0.000 0 0.000 0.000 0
#> SRR390471 1 0.0000 1.000 1.000 0.000 0 0.000 0.000 0
#> SRR390472 1 0.0000 1.000 1.000 0.000 0 0.000 0.000 0
#> SRR390473 1 0.0000 1.000 1.000 0.000 0 0.000 0.000 0
#> SRR390474 6 0.0000 1.000 0.000 0.000 0 0.000 0.000 1
#> SRR390475 1 0.0000 1.000 1.000 0.000 0 0.000 0.000 0
#> SRR390476 1 0.0000 1.000 1.000 0.000 0 0.000 0.000 0
#> SRR390477 1 0.0000 1.000 1.000 0.000 0 0.000 0.000 0
#> SRR390478 1 0.0000 1.000 1.000 0.000 0 0.000 0.000 0
#> SRR390480 4 0.4209 0.860 0.012 0.056 0 0.740 0.192 0
#> SRR390481 4 0.4209 0.860 0.012 0.056 0 0.740 0.192 0
#> SRR390482 4 0.4209 0.860 0.012 0.056 0 0.740 0.192 0
#> SRR390483 4 0.4209 0.860 0.012 0.056 0 0.740 0.192 0
#> SRR390484 5 0.0000 0.941 0.000 0.000 0 0.000 1.000 0
#> SRR390485 5 0.0000 0.941 0.000 0.000 0 0.000 1.000 0
#> SRR390486 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0
#> SRR390487 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0
#> SRR390488 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0
#> SRR390489 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0
#> SRR390492 5 0.1349 0.967 0.000 0.056 0 0.004 0.940 0
#> SRR390493 5 0.1349 0.967 0.000 0.056 0 0.004 0.940 0
#> SRR390494 5 0.1349 0.967 0.000 0.056 0 0.004 0.940 0
#> SRR390495 5 0.1349 0.967 0.000 0.056 0 0.004 0.940 0
#> SRR390496 5 0.1349 0.967 0.000 0.056 0 0.004 0.940 0
#> SRR390497 5 0.0000 0.941 0.000 0.000 0 0.000 1.000 0
#> SRR390498 2 0.0000 1.000 0.000 1.000 0 0.000 0.000 0
#> SRR390499 4 0.4209 0.860 0.012 0.056 0 0.740 0.192 0
#> SRR390500 4 0.4209 0.860 0.012 0.056 0 0.740 0.192 0
#> SRR390501 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0
#> SRR390502 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0
#> SRR390503 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0
#> SRR390504 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0
#> SRR390505 4 0.0146 0.805 0.004 0.000 0 0.996 0.000 0
#> SRR390506 4 0.0146 0.805 0.004 0.000 0 0.996 0.000 0
#> SRR390507 2 0.0000 1.000 0.000 1.000 0 0.000 0.000 0
#> SRR390508 2 0.0000 1.000 0.000 1.000 0 0.000 0.000 0
#> SRR390509 2 0.0000 1.000 0.000 1.000 0 0.000 0.000 0
#> SRR390510 2 0.0000 1.000 0.000 1.000 0 0.000 0.000 0
#> SRR390512 2 0.0000 1.000 0.000 1.000 0 0.000 0.000 0
#> SRR390513 2 0.0000 1.000 0.000 1.000 0 0.000 0.000 0
#> SRR390514 2 0.0000 1.000 0.000 1.000 0 0.000 0.000 0
#> SRR390515 1 0.0000 1.000 1.000 0.000 0 0.000 0.000 0
#> SRR390516 3 0.0000 1.000 0.000 0.000 1 0.000 0.000 0
#> SRR390517 2 0.0000 1.000 0.000 1.000 0 0.000 0.000 0
#> SRR390519 5 0.0000 0.941 0.000 0.000 0 0.000 1.000 0
#> SRR390520 6 0.0000 1.000 0.000 0.000 0 0.000 0.000 1
#> SRR390521 6 0.0000 1.000 0.000 0.000 0 0.000 0.000 1
#> SRR390522 6 0.0000 1.000 0.000 0.000 0 0.000 0.000 1
#> SRR390523 6 0.0000 1.000 0.000 0.000 0 0.000 0.000 1
#> SRR390524 1 0.0000 1.000 1.000 0.000 0 0.000 0.000 0
#> SRR390525 1 0.0000 1.000 1.000 0.000 0 0.000 0.000 0
#> SRR390526 4 0.3515 0.868 0.016 0.012 0 0.780 0.192 0
#> SRR390527 4 0.3515 0.868 0.016 0.012 0 0.780 0.192 0
#> SRR390528 4 0.4209 0.860 0.012 0.056 0 0.740 0.192 0
#> SRR390529 4 0.0146 0.805 0.004 0.000 0 0.996 0.000 0
#> SRR390530 1 0.0000 1.000 1.000 0.000 0 0.000 0.000 0
#> SRR390531 1 0.0000 1.000 1.000 0.000 0 0.000 0.000 0
#> SRR390532 4 0.4209 0.860 0.012 0.056 0 0.740 0.192 0
#> SRR390533 4 0.3168 0.867 0.016 0.000 0 0.792 0.192 0
#> SRR390534 4 0.3168 0.867 0.016 0.000 0 0.792 0.192 0
#> SRR390535 4 0.3168 0.867 0.016 0.000 0 0.792 0.192 0
#> SRR390536 5 0.1349 0.967 0.000 0.056 0 0.004 0.940 0
#> SRR390537 5 0.1349 0.967 0.000 0.056 0 0.004 0.940 0
#> SRR390538 4 0.0146 0.805 0.004 0.000 0 0.996 0.000 0
#> SRR390539 4 0.0146 0.805 0.004 0.000 0 0.996 0.000 0
#> SRR390540 4 0.0146 0.805 0.004 0.000 0 0.996 0.000 0
#> SRR390541 4 0.0146 0.805 0.004 0.000 0 0.996 0.000 0
#> SRR390542 2 0.0000 1.000 0.000 1.000 0 0.000 0.000 0
#> SRR390543 2 0.0000 1.000 0.000 1.000 0 0.000 0.000 0
#> SRR390544 2 0.0000 1.000 0.000 1.000 0 0.000 0.000 0
#> SRR390545 2 0.0000 1.000 0.000 1.000 0 0.000 0.000 0
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
CV:kmeans
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"]
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 15244 rows and 71 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)

The plots are:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.141 0.256 0.597 0.3728 0.590 0.590
#> 3 3 0.110 0.559 0.654 0.4543 0.529 0.359
#> 4 4 0.235 0.652 0.612 0.1755 0.942 0.859
#> 5 5 0.375 0.635 0.581 0.1397 0.789 0.460
#> 6 6 0.629 0.743 0.666 0.0736 0.901 0.592
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
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.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 2 0.9998 -0.282 0.492 0.508
#> SRR390471 2 0.9998 -0.282 0.492 0.508
#> SRR390472 2 0.9998 -0.282 0.492 0.508
#> SRR390473 2 0.9998 -0.282 0.492 0.508
#> SRR390474 1 0.9754 0.377 0.592 0.408
#> SRR390475 2 0.9998 -0.282 0.492 0.508
#> SRR390476 2 0.9998 -0.282 0.492 0.508
#> SRR390477 1 0.9993 0.293 0.516 0.484
#> SRR390478 1 0.9993 0.293 0.516 0.484
#> SRR390480 1 0.8763 0.389 0.704 0.296
#> SRR390481 1 0.8763 0.389 0.704 0.296
#> SRR390482 1 0.8763 0.389 0.704 0.296
#> SRR390483 1 0.8763 0.389 0.704 0.296
#> SRR390484 1 0.9775 -0.160 0.588 0.412
#> SRR390485 1 0.9775 -0.160 0.588 0.412
#> SRR390486 1 0.0000 0.348 1.000 0.000
#> SRR390487 1 0.0000 0.348 1.000 0.000
#> SRR390488 1 0.0000 0.348 1.000 0.000
#> SRR390489 1 0.0000 0.348 1.000 0.000
#> SRR390492 1 0.9815 -0.162 0.580 0.420
#> SRR390493 1 0.9815 -0.162 0.580 0.420
#> SRR390494 1 0.9833 -0.163 0.576 0.424
#> SRR390495 1 0.9833 -0.163 0.576 0.424
#> SRR390496 1 0.9833 -0.163 0.576 0.424
#> SRR390497 1 0.9775 -0.160 0.588 0.412
#> SRR390498 2 0.9896 0.530 0.440 0.560
#> SRR390499 1 0.8763 0.389 0.704 0.296
#> SRR390500 1 0.8763 0.389 0.704 0.296
#> SRR390501 1 0.0000 0.348 1.000 0.000
#> SRR390502 1 0.0000 0.348 1.000 0.000
#> SRR390503 1 0.0000 0.348 1.000 0.000
#> SRR390504 1 0.0376 0.350 0.996 0.004
#> SRR390505 1 0.9850 0.421 0.572 0.428
#> SRR390506 1 0.9850 0.421 0.572 0.428
#> SRR390507 2 0.9896 0.530 0.440 0.560
#> SRR390508 2 0.9896 0.530 0.440 0.560
#> SRR390509 2 0.9896 0.530 0.440 0.560
#> SRR390510 2 0.9896 0.530 0.440 0.560
#> SRR390512 2 0.9896 0.530 0.440 0.560
#> SRR390513 2 0.9896 0.530 0.440 0.560
#> SRR390514 2 0.9896 0.530 0.440 0.560
#> SRR390515 2 0.9998 -0.282 0.492 0.508
#> SRR390516 1 0.0000 0.348 1.000 0.000
#> SRR390517 2 0.9896 0.530 0.440 0.560
#> SRR390519 1 0.9775 -0.160 0.588 0.412
#> SRR390520 1 0.9754 0.377 0.592 0.408
#> SRR390521 1 0.9754 0.377 0.592 0.408
#> SRR390522 1 0.9754 0.377 0.592 0.408
#> SRR390523 1 0.9754 0.377 0.592 0.408
#> SRR390524 1 0.9993 0.293 0.516 0.484
#> SRR390525 1 0.9993 0.293 0.516 0.484
#> SRR390526 1 0.9427 0.424 0.640 0.360
#> SRR390527 1 0.9427 0.424 0.640 0.360
#> SRR390528 1 0.8763 0.389 0.704 0.296
#> SRR390529 1 0.9850 0.421 0.572 0.428
#> SRR390530 1 1.0000 0.305 0.504 0.496
#> SRR390531 1 1.0000 0.305 0.504 0.496
#> SRR390532 1 0.8763 0.389 0.704 0.296
#> SRR390533 1 0.9635 0.433 0.612 0.388
#> SRR390534 1 0.9635 0.433 0.612 0.388
#> SRR390535 1 0.9635 0.433 0.612 0.388
#> SRR390536 1 0.9833 -0.163 0.576 0.424
#> SRR390537 1 0.9833 -0.163 0.576 0.424
#> SRR390538 1 0.9850 0.421 0.572 0.428
#> SRR390539 1 0.9850 0.421 0.572 0.428
#> SRR390540 1 0.9850 0.421 0.572 0.428
#> SRR390541 1 0.9850 0.421 0.572 0.428
#> SRR390542 2 0.9896 0.530 0.440 0.560
#> SRR390543 2 0.9896 0.530 0.440 0.560
#> SRR390544 2 0.9896 0.530 0.440 0.560
#> SRR390545 2 0.9896 0.530 0.440 0.560
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.532 0.496 0.824 0.072 0.104
#> SRR390471 1 0.532 0.496 0.824 0.072 0.104
#> SRR390472 1 0.532 0.496 0.824 0.072 0.104
#> SRR390473 1 0.532 0.496 0.824 0.072 0.104
#> SRR390474 1 0.779 0.372 0.632 0.084 0.284
#> SRR390475 1 0.532 0.496 0.824 0.072 0.104
#> SRR390476 1 0.532 0.496 0.824 0.072 0.104
#> SRR390477 1 0.294 0.531 0.916 0.072 0.012
#> SRR390478 1 0.294 0.531 0.916 0.072 0.012
#> SRR390480 1 0.947 0.215 0.476 0.324 0.200
#> SRR390481 1 0.947 0.215 0.476 0.324 0.200
#> SRR390482 1 0.947 0.215 0.476 0.324 0.200
#> SRR390483 1 0.947 0.215 0.476 0.324 0.200
#> SRR390484 2 0.869 0.531 0.156 0.584 0.260
#> SRR390485 2 0.869 0.531 0.156 0.584 0.260
#> SRR390486 3 0.937 0.992 0.300 0.200 0.500
#> SRR390487 3 0.937 0.992 0.300 0.200 0.500
#> SRR390488 3 0.941 0.994 0.300 0.204 0.496
#> SRR390489 3 0.941 0.994 0.300 0.204 0.496
#> SRR390492 2 0.862 0.540 0.156 0.592 0.252
#> SRR390493 2 0.862 0.540 0.156 0.592 0.252
#> SRR390494 2 0.856 0.543 0.156 0.600 0.244
#> SRR390495 2 0.856 0.543 0.156 0.600 0.244
#> SRR390496 2 0.856 0.543 0.156 0.600 0.244
#> SRR390497 2 0.869 0.531 0.156 0.584 0.260
#> SRR390498 2 0.268 0.698 0.068 0.924 0.008
#> SRR390499 1 0.947 0.215 0.476 0.324 0.200
#> SRR390500 1 0.947 0.215 0.476 0.324 0.200
#> SRR390501 3 0.941 0.994 0.300 0.204 0.496
#> SRR390502 3 0.941 0.994 0.300 0.204 0.496
#> SRR390503 3 0.937 0.992 0.300 0.200 0.500
#> SRR390504 3 0.932 0.981 0.296 0.196 0.508
#> SRR390505 1 0.858 0.487 0.604 0.172 0.224
#> SRR390506 1 0.858 0.487 0.604 0.172 0.224
#> SRR390507 2 0.268 0.699 0.068 0.924 0.008
#> SRR390508 2 0.268 0.699 0.068 0.924 0.008
#> SRR390509 2 0.268 0.699 0.068 0.924 0.008
#> SRR390510 2 0.268 0.699 0.068 0.924 0.008
#> SRR390512 2 0.226 0.700 0.068 0.932 0.000
#> SRR390513 2 0.226 0.700 0.068 0.932 0.000
#> SRR390514 2 0.226 0.700 0.068 0.932 0.000
#> SRR390515 1 0.532 0.496 0.824 0.072 0.104
#> SRR390516 3 0.941 0.994 0.300 0.204 0.496
#> SRR390517 2 0.300 0.697 0.068 0.916 0.016
#> SRR390519 2 0.869 0.531 0.156 0.584 0.260
#> SRR390520 1 0.779 0.372 0.632 0.084 0.284
#> SRR390521 1 0.779 0.372 0.632 0.084 0.284
#> SRR390522 1 0.779 0.372 0.632 0.084 0.284
#> SRR390523 1 0.779 0.372 0.632 0.084 0.284
#> SRR390524 1 0.294 0.531 0.916 0.072 0.012
#> SRR390525 1 0.294 0.531 0.916 0.072 0.012
#> SRR390526 1 0.824 0.420 0.636 0.204 0.160
#> SRR390527 1 0.824 0.420 0.636 0.204 0.160
#> SRR390528 1 0.947 0.215 0.476 0.324 0.200
#> SRR390529 1 0.858 0.487 0.604 0.172 0.224
#> SRR390530 1 0.442 0.492 0.864 0.048 0.088
#> SRR390531 1 0.442 0.492 0.864 0.048 0.088
#> SRR390532 1 0.947 0.215 0.476 0.324 0.200
#> SRR390533 1 0.853 0.441 0.612 0.188 0.200
#> SRR390534 1 0.853 0.441 0.612 0.188 0.200
#> SRR390535 1 0.853 0.441 0.612 0.188 0.200
#> SRR390536 2 0.856 0.543 0.156 0.600 0.244
#> SRR390537 2 0.856 0.543 0.156 0.600 0.244
#> SRR390538 1 0.858 0.487 0.604 0.172 0.224
#> SRR390539 1 0.858 0.487 0.604 0.172 0.224
#> SRR390540 1 0.858 0.487 0.604 0.172 0.224
#> SRR390541 1 0.858 0.487 0.604 0.172 0.224
#> SRR390542 2 0.226 0.700 0.068 0.932 0.000
#> SRR390543 2 0.226 0.700 0.068 0.932 0.000
#> SRR390544 2 0.226 0.700 0.068 0.932 0.000
#> SRR390545 2 0.226 0.700 0.068 0.932 0.000
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.7867 0.449 0.492 0.040 0.356 0.112
#> SRR390471 1 0.7867 0.449 0.492 0.040 0.356 0.112
#> SRR390472 1 0.7867 0.449 0.492 0.040 0.356 0.112
#> SRR390473 1 0.7867 0.449 0.492 0.040 0.356 0.112
#> SRR390474 1 0.8115 0.269 0.436 0.044 0.124 0.396
#> SRR390475 1 0.7867 0.449 0.492 0.040 0.356 0.112
#> SRR390476 1 0.7867 0.449 0.492 0.040 0.356 0.112
#> SRR390477 1 0.7777 0.478 0.588 0.056 0.220 0.136
#> SRR390478 1 0.7777 0.478 0.588 0.056 0.220 0.136
#> SRR390480 1 0.8362 0.246 0.544 0.224 0.088 0.144
#> SRR390481 1 0.8362 0.246 0.544 0.224 0.088 0.144
#> SRR390482 1 0.8362 0.246 0.544 0.224 0.088 0.144
#> SRR390483 1 0.8362 0.246 0.544 0.224 0.088 0.144
#> SRR390484 4 0.8852 0.990 0.172 0.364 0.072 0.392
#> SRR390485 4 0.8852 0.990 0.172 0.364 0.072 0.392
#> SRR390486 3 0.7849 0.993 0.292 0.100 0.548 0.060
#> SRR390487 3 0.7849 0.993 0.292 0.100 0.548 0.060
#> SRR390488 3 0.7647 0.994 0.292 0.100 0.560 0.048
#> SRR390489 3 0.7647 0.994 0.292 0.100 0.560 0.048
#> SRR390492 4 0.8804 0.991 0.172 0.368 0.068 0.392
#> SRR390493 4 0.8804 0.991 0.172 0.368 0.068 0.392
#> SRR390494 4 0.8755 0.992 0.172 0.372 0.064 0.392
#> SRR390495 4 0.8755 0.992 0.172 0.372 0.064 0.392
#> SRR390496 4 0.8755 0.992 0.172 0.372 0.064 0.392
#> SRR390497 4 0.8852 0.990 0.172 0.364 0.072 0.392
#> SRR390498 2 0.2495 0.947 0.012 0.924 0.028 0.036
#> SRR390499 1 0.8362 0.246 0.544 0.224 0.088 0.144
#> SRR390500 1 0.8362 0.246 0.544 0.224 0.088 0.144
#> SRR390501 3 0.7647 0.994 0.292 0.100 0.560 0.048
#> SRR390502 3 0.7647 0.994 0.292 0.100 0.560 0.048
#> SRR390503 3 0.7849 0.993 0.292 0.100 0.548 0.060
#> SRR390504 3 0.7849 0.993 0.292 0.100 0.548 0.060
#> SRR390505 1 0.4395 0.415 0.840 0.052 0.036 0.072
#> SRR390506 1 0.4395 0.415 0.840 0.052 0.036 0.072
#> SRR390507 2 0.2573 0.951 0.012 0.920 0.024 0.044
#> SRR390508 2 0.2573 0.951 0.012 0.920 0.024 0.044
#> SRR390509 2 0.2573 0.951 0.012 0.920 0.024 0.044
#> SRR390510 2 0.2573 0.951 0.012 0.920 0.024 0.044
#> SRR390512 2 0.0469 0.964 0.012 0.988 0.000 0.000
#> SRR390513 2 0.0469 0.964 0.012 0.988 0.000 0.000
#> SRR390514 2 0.0469 0.964 0.012 0.988 0.000 0.000
#> SRR390515 1 0.7867 0.449 0.492 0.040 0.356 0.112
#> SRR390516 3 0.7647 0.994 0.292 0.100 0.560 0.048
#> SRR390517 2 0.3211 0.934 0.012 0.892 0.040 0.056
#> SRR390519 4 0.8852 0.990 0.172 0.364 0.072 0.392
#> SRR390520 1 0.8115 0.269 0.436 0.044 0.124 0.396
#> SRR390521 1 0.8115 0.269 0.436 0.044 0.124 0.396
#> SRR390522 1 0.8115 0.269 0.436 0.044 0.124 0.396
#> SRR390523 1 0.8115 0.269 0.436 0.044 0.124 0.396
#> SRR390524 1 0.7777 0.478 0.588 0.056 0.220 0.136
#> SRR390525 1 0.7777 0.478 0.588 0.056 0.220 0.136
#> SRR390526 1 0.6799 0.342 0.688 0.156 0.092 0.064
#> SRR390527 1 0.6799 0.342 0.688 0.156 0.092 0.064
#> SRR390528 1 0.8362 0.246 0.544 0.224 0.088 0.144
#> SRR390529 1 0.4303 0.415 0.844 0.052 0.032 0.072
#> SRR390530 1 0.8254 0.454 0.524 0.048 0.216 0.212
#> SRR390531 1 0.8254 0.454 0.524 0.048 0.216 0.212
#> SRR390532 1 0.8362 0.246 0.544 0.224 0.088 0.144
#> SRR390533 1 0.5178 0.392 0.792 0.116 0.044 0.048
#> SRR390534 1 0.5178 0.392 0.792 0.116 0.044 0.048
#> SRR390535 1 0.5178 0.392 0.792 0.116 0.044 0.048
#> SRR390536 4 0.8755 0.992 0.172 0.372 0.064 0.392
#> SRR390537 4 0.8755 0.992 0.172 0.372 0.064 0.392
#> SRR390538 1 0.4231 0.415 0.848 0.052 0.032 0.068
#> SRR390539 1 0.4231 0.415 0.848 0.052 0.032 0.068
#> SRR390540 1 0.4231 0.415 0.848 0.052 0.032 0.068
#> SRR390541 1 0.4231 0.415 0.848 0.052 0.032 0.068
#> SRR390542 2 0.0469 0.964 0.012 0.988 0.000 0.000
#> SRR390543 2 0.0469 0.964 0.012 0.988 0.000 0.000
#> SRR390544 2 0.0469 0.964 0.012 0.988 0.000 0.000
#> SRR390545 2 0.0469 0.964 0.012 0.988 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.295 0.771 0.868 0.020 0.000 0.104 0.008
#> SRR390471 1 0.295 0.771 0.868 0.020 0.000 0.104 0.008
#> SRR390472 1 0.311 0.770 0.864 0.020 0.004 0.104 0.008
#> SRR390473 1 0.311 0.770 0.864 0.020 0.004 0.104 0.008
#> SRR390474 3 0.769 0.999 0.188 0.016 0.516 0.208 0.072
#> SRR390475 1 0.295 0.771 0.868 0.020 0.000 0.104 0.008
#> SRR390476 1 0.295 0.771 0.868 0.020 0.000 0.104 0.008
#> SRR390477 1 0.696 0.671 0.592 0.020 0.144 0.204 0.040
#> SRR390478 1 0.696 0.671 0.592 0.020 0.144 0.204 0.040
#> SRR390480 4 0.878 0.565 0.068 0.204 0.092 0.432 0.204
#> SRR390481 4 0.878 0.565 0.068 0.204 0.092 0.432 0.204
#> SRR390482 4 0.878 0.565 0.068 0.204 0.092 0.432 0.204
#> SRR390483 4 0.878 0.565 0.068 0.204 0.092 0.432 0.204
#> SRR390484 5 0.586 0.491 0.032 0.200 0.008 0.084 0.676
#> SRR390485 5 0.586 0.491 0.032 0.200 0.008 0.084 0.676
#> SRR390486 5 0.843 0.344 0.064 0.036 0.316 0.212 0.372
#> SRR390487 5 0.843 0.344 0.064 0.036 0.316 0.212 0.372
#> SRR390488 5 0.842 0.345 0.064 0.036 0.312 0.212 0.376
#> SRR390489 5 0.842 0.345 0.064 0.036 0.312 0.212 0.376
#> SRR390492 5 0.549 0.491 0.016 0.204 0.004 0.088 0.688
#> SRR390493 5 0.549 0.491 0.016 0.204 0.004 0.088 0.688
#> SRR390494 5 0.534 0.491 0.016 0.204 0.000 0.088 0.692
#> SRR390495 5 0.534 0.491 0.016 0.204 0.000 0.088 0.692
#> SRR390496 5 0.534 0.491 0.016 0.204 0.000 0.088 0.692
#> SRR390497 5 0.586 0.491 0.032 0.200 0.008 0.084 0.676
#> SRR390498 2 0.216 0.941 0.012 0.916 0.064 0.000 0.008
#> SRR390499 4 0.878 0.565 0.068 0.204 0.092 0.432 0.204
#> SRR390500 4 0.878 0.565 0.068 0.204 0.092 0.432 0.204
#> SRR390501 5 0.842 0.345 0.064 0.036 0.312 0.212 0.376
#> SRR390502 5 0.842 0.345 0.064 0.036 0.312 0.212 0.376
#> SRR390503 5 0.843 0.344 0.064 0.036 0.316 0.212 0.372
#> SRR390504 5 0.837 0.342 0.064 0.032 0.320 0.212 0.372
#> SRR390505 4 0.428 0.435 0.132 0.044 0.008 0.800 0.016
#> SRR390506 4 0.428 0.435 0.132 0.044 0.008 0.800 0.016
#> SRR390507 2 0.249 0.944 0.016 0.904 0.068 0.008 0.004
#> SRR390508 2 0.249 0.944 0.016 0.904 0.068 0.008 0.004
#> SRR390509 2 0.249 0.944 0.016 0.904 0.068 0.008 0.004
#> SRR390510 2 0.249 0.944 0.016 0.904 0.068 0.008 0.004
#> SRR390512 2 0.000 0.960 0.000 1.000 0.000 0.000 0.000
#> SRR390513 2 0.000 0.960 0.000 1.000 0.000 0.000 0.000
#> SRR390514 2 0.000 0.960 0.000 1.000 0.000 0.000 0.000
#> SRR390515 1 0.295 0.771 0.868 0.020 0.000 0.104 0.008
#> SRR390516 5 0.842 0.345 0.064 0.036 0.312 0.212 0.376
#> SRR390517 2 0.327 0.923 0.024 0.860 0.100 0.008 0.008
#> SRR390519 5 0.586 0.491 0.032 0.200 0.008 0.084 0.676
#> SRR390520 3 0.771 0.997 0.188 0.016 0.512 0.212 0.072
#> SRR390521 3 0.769 0.999 0.188 0.016 0.516 0.208 0.072
#> SRR390522 3 0.769 0.999 0.188 0.016 0.516 0.208 0.072
#> SRR390523 3 0.769 0.999 0.188 0.016 0.516 0.208 0.072
#> SRR390524 1 0.696 0.671 0.592 0.020 0.144 0.204 0.040
#> SRR390525 1 0.696 0.671 0.592 0.020 0.144 0.204 0.040
#> SRR390526 4 0.872 0.523 0.172 0.108 0.096 0.476 0.148
#> SRR390527 4 0.872 0.523 0.172 0.108 0.096 0.476 0.148
#> SRR390528 4 0.878 0.565 0.068 0.204 0.092 0.432 0.204
#> SRR390529 4 0.428 0.435 0.132 0.044 0.008 0.800 0.016
#> SRR390530 1 0.742 0.534 0.532 0.020 0.228 0.176 0.044
#> SRR390531 1 0.742 0.534 0.532 0.020 0.228 0.176 0.044
#> SRR390532 4 0.878 0.565 0.068 0.204 0.092 0.432 0.204
#> SRR390533 4 0.782 0.499 0.140 0.080 0.088 0.576 0.116
#> SRR390534 4 0.782 0.499 0.140 0.080 0.088 0.576 0.116
#> SRR390535 4 0.783 0.502 0.140 0.084 0.088 0.576 0.112
#> SRR390536 5 0.534 0.491 0.016 0.204 0.000 0.088 0.692
#> SRR390537 5 0.534 0.491 0.016 0.204 0.000 0.088 0.692
#> SRR390538 4 0.405 0.436 0.132 0.044 0.004 0.808 0.012
#> SRR390539 4 0.405 0.436 0.132 0.044 0.004 0.808 0.012
#> SRR390540 4 0.405 0.436 0.132 0.044 0.004 0.808 0.012
#> SRR390541 4 0.405 0.436 0.132 0.044 0.004 0.808 0.012
#> SRR390542 2 0.000 0.960 0.000 1.000 0.000 0.000 0.000
#> SRR390543 2 0.000 0.960 0.000 1.000 0.000 0.000 0.000
#> SRR390544 2 0.000 0.960 0.000 1.000 0.000 0.000 0.000
#> SRR390545 2 0.000 0.960 0.000 1.000 0.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.2706 0.7844 0.832 0.008 0.000 0.160 0.000 0.000
#> SRR390471 1 0.2706 0.7844 0.832 0.008 0.000 0.160 0.000 0.000
#> SRR390472 1 0.3198 0.7830 0.816 0.008 0.012 0.160 0.004 0.000
#> SRR390473 1 0.3198 0.7830 0.816 0.008 0.012 0.160 0.004 0.000
#> SRR390474 5 0.8755 0.0707 0.204 0.012 0.088 0.152 0.340 0.204
#> SRR390475 1 0.2706 0.7844 0.832 0.008 0.000 0.160 0.000 0.000
#> SRR390476 1 0.2706 0.7844 0.832 0.008 0.000 0.160 0.000 0.000
#> SRR390477 1 0.7131 0.7100 0.500 0.004 0.036 0.224 0.044 0.192
#> SRR390478 1 0.7131 0.7100 0.500 0.004 0.036 0.224 0.044 0.192
#> SRR390480 4 0.1845 0.7952 0.000 0.072 0.008 0.916 0.004 0.000
#> SRR390481 4 0.1845 0.7952 0.000 0.072 0.008 0.916 0.004 0.000
#> SRR390482 4 0.1845 0.7952 0.000 0.072 0.008 0.916 0.004 0.000
#> SRR390483 4 0.1845 0.7952 0.000 0.072 0.008 0.916 0.004 0.000
#> SRR390484 5 0.6598 0.6192 0.012 0.096 0.040 0.248 0.572 0.032
#> SRR390485 5 0.6598 0.6192 0.012 0.096 0.040 0.248 0.572 0.032
#> SRR390486 3 0.4015 0.9893 0.012 0.016 0.772 0.180 0.008 0.012
#> SRR390487 3 0.4015 0.9893 0.012 0.016 0.772 0.180 0.008 0.012
#> SRR390488 3 0.3669 0.9912 0.012 0.016 0.784 0.180 0.008 0.000
#> SRR390489 3 0.3669 0.9912 0.012 0.016 0.784 0.180 0.008 0.000
#> SRR390492 5 0.4976 0.6340 0.000 0.088 0.012 0.248 0.652 0.000
#> SRR390493 5 0.4976 0.6340 0.000 0.088 0.012 0.248 0.652 0.000
#> SRR390494 5 0.4976 0.6340 0.000 0.088 0.012 0.248 0.652 0.000
#> SRR390495 5 0.4976 0.6340 0.000 0.088 0.012 0.248 0.652 0.000
#> SRR390496 5 0.4976 0.6340 0.000 0.088 0.012 0.248 0.652 0.000
#> SRR390497 5 0.6598 0.6192 0.012 0.096 0.040 0.248 0.572 0.032
#> SRR390498 2 0.4639 0.8696 0.032 0.788 0.068 0.020 0.024 0.068
#> SRR390499 4 0.1845 0.7952 0.000 0.072 0.008 0.916 0.004 0.000
#> SRR390500 4 0.1845 0.7952 0.000 0.072 0.008 0.916 0.004 0.000
#> SRR390501 3 0.3669 0.9912 0.012 0.016 0.784 0.180 0.008 0.000
#> SRR390502 3 0.3669 0.9912 0.012 0.016 0.784 0.180 0.008 0.000
#> SRR390503 3 0.4015 0.9893 0.012 0.016 0.772 0.180 0.008 0.012
#> SRR390504 3 0.4817 0.9603 0.016 0.020 0.728 0.184 0.008 0.044
#> SRR390505 6 0.6607 0.9814 0.096 0.012 0.020 0.404 0.028 0.440
#> SRR390506 6 0.6607 0.9814 0.096 0.012 0.020 0.404 0.028 0.440
#> SRR390507 2 0.4261 0.8946 0.024 0.800 0.040 0.020 0.012 0.104
#> SRR390508 2 0.4261 0.8946 0.024 0.800 0.040 0.020 0.012 0.104
#> SRR390509 2 0.4261 0.8946 0.024 0.800 0.040 0.020 0.012 0.104
#> SRR390510 2 0.4261 0.8946 0.024 0.800 0.040 0.020 0.012 0.104
#> SRR390512 2 0.0547 0.9229 0.000 0.980 0.000 0.020 0.000 0.000
#> SRR390513 2 0.0547 0.9229 0.000 0.980 0.000 0.020 0.000 0.000
#> SRR390514 2 0.0547 0.9229 0.000 0.980 0.000 0.020 0.000 0.000
#> SRR390515 1 0.2848 0.7841 0.828 0.008 0.004 0.160 0.000 0.000
#> SRR390516 3 0.3669 0.9912 0.012 0.016 0.784 0.180 0.008 0.000
#> SRR390517 2 0.5530 0.8427 0.032 0.704 0.088 0.020 0.016 0.140
#> SRR390519 5 0.6598 0.6192 0.012 0.096 0.040 0.248 0.572 0.032
#> SRR390520 5 0.8755 0.0707 0.204 0.012 0.088 0.152 0.340 0.204
#> SRR390521 5 0.8755 0.0707 0.204 0.012 0.088 0.152 0.340 0.204
#> SRR390522 5 0.8755 0.0707 0.204 0.012 0.088 0.152 0.340 0.204
#> SRR390523 5 0.8755 0.0707 0.204 0.012 0.088 0.152 0.340 0.204
#> SRR390524 1 0.7131 0.7100 0.500 0.004 0.036 0.224 0.044 0.192
#> SRR390525 1 0.7131 0.7100 0.500 0.004 0.036 0.224 0.044 0.192
#> SRR390526 4 0.4424 0.6033 0.096 0.040 0.024 0.796 0.020 0.024
#> SRR390527 4 0.4424 0.6033 0.096 0.040 0.024 0.796 0.020 0.024
#> SRR390528 4 0.1845 0.7952 0.000 0.072 0.008 0.916 0.004 0.000
#> SRR390529 6 0.6476 0.9848 0.096 0.012 0.020 0.404 0.020 0.448
#> SRR390530 1 0.7603 0.6512 0.448 0.004 0.048 0.184 0.064 0.252
#> SRR390531 1 0.7603 0.6512 0.448 0.004 0.048 0.184 0.064 0.252
#> SRR390532 4 0.1845 0.7952 0.000 0.072 0.008 0.916 0.004 0.000
#> SRR390533 4 0.6040 0.2511 0.084 0.020 0.048 0.676 0.032 0.140
#> SRR390534 4 0.6040 0.2511 0.084 0.020 0.048 0.676 0.032 0.140
#> SRR390535 4 0.6040 0.2511 0.084 0.020 0.048 0.676 0.032 0.140
#> SRR390536 5 0.4976 0.6340 0.000 0.088 0.012 0.248 0.652 0.000
#> SRR390537 5 0.4976 0.6340 0.000 0.088 0.012 0.248 0.652 0.000
#> SRR390538 6 0.6251 0.9885 0.096 0.012 0.012 0.400 0.016 0.464
#> SRR390539 6 0.6251 0.9885 0.096 0.012 0.012 0.400 0.016 0.464
#> SRR390540 6 0.6251 0.9885 0.096 0.012 0.012 0.400 0.016 0.464
#> SRR390541 6 0.6251 0.9885 0.096 0.012 0.012 0.400 0.016 0.464
#> SRR390542 2 0.0547 0.9229 0.000 0.980 0.000 0.020 0.000 0.000
#> SRR390543 2 0.0547 0.9229 0.000 0.980 0.000 0.020 0.000 0.000
#> SRR390544 2 0.0547 0.9229 0.000 0.980 0.000 0.020 0.000 0.000
#> SRR390545 2 0.0547 0.9229 0.000 0.980 0.000 0.020 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.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
CV:skmeans
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"]
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 15244 rows and 71 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:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.775 0.904 0.950 0.4892 0.495 0.495
#> 3 3 0.598 0.718 0.834 0.3260 0.788 0.595
#> 4 4 0.634 0.620 0.679 0.1289 0.765 0.464
#> 5 5 0.808 0.897 0.920 0.0855 0.851 0.547
#> 6 6 0.867 0.877 0.907 0.0509 0.913 0.617
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
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.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.0000 0.989 1.000 0.000
#> SRR390471 1 0.0000 0.989 1.000 0.000
#> SRR390472 1 0.0000 0.989 1.000 0.000
#> SRR390473 1 0.0000 0.989 1.000 0.000
#> SRR390474 1 0.0000 0.989 1.000 0.000
#> SRR390475 1 0.0000 0.989 1.000 0.000
#> SRR390476 1 0.0000 0.989 1.000 0.000
#> SRR390477 1 0.0000 0.989 1.000 0.000
#> SRR390478 1 0.0000 0.989 1.000 0.000
#> SRR390480 1 0.2603 0.957 0.956 0.044
#> SRR390481 1 0.2603 0.957 0.956 0.044
#> SRR390482 1 0.2603 0.957 0.956 0.044
#> SRR390483 1 0.2603 0.957 0.956 0.044
#> SRR390484 2 0.0376 0.894 0.004 0.996
#> SRR390485 2 0.0376 0.894 0.004 0.996
#> SRR390486 2 0.9358 0.600 0.352 0.648
#> SRR390487 2 0.9358 0.600 0.352 0.648
#> SRR390488 2 0.9358 0.600 0.352 0.648
#> SRR390489 2 0.9358 0.600 0.352 0.648
#> SRR390492 2 0.0376 0.894 0.004 0.996
#> SRR390493 2 0.0376 0.894 0.004 0.996
#> SRR390494 2 0.0376 0.894 0.004 0.996
#> SRR390495 2 0.0376 0.894 0.004 0.996
#> SRR390496 2 0.0376 0.894 0.004 0.996
#> SRR390497 2 0.0376 0.894 0.004 0.996
#> SRR390498 2 0.0000 0.894 0.000 1.000
#> SRR390499 1 0.2603 0.957 0.956 0.044
#> SRR390500 1 0.2603 0.957 0.956 0.044
#> SRR390501 2 0.9358 0.600 0.352 0.648
#> SRR390502 2 0.9358 0.600 0.352 0.648
#> SRR390503 2 0.9358 0.600 0.352 0.648
#> SRR390504 2 0.9358 0.600 0.352 0.648
#> SRR390505 1 0.0000 0.989 1.000 0.000
#> SRR390506 1 0.0000 0.989 1.000 0.000
#> SRR390507 2 0.0000 0.894 0.000 1.000
#> SRR390508 2 0.0000 0.894 0.000 1.000
#> SRR390509 2 0.0000 0.894 0.000 1.000
#> SRR390510 2 0.0000 0.894 0.000 1.000
#> SRR390512 2 0.0000 0.894 0.000 1.000
#> SRR390513 2 0.0000 0.894 0.000 1.000
#> SRR390514 2 0.0000 0.894 0.000 1.000
#> SRR390515 1 0.0000 0.989 1.000 0.000
#> SRR390516 2 0.9358 0.600 0.352 0.648
#> SRR390517 2 0.0000 0.894 0.000 1.000
#> SRR390519 2 0.0376 0.894 0.004 0.996
#> SRR390520 1 0.0000 0.989 1.000 0.000
#> SRR390521 1 0.0000 0.989 1.000 0.000
#> SRR390522 1 0.0000 0.989 1.000 0.000
#> SRR390523 1 0.0000 0.989 1.000 0.000
#> SRR390524 1 0.0000 0.989 1.000 0.000
#> SRR390525 1 0.0000 0.989 1.000 0.000
#> SRR390526 1 0.0000 0.989 1.000 0.000
#> SRR390527 1 0.0000 0.989 1.000 0.000
#> SRR390528 1 0.2603 0.957 0.956 0.044
#> SRR390529 1 0.0000 0.989 1.000 0.000
#> SRR390530 1 0.0000 0.989 1.000 0.000
#> SRR390531 1 0.0000 0.989 1.000 0.000
#> SRR390532 1 0.2603 0.957 0.956 0.044
#> SRR390533 1 0.0000 0.989 1.000 0.000
#> SRR390534 1 0.0000 0.989 1.000 0.000
#> SRR390535 1 0.0000 0.989 1.000 0.000
#> SRR390536 2 0.0376 0.894 0.004 0.996
#> SRR390537 2 0.0376 0.894 0.004 0.996
#> SRR390538 1 0.0000 0.989 1.000 0.000
#> SRR390539 1 0.0000 0.989 1.000 0.000
#> SRR390540 1 0.0000 0.989 1.000 0.000
#> SRR390541 1 0.0000 0.989 1.000 0.000
#> SRR390542 2 0.0000 0.894 0.000 1.000
#> SRR390543 2 0.0000 0.894 0.000 1.000
#> SRR390544 2 0.0000 0.894 0.000 1.000
#> SRR390545 2 0.0000 0.894 0.000 1.000
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.0661 0.828 0.988 0.008 0.004
#> SRR390471 1 0.0661 0.828 0.988 0.008 0.004
#> SRR390472 1 0.0661 0.828 0.988 0.008 0.004
#> SRR390473 1 0.0661 0.828 0.988 0.008 0.004
#> SRR390474 1 0.4702 0.627 0.788 0.000 0.212
#> SRR390475 1 0.0661 0.828 0.988 0.008 0.004
#> SRR390476 1 0.0661 0.828 0.988 0.008 0.004
#> SRR390477 1 0.0237 0.829 0.996 0.000 0.004
#> SRR390478 1 0.0237 0.829 0.996 0.000 0.004
#> SRR390480 3 0.5988 0.542 0.368 0.000 0.632
#> SRR390481 3 0.5988 0.542 0.368 0.000 0.632
#> SRR390482 3 0.5988 0.542 0.368 0.000 0.632
#> SRR390483 3 0.5988 0.542 0.368 0.000 0.632
#> SRR390484 2 0.6008 0.719 0.000 0.628 0.372
#> SRR390485 2 0.6008 0.719 0.000 0.628 0.372
#> SRR390486 3 0.3207 0.699 0.084 0.012 0.904
#> SRR390487 3 0.3207 0.699 0.084 0.012 0.904
#> SRR390488 3 0.3207 0.699 0.084 0.012 0.904
#> SRR390489 3 0.3207 0.699 0.084 0.012 0.904
#> SRR390492 2 0.6008 0.719 0.000 0.628 0.372
#> SRR390493 2 0.6008 0.719 0.000 0.628 0.372
#> SRR390494 2 0.6008 0.719 0.000 0.628 0.372
#> SRR390495 2 0.6008 0.719 0.000 0.628 0.372
#> SRR390496 2 0.6008 0.719 0.000 0.628 0.372
#> SRR390497 2 0.6008 0.719 0.000 0.628 0.372
#> SRR390498 2 0.0000 0.805 0.000 1.000 0.000
#> SRR390499 3 0.5988 0.542 0.368 0.000 0.632
#> SRR390500 3 0.5988 0.542 0.368 0.000 0.632
#> SRR390501 3 0.3207 0.699 0.084 0.012 0.904
#> SRR390502 3 0.3207 0.699 0.084 0.012 0.904
#> SRR390503 3 0.3207 0.699 0.084 0.012 0.904
#> SRR390504 3 0.3207 0.699 0.084 0.012 0.904
#> SRR390505 1 0.3816 0.783 0.852 0.000 0.148
#> SRR390506 1 0.3816 0.783 0.852 0.000 0.148
#> SRR390507 2 0.0000 0.805 0.000 1.000 0.000
#> SRR390508 2 0.0000 0.805 0.000 1.000 0.000
#> SRR390509 2 0.0000 0.805 0.000 1.000 0.000
#> SRR390510 2 0.0000 0.805 0.000 1.000 0.000
#> SRR390512 2 0.0000 0.805 0.000 1.000 0.000
#> SRR390513 2 0.0000 0.805 0.000 1.000 0.000
#> SRR390514 2 0.0000 0.805 0.000 1.000 0.000
#> SRR390515 1 0.0661 0.828 0.988 0.008 0.004
#> SRR390516 3 0.3207 0.699 0.084 0.012 0.904
#> SRR390517 2 0.0000 0.805 0.000 1.000 0.000
#> SRR390519 2 0.6008 0.719 0.000 0.628 0.372
#> SRR390520 1 0.4702 0.627 0.788 0.000 0.212
#> SRR390521 1 0.4702 0.627 0.788 0.000 0.212
#> SRR390522 1 0.4702 0.627 0.788 0.000 0.212
#> SRR390523 1 0.4702 0.627 0.788 0.000 0.212
#> SRR390524 1 0.0237 0.829 0.996 0.000 0.004
#> SRR390525 1 0.0237 0.829 0.996 0.000 0.004
#> SRR390526 1 0.6215 0.190 0.572 0.000 0.428
#> SRR390527 1 0.6215 0.190 0.572 0.000 0.428
#> SRR390528 3 0.5988 0.542 0.368 0.000 0.632
#> SRR390529 1 0.3816 0.783 0.852 0.000 0.148
#> SRR390530 1 0.0237 0.829 0.996 0.000 0.004
#> SRR390531 1 0.0237 0.829 0.996 0.000 0.004
#> SRR390532 3 0.5988 0.542 0.368 0.000 0.632
#> SRR390533 1 0.4504 0.743 0.804 0.000 0.196
#> SRR390534 1 0.4504 0.743 0.804 0.000 0.196
#> SRR390535 1 0.4504 0.743 0.804 0.000 0.196
#> SRR390536 2 0.6008 0.719 0.000 0.628 0.372
#> SRR390537 2 0.6008 0.719 0.000 0.628 0.372
#> SRR390538 1 0.3816 0.783 0.852 0.000 0.148
#> SRR390539 1 0.3816 0.783 0.852 0.000 0.148
#> SRR390540 1 0.3816 0.783 0.852 0.000 0.148
#> SRR390541 1 0.3816 0.783 0.852 0.000 0.148
#> SRR390542 2 0.0000 0.805 0.000 1.000 0.000
#> SRR390543 2 0.0000 0.805 0.000 1.000 0.000
#> SRR390544 2 0.0000 0.805 0.000 1.000 0.000
#> SRR390545 2 0.0000 0.805 0.000 1.000 0.000
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.7253 0.374 0.520 0.000 0.308 0.172
#> SRR390471 1 0.7253 0.374 0.520 0.000 0.308 0.172
#> SRR390472 1 0.7253 0.374 0.520 0.000 0.308 0.172
#> SRR390473 1 0.7253 0.374 0.520 0.000 0.308 0.172
#> SRR390474 3 0.6904 0.205 0.312 0.000 0.556 0.132
#> SRR390475 1 0.7253 0.374 0.520 0.000 0.308 0.172
#> SRR390476 1 0.7253 0.374 0.520 0.000 0.308 0.172
#> SRR390477 1 0.7253 0.374 0.520 0.000 0.308 0.172
#> SRR390478 1 0.7253 0.374 0.520 0.000 0.308 0.172
#> SRR390480 1 0.6936 0.267 0.564 0.000 0.144 0.292
#> SRR390481 1 0.6936 0.267 0.564 0.000 0.144 0.292
#> SRR390482 1 0.6936 0.267 0.564 0.000 0.144 0.292
#> SRR390483 1 0.6936 0.267 0.564 0.000 0.144 0.292
#> SRR390484 4 0.3266 1.000 0.000 0.168 0.000 0.832
#> SRR390485 4 0.3266 1.000 0.000 0.168 0.000 0.832
#> SRR390486 3 0.4810 0.653 0.036 0.004 0.764 0.196
#> SRR390487 3 0.4810 0.653 0.036 0.004 0.764 0.196
#> SRR390488 3 0.4810 0.653 0.036 0.004 0.764 0.196
#> SRR390489 3 0.4810 0.653 0.036 0.004 0.764 0.196
#> SRR390492 4 0.3266 1.000 0.000 0.168 0.000 0.832
#> SRR390493 4 0.3266 1.000 0.000 0.168 0.000 0.832
#> SRR390494 4 0.3266 1.000 0.000 0.168 0.000 0.832
#> SRR390495 4 0.3266 1.000 0.000 0.168 0.000 0.832
#> SRR390496 4 0.3266 1.000 0.000 0.168 0.000 0.832
#> SRR390497 4 0.3266 1.000 0.000 0.168 0.000 0.832
#> SRR390498 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390499 1 0.6936 0.267 0.564 0.000 0.144 0.292
#> SRR390500 1 0.6936 0.267 0.564 0.000 0.144 0.292
#> SRR390501 3 0.4810 0.653 0.036 0.004 0.764 0.196
#> SRR390502 3 0.4810 0.653 0.036 0.004 0.764 0.196
#> SRR390503 3 0.4810 0.653 0.036 0.004 0.764 0.196
#> SRR390504 3 0.4810 0.653 0.036 0.004 0.764 0.196
#> SRR390505 1 0.0376 0.536 0.992 0.000 0.004 0.004
#> SRR390506 1 0.0376 0.536 0.992 0.000 0.004 0.004
#> SRR390507 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390508 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390509 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390510 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390512 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390513 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390514 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390515 1 0.7253 0.374 0.520 0.000 0.308 0.172
#> SRR390516 3 0.4810 0.653 0.036 0.004 0.764 0.196
#> SRR390517 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390519 4 0.3266 1.000 0.000 0.168 0.000 0.832
#> SRR390520 3 0.6904 0.205 0.312 0.000 0.556 0.132
#> SRR390521 3 0.6904 0.205 0.312 0.000 0.556 0.132
#> SRR390522 3 0.6904 0.205 0.312 0.000 0.556 0.132
#> SRR390523 3 0.6904 0.205 0.312 0.000 0.556 0.132
#> SRR390524 1 0.7253 0.374 0.520 0.000 0.308 0.172
#> SRR390525 1 0.7253 0.374 0.520 0.000 0.308 0.172
#> SRR390526 1 0.2704 0.480 0.876 0.000 0.124 0.000
#> SRR390527 1 0.2704 0.480 0.876 0.000 0.124 0.000
#> SRR390528 1 0.6936 0.267 0.564 0.000 0.144 0.292
#> SRR390529 1 0.0376 0.536 0.992 0.000 0.004 0.004
#> SRR390530 1 0.7268 0.368 0.516 0.000 0.312 0.172
#> SRR390531 1 0.7268 0.368 0.516 0.000 0.312 0.172
#> SRR390532 1 0.6936 0.267 0.564 0.000 0.144 0.292
#> SRR390533 1 0.2654 0.481 0.888 0.000 0.108 0.004
#> SRR390534 1 0.2654 0.481 0.888 0.000 0.108 0.004
#> SRR390535 1 0.2654 0.481 0.888 0.000 0.108 0.004
#> SRR390536 4 0.3266 1.000 0.000 0.168 0.000 0.832
#> SRR390537 4 0.3266 1.000 0.000 0.168 0.000 0.832
#> SRR390538 1 0.0376 0.536 0.992 0.000 0.004 0.004
#> SRR390539 1 0.0376 0.536 0.992 0.000 0.004 0.004
#> SRR390540 1 0.0376 0.536 0.992 0.000 0.004 0.004
#> SRR390541 1 0.0376 0.536 0.992 0.000 0.004 0.004
#> SRR390542 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390543 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390544 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390545 2 0.0000 1.000 0.000 1.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.0807 0.867 0.976 0.000 0.012 0.012 0.000
#> SRR390471 1 0.0807 0.867 0.976 0.000 0.012 0.012 0.000
#> SRR390472 1 0.0807 0.867 0.976 0.000 0.012 0.012 0.000
#> SRR390473 1 0.0807 0.867 0.976 0.000 0.012 0.012 0.000
#> SRR390474 1 0.6365 0.568 0.580 0.000 0.264 0.132 0.024
#> SRR390475 1 0.0807 0.867 0.976 0.000 0.012 0.012 0.000
#> SRR390476 1 0.0807 0.867 0.976 0.000 0.012 0.012 0.000
#> SRR390477 1 0.0290 0.867 0.992 0.000 0.000 0.008 0.000
#> SRR390478 1 0.0290 0.867 0.992 0.000 0.000 0.008 0.000
#> SRR390480 4 0.3849 0.836 0.020 0.000 0.036 0.820 0.124
#> SRR390481 4 0.3849 0.836 0.020 0.000 0.036 0.820 0.124
#> SRR390482 4 0.3849 0.836 0.020 0.000 0.036 0.820 0.124
#> SRR390483 4 0.3849 0.836 0.020 0.000 0.036 0.820 0.124
#> SRR390484 5 0.0510 1.000 0.000 0.016 0.000 0.000 0.984
#> SRR390485 5 0.0510 1.000 0.000 0.016 0.000 0.000 0.984
#> SRR390486 3 0.0404 1.000 0.000 0.000 0.988 0.000 0.012
#> SRR390487 3 0.0404 1.000 0.000 0.000 0.988 0.000 0.012
#> SRR390488 3 0.0404 1.000 0.000 0.000 0.988 0.000 0.012
#> SRR390489 3 0.0404 1.000 0.000 0.000 0.988 0.000 0.012
#> SRR390492 5 0.0510 1.000 0.000 0.016 0.000 0.000 0.984
#> SRR390493 5 0.0510 1.000 0.000 0.016 0.000 0.000 0.984
#> SRR390494 5 0.0510 1.000 0.000 0.016 0.000 0.000 0.984
#> SRR390495 5 0.0510 1.000 0.000 0.016 0.000 0.000 0.984
#> SRR390496 5 0.0510 1.000 0.000 0.016 0.000 0.000 0.984
#> SRR390497 5 0.0510 1.000 0.000 0.016 0.000 0.000 0.984
#> SRR390498 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390499 4 0.3849 0.836 0.020 0.000 0.036 0.820 0.124
#> SRR390500 4 0.3849 0.836 0.020 0.000 0.036 0.820 0.124
#> SRR390501 3 0.0404 1.000 0.000 0.000 0.988 0.000 0.012
#> SRR390502 3 0.0404 1.000 0.000 0.000 0.988 0.000 0.012
#> SRR390503 3 0.0404 1.000 0.000 0.000 0.988 0.000 0.012
#> SRR390504 3 0.0404 1.000 0.000 0.000 0.988 0.000 0.012
#> SRR390505 4 0.2971 0.811 0.156 0.000 0.008 0.836 0.000
#> SRR390506 4 0.2971 0.811 0.156 0.000 0.008 0.836 0.000
#> SRR390507 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390508 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390509 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390510 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390512 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390513 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390514 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390515 1 0.0807 0.867 0.976 0.000 0.012 0.012 0.000
#> SRR390516 3 0.0404 1.000 0.000 0.000 0.988 0.000 0.012
#> SRR390517 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390519 5 0.0510 1.000 0.000 0.016 0.000 0.000 0.984
#> SRR390520 1 0.6365 0.568 0.580 0.000 0.264 0.132 0.024
#> SRR390521 1 0.6365 0.568 0.580 0.000 0.264 0.132 0.024
#> SRR390522 1 0.6365 0.568 0.580 0.000 0.264 0.132 0.024
#> SRR390523 1 0.6365 0.568 0.580 0.000 0.264 0.132 0.024
#> SRR390524 1 0.0290 0.867 0.992 0.000 0.000 0.008 0.000
#> SRR390525 1 0.0290 0.867 0.992 0.000 0.000 0.008 0.000
#> SRR390526 4 0.2625 0.845 0.056 0.000 0.028 0.900 0.016
#> SRR390527 4 0.2625 0.845 0.056 0.000 0.028 0.900 0.016
#> SRR390528 4 0.3849 0.836 0.020 0.000 0.036 0.820 0.124
#> SRR390529 4 0.2971 0.811 0.156 0.000 0.008 0.836 0.000
#> SRR390530 1 0.0609 0.857 0.980 0.000 0.000 0.020 0.000
#> SRR390531 1 0.0609 0.857 0.980 0.000 0.000 0.020 0.000
#> SRR390532 4 0.3849 0.836 0.020 0.000 0.036 0.820 0.124
#> SRR390533 4 0.1670 0.838 0.052 0.000 0.012 0.936 0.000
#> SRR390534 4 0.1670 0.838 0.052 0.000 0.012 0.936 0.000
#> SRR390535 4 0.1124 0.840 0.036 0.000 0.004 0.960 0.000
#> SRR390536 5 0.0510 1.000 0.000 0.016 0.000 0.000 0.984
#> SRR390537 5 0.0510 1.000 0.000 0.016 0.000 0.000 0.984
#> SRR390538 4 0.2971 0.811 0.156 0.000 0.008 0.836 0.000
#> SRR390539 4 0.2971 0.811 0.156 0.000 0.008 0.836 0.000
#> SRR390540 4 0.2971 0.811 0.156 0.000 0.008 0.836 0.000
#> SRR390541 4 0.2971 0.811 0.156 0.000 0.008 0.836 0.000
#> SRR390542 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390543 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390544 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390545 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.0508 0.928 0.984 0.000 0.000 0.004 0.000 0.012
#> SRR390471 1 0.0508 0.928 0.984 0.000 0.000 0.004 0.000 0.012
#> SRR390472 1 0.0508 0.928 0.984 0.000 0.000 0.004 0.000 0.012
#> SRR390473 1 0.0508 0.928 0.984 0.000 0.000 0.004 0.000 0.012
#> SRR390474 6 0.6411 0.313 0.260 0.000 0.164 0.028 0.016 0.532
#> SRR390475 1 0.0508 0.928 0.984 0.000 0.000 0.004 0.000 0.012
#> SRR390476 1 0.0508 0.928 0.984 0.000 0.000 0.004 0.000 0.012
#> SRR390477 1 0.2002 0.911 0.908 0.000 0.000 0.012 0.004 0.076
#> SRR390478 1 0.2002 0.911 0.908 0.000 0.000 0.012 0.004 0.076
#> SRR390480 4 0.0806 0.986 0.000 0.000 0.008 0.972 0.020 0.000
#> SRR390481 4 0.0806 0.986 0.000 0.000 0.008 0.972 0.020 0.000
#> SRR390482 4 0.0806 0.986 0.000 0.000 0.008 0.972 0.020 0.000
#> SRR390483 4 0.0806 0.986 0.000 0.000 0.008 0.972 0.020 0.000
#> SRR390484 5 0.0508 0.994 0.000 0.004 0.000 0.000 0.984 0.012
#> SRR390485 5 0.0508 0.994 0.000 0.004 0.000 0.000 0.984 0.012
#> SRR390486 3 0.0291 0.999 0.000 0.000 0.992 0.004 0.004 0.000
#> SRR390487 3 0.0291 0.999 0.000 0.000 0.992 0.004 0.004 0.000
#> SRR390488 3 0.0291 0.999 0.000 0.000 0.992 0.004 0.004 0.000
#> SRR390489 3 0.0291 0.999 0.000 0.000 0.992 0.004 0.004 0.000
#> SRR390492 5 0.0146 0.996 0.000 0.004 0.000 0.000 0.996 0.000
#> SRR390493 5 0.0146 0.996 0.000 0.004 0.000 0.000 0.996 0.000
#> SRR390494 5 0.0146 0.996 0.000 0.004 0.000 0.000 0.996 0.000
#> SRR390495 5 0.0146 0.996 0.000 0.004 0.000 0.000 0.996 0.000
#> SRR390496 5 0.0146 0.996 0.000 0.004 0.000 0.000 0.996 0.000
#> SRR390497 5 0.0508 0.994 0.000 0.004 0.000 0.000 0.984 0.012
#> SRR390498 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390499 4 0.0806 0.986 0.000 0.000 0.008 0.972 0.020 0.000
#> SRR390500 4 0.0806 0.986 0.000 0.000 0.008 0.972 0.020 0.000
#> SRR390501 3 0.0291 0.999 0.000 0.000 0.992 0.004 0.004 0.000
#> SRR390502 3 0.0291 0.999 0.000 0.000 0.992 0.004 0.004 0.000
#> SRR390503 3 0.0291 0.999 0.000 0.000 0.992 0.004 0.004 0.000
#> SRR390504 3 0.0146 0.995 0.000 0.000 0.996 0.000 0.004 0.000
#> SRR390505 6 0.4407 0.627 0.076 0.000 0.000 0.232 0.000 0.692
#> SRR390506 6 0.4407 0.627 0.076 0.000 0.000 0.232 0.000 0.692
#> SRR390507 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390508 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390509 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390510 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390512 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390513 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390514 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390515 1 0.0508 0.928 0.984 0.000 0.000 0.004 0.000 0.012
#> SRR390516 3 0.0291 0.999 0.000 0.000 0.992 0.004 0.004 0.000
#> SRR390517 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390519 5 0.0508 0.994 0.000 0.004 0.000 0.000 0.984 0.012
#> SRR390520 6 0.6411 0.313 0.260 0.000 0.164 0.028 0.016 0.532
#> SRR390521 6 0.6411 0.313 0.260 0.000 0.164 0.028 0.016 0.532
#> SRR390522 6 0.6411 0.313 0.260 0.000 0.164 0.028 0.016 0.532
#> SRR390523 6 0.6411 0.313 0.260 0.000 0.164 0.028 0.016 0.532
#> SRR390524 1 0.2002 0.911 0.908 0.000 0.000 0.012 0.004 0.076
#> SRR390525 1 0.2002 0.911 0.908 0.000 0.000 0.012 0.004 0.076
#> SRR390526 4 0.1364 0.942 0.004 0.000 0.004 0.944 0.000 0.048
#> SRR390527 4 0.1364 0.942 0.004 0.000 0.004 0.944 0.000 0.048
#> SRR390528 4 0.0806 0.986 0.000 0.000 0.008 0.972 0.020 0.000
#> SRR390529 6 0.4407 0.627 0.076 0.000 0.000 0.232 0.000 0.692
#> SRR390530 1 0.3053 0.829 0.812 0.000 0.000 0.012 0.004 0.172
#> SRR390531 1 0.3053 0.829 0.812 0.000 0.000 0.012 0.004 0.172
#> SRR390532 4 0.0806 0.986 0.000 0.000 0.008 0.972 0.020 0.000
#> SRR390533 6 0.2902 0.591 0.000 0.000 0.004 0.196 0.000 0.800
#> SRR390534 6 0.2902 0.591 0.000 0.000 0.004 0.196 0.000 0.800
#> SRR390535 6 0.2902 0.591 0.000 0.000 0.004 0.196 0.000 0.800
#> SRR390536 5 0.0146 0.996 0.000 0.004 0.000 0.000 0.996 0.000
#> SRR390537 5 0.0146 0.996 0.000 0.004 0.000 0.000 0.996 0.000
#> SRR390538 6 0.4407 0.627 0.076 0.000 0.000 0.232 0.000 0.692
#> SRR390539 6 0.4407 0.627 0.076 0.000 0.000 0.232 0.000 0.692
#> SRR390540 6 0.4407 0.627 0.076 0.000 0.000 0.232 0.000 0.692
#> SRR390541 6 0.4407 0.627 0.076 0.000 0.000 0.232 0.000 0.692
#> SRR390542 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390543 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390544 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390545 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
CV:pam*
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"]
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 15244 rows and 71 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 5.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)

The plots are:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.3041 0.697 0.697
#> 3 3 1.000 1.000 1.000 0.5830 0.823 0.745
#> 4 4 0.743 0.732 0.844 0.4171 0.812 0.637
#> 5 5 0.910 0.908 0.958 0.1527 0.862 0.590
#> 6 6 0.870 0.876 0.911 0.0467 0.971 0.858
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
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.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0 1 1 0
#> SRR390471 1 0 1 1 0
#> SRR390472 1 0 1 1 0
#> SRR390473 1 0 1 1 0
#> SRR390474 1 0 1 1 0
#> SRR390475 1 0 1 1 0
#> SRR390476 1 0 1 1 0
#> SRR390477 1 0 1 1 0
#> SRR390478 1 0 1 1 0
#> SRR390480 1 0 1 1 0
#> SRR390481 1 0 1 1 0
#> SRR390482 1 0 1 1 0
#> SRR390483 1 0 1 1 0
#> SRR390484 1 0 1 1 0
#> SRR390485 1 0 1 1 0
#> SRR390486 1 0 1 1 0
#> SRR390487 1 0 1 1 0
#> SRR390488 1 0 1 1 0
#> SRR390489 1 0 1 1 0
#> SRR390492 1 0 1 1 0
#> SRR390493 1 0 1 1 0
#> SRR390494 1 0 1 1 0
#> SRR390495 1 0 1 1 0
#> SRR390496 1 0 1 1 0
#> SRR390497 1 0 1 1 0
#> SRR390498 2 0 1 0 1
#> SRR390499 1 0 1 1 0
#> SRR390500 1 0 1 1 0
#> SRR390501 1 0 1 1 0
#> SRR390502 1 0 1 1 0
#> SRR390503 1 0 1 1 0
#> SRR390504 1 0 1 1 0
#> SRR390505 1 0 1 1 0
#> SRR390506 1 0 1 1 0
#> SRR390507 2 0 1 0 1
#> SRR390508 2 0 1 0 1
#> SRR390509 2 0 1 0 1
#> SRR390510 2 0 1 0 1
#> SRR390512 2 0 1 0 1
#> SRR390513 2 0 1 0 1
#> SRR390514 2 0 1 0 1
#> SRR390515 1 0 1 1 0
#> SRR390516 1 0 1 1 0
#> SRR390517 2 0 1 0 1
#> SRR390519 1 0 1 1 0
#> SRR390520 1 0 1 1 0
#> SRR390521 1 0 1 1 0
#> SRR390522 1 0 1 1 0
#> SRR390523 1 0 1 1 0
#> SRR390524 1 0 1 1 0
#> SRR390525 1 0 1 1 0
#> SRR390526 1 0 1 1 0
#> SRR390527 1 0 1 1 0
#> SRR390528 1 0 1 1 0
#> SRR390529 1 0 1 1 0
#> SRR390530 1 0 1 1 0
#> SRR390531 1 0 1 1 0
#> SRR390532 1 0 1 1 0
#> SRR390533 1 0 1 1 0
#> SRR390534 1 0 1 1 0
#> SRR390535 1 0 1 1 0
#> SRR390536 1 0 1 1 0
#> SRR390537 1 0 1 1 0
#> SRR390538 1 0 1 1 0
#> SRR390539 1 0 1 1 0
#> SRR390540 1 0 1 1 0
#> SRR390541 1 0 1 1 0
#> SRR390542 2 0 1 0 1
#> SRR390543 2 0 1 0 1
#> SRR390544 2 0 1 0 1
#> SRR390545 2 0 1 0 1
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0 1 1 0 0
#> SRR390471 1 0 1 1 0 0
#> SRR390472 1 0 1 1 0 0
#> SRR390473 1 0 1 1 0 0
#> SRR390474 1 0 1 1 0 0
#> SRR390475 1 0 1 1 0 0
#> SRR390476 1 0 1 1 0 0
#> SRR390477 1 0 1 1 0 0
#> SRR390478 1 0 1 1 0 0
#> SRR390480 1 0 1 1 0 0
#> SRR390481 1 0 1 1 0 0
#> SRR390482 1 0 1 1 0 0
#> SRR390483 1 0 1 1 0 0
#> SRR390484 1 0 1 1 0 0
#> SRR390485 1 0 1 1 0 0
#> SRR390486 3 0 1 0 0 1
#> SRR390487 3 0 1 0 0 1
#> SRR390488 3 0 1 0 0 1
#> SRR390489 3 0 1 0 0 1
#> SRR390492 1 0 1 1 0 0
#> SRR390493 1 0 1 1 0 0
#> SRR390494 1 0 1 1 0 0
#> SRR390495 1 0 1 1 0 0
#> SRR390496 1 0 1 1 0 0
#> SRR390497 1 0 1 1 0 0
#> SRR390498 2 0 1 0 1 0
#> SRR390499 1 0 1 1 0 0
#> SRR390500 1 0 1 1 0 0
#> SRR390501 3 0 1 0 0 1
#> SRR390502 3 0 1 0 0 1
#> SRR390503 3 0 1 0 0 1
#> SRR390504 3 0 1 0 0 1
#> SRR390505 1 0 1 1 0 0
#> SRR390506 1 0 1 1 0 0
#> SRR390507 2 0 1 0 1 0
#> SRR390508 2 0 1 0 1 0
#> SRR390509 2 0 1 0 1 0
#> SRR390510 2 0 1 0 1 0
#> SRR390512 2 0 1 0 1 0
#> SRR390513 2 0 1 0 1 0
#> SRR390514 2 0 1 0 1 0
#> SRR390515 1 0 1 1 0 0
#> SRR390516 3 0 1 0 0 1
#> SRR390517 2 0 1 0 1 0
#> SRR390519 1 0 1 1 0 0
#> SRR390520 1 0 1 1 0 0
#> SRR390521 1 0 1 1 0 0
#> SRR390522 1 0 1 1 0 0
#> SRR390523 1 0 1 1 0 0
#> SRR390524 1 0 1 1 0 0
#> SRR390525 1 0 1 1 0 0
#> SRR390526 1 0 1 1 0 0
#> SRR390527 1 0 1 1 0 0
#> SRR390528 1 0 1 1 0 0
#> SRR390529 1 0 1 1 0 0
#> SRR390530 1 0 1 1 0 0
#> SRR390531 1 0 1 1 0 0
#> SRR390532 1 0 1 1 0 0
#> SRR390533 1 0 1 1 0 0
#> SRR390534 1 0 1 1 0 0
#> SRR390535 1 0 1 1 0 0
#> SRR390536 1 0 1 1 0 0
#> SRR390537 1 0 1 1 0 0
#> SRR390538 1 0 1 1 0 0
#> SRR390539 1 0 1 1 0 0
#> SRR390540 1 0 1 1 0 0
#> SRR390541 1 0 1 1 0 0
#> SRR390542 2 0 1 0 1 0
#> SRR390543 2 0 1 0 1 0
#> SRR390544 2 0 1 0 1 0
#> SRR390545 2 0 1 0 1 0
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.000 0.5789 1.000 0 0 0.000
#> SRR390471 1 0.000 0.5789 1.000 0 0 0.000
#> SRR390472 1 0.000 0.5789 1.000 0 0 0.000
#> SRR390473 1 0.000 0.5789 1.000 0 0 0.000
#> SRR390474 1 0.438 0.2363 0.704 0 0 0.296
#> SRR390475 1 0.000 0.5789 1.000 0 0 0.000
#> SRR390476 1 0.000 0.5789 1.000 0 0 0.000
#> SRR390477 1 0.000 0.5789 1.000 0 0 0.000
#> SRR390478 1 0.000 0.5789 1.000 0 0 0.000
#> SRR390480 1 0.496 0.6001 0.552 0 0 0.448
#> SRR390481 1 0.496 0.6001 0.552 0 0 0.448
#> SRR390482 1 0.496 0.6001 0.552 0 0 0.448
#> SRR390483 1 0.496 0.6001 0.552 0 0 0.448
#> SRR390484 4 0.000 0.8983 0.000 0 0 1.000
#> SRR390485 4 0.000 0.8983 0.000 0 0 1.000
#> SRR390486 3 0.000 1.0000 0.000 0 1 0.000
#> SRR390487 3 0.000 1.0000 0.000 0 1 0.000
#> SRR390488 3 0.000 1.0000 0.000 0 1 0.000
#> SRR390489 3 0.000 1.0000 0.000 0 1 0.000
#> SRR390492 4 0.000 0.8983 0.000 0 0 1.000
#> SRR390493 4 0.000 0.8983 0.000 0 0 1.000
#> SRR390494 4 0.000 0.8983 0.000 0 0 1.000
#> SRR390495 4 0.000 0.8983 0.000 0 0 1.000
#> SRR390496 4 0.000 0.8983 0.000 0 0 1.000
#> SRR390497 4 0.000 0.8983 0.000 0 0 1.000
#> SRR390498 2 0.000 1.0000 0.000 1 0 0.000
#> SRR390499 1 0.496 0.6001 0.552 0 0 0.448
#> SRR390500 1 0.496 0.6001 0.552 0 0 0.448
#> SRR390501 3 0.000 1.0000 0.000 0 1 0.000
#> SRR390502 3 0.000 1.0000 0.000 0 1 0.000
#> SRR390503 3 0.000 1.0000 0.000 0 1 0.000
#> SRR390504 3 0.000 1.0000 0.000 0 1 0.000
#> SRR390505 1 0.496 0.6001 0.552 0 0 0.448
#> SRR390506 1 0.496 0.6001 0.552 0 0 0.448
#> SRR390507 2 0.000 1.0000 0.000 1 0 0.000
#> SRR390508 2 0.000 1.0000 0.000 1 0 0.000
#> SRR390509 2 0.000 1.0000 0.000 1 0 0.000
#> SRR390510 2 0.000 1.0000 0.000 1 0 0.000
#> SRR390512 2 0.000 1.0000 0.000 1 0 0.000
#> SRR390513 2 0.000 1.0000 0.000 1 0 0.000
#> SRR390514 2 0.000 1.0000 0.000 1 0 0.000
#> SRR390515 1 0.000 0.5789 1.000 0 0 0.000
#> SRR390516 3 0.000 1.0000 0.000 0 1 0.000
#> SRR390517 2 0.000 1.0000 0.000 1 0 0.000
#> SRR390519 4 0.000 0.8983 0.000 0 0 1.000
#> SRR390520 1 0.265 0.5145 0.880 0 0 0.120
#> SRR390521 4 0.490 0.0250 0.416 0 0 0.584
#> SRR390522 1 0.500 0.0310 0.508 0 0 0.492
#> SRR390523 4 0.500 0.0227 0.496 0 0 0.504
#> SRR390524 1 0.000 0.5789 1.000 0 0 0.000
#> SRR390525 1 0.000 0.5789 1.000 0 0 0.000
#> SRR390526 1 0.496 0.6001 0.552 0 0 0.448
#> SRR390527 1 0.496 0.6001 0.552 0 0 0.448
#> SRR390528 1 0.496 0.6001 0.552 0 0 0.448
#> SRR390529 1 0.496 0.6001 0.552 0 0 0.448
#> SRR390530 1 0.292 0.4450 0.860 0 0 0.140
#> SRR390531 1 0.297 0.4396 0.856 0 0 0.144
#> SRR390532 1 0.496 0.6001 0.552 0 0 0.448
#> SRR390533 1 0.496 0.6001 0.552 0 0 0.448
#> SRR390534 1 0.496 0.6001 0.552 0 0 0.448
#> SRR390535 1 0.496 0.6001 0.552 0 0 0.448
#> SRR390536 4 0.000 0.8983 0.000 0 0 1.000
#> SRR390537 4 0.000 0.8983 0.000 0 0 1.000
#> SRR390538 1 0.496 0.6001 0.552 0 0 0.448
#> SRR390539 1 0.496 0.6001 0.552 0 0 0.448
#> SRR390540 1 0.496 0.6001 0.552 0 0 0.448
#> SRR390541 1 0.496 0.6001 0.552 0 0 0.448
#> SRR390542 2 0.000 1.0000 0.000 1 0 0.000
#> SRR390543 2 0.000 1.0000 0.000 1 0 0.000
#> SRR390544 2 0.000 1.0000 0.000 1 0 0.000
#> SRR390545 2 0.000 1.0000 0.000 1 0 0.000
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.000 0.844 1.000 0 0 0.000 0.000
#> SRR390471 1 0.000 0.844 1.000 0 0 0.000 0.000
#> SRR390472 1 0.000 0.844 1.000 0 0 0.000 0.000
#> SRR390473 1 0.000 0.844 1.000 0 0 0.000 0.000
#> SRR390474 1 0.673 0.194 0.400 0 0 0.256 0.344
#> SRR390475 1 0.000 0.844 1.000 0 0 0.000 0.000
#> SRR390476 1 0.000 0.844 1.000 0 0 0.000 0.000
#> SRR390477 1 0.300 0.822 0.812 0 0 0.188 0.000
#> SRR390478 1 0.285 0.834 0.828 0 0 0.172 0.000
#> SRR390480 4 0.000 0.971 0.000 0 0 1.000 0.000
#> SRR390481 4 0.000 0.971 0.000 0 0 1.000 0.000
#> SRR390482 4 0.000 0.971 0.000 0 0 1.000 0.000
#> SRR390483 4 0.000 0.971 0.000 0 0 1.000 0.000
#> SRR390484 5 0.000 0.927 0.000 0 0 0.000 1.000
#> SRR390485 5 0.000 0.927 0.000 0 0 0.000 1.000
#> SRR390486 3 0.000 1.000 0.000 0 1 0.000 0.000
#> SRR390487 3 0.000 1.000 0.000 0 1 0.000 0.000
#> SRR390488 3 0.000 1.000 0.000 0 1 0.000 0.000
#> SRR390489 3 0.000 1.000 0.000 0 1 0.000 0.000
#> SRR390492 5 0.000 0.927 0.000 0 0 0.000 1.000
#> SRR390493 5 0.000 0.927 0.000 0 0 0.000 1.000
#> SRR390494 5 0.000 0.927 0.000 0 0 0.000 1.000
#> SRR390495 5 0.000 0.927 0.000 0 0 0.000 1.000
#> SRR390496 5 0.000 0.927 0.000 0 0 0.000 1.000
#> SRR390497 5 0.000 0.927 0.000 0 0 0.000 1.000
#> SRR390498 2 0.000 1.000 0.000 1 0 0.000 0.000
#> SRR390499 4 0.000 0.971 0.000 0 0 1.000 0.000
#> SRR390500 4 0.000 0.971 0.000 0 0 1.000 0.000
#> SRR390501 3 0.000 1.000 0.000 0 1 0.000 0.000
#> SRR390502 3 0.000 1.000 0.000 0 1 0.000 0.000
#> SRR390503 3 0.000 1.000 0.000 0 1 0.000 0.000
#> SRR390504 3 0.000 1.000 0.000 0 1 0.000 0.000
#> SRR390505 4 0.000 0.971 0.000 0 0 1.000 0.000
#> SRR390506 4 0.000 0.971 0.000 0 0 1.000 0.000
#> SRR390507 2 0.000 1.000 0.000 1 0 0.000 0.000
#> SRR390508 2 0.000 1.000 0.000 1 0 0.000 0.000
#> SRR390509 2 0.000 1.000 0.000 1 0 0.000 0.000
#> SRR390510 2 0.000 1.000 0.000 1 0 0.000 0.000
#> SRR390512 2 0.000 1.000 0.000 1 0 0.000 0.000
#> SRR390513 2 0.000 1.000 0.000 1 0 0.000 0.000
#> SRR390514 2 0.000 1.000 0.000 1 0 0.000 0.000
#> SRR390515 1 0.000 0.844 1.000 0 0 0.000 0.000
#> SRR390516 3 0.000 1.000 0.000 0 1 0.000 0.000
#> SRR390517 2 0.000 1.000 0.000 1 0 0.000 0.000
#> SRR390519 5 0.000 0.927 0.000 0 0 0.000 1.000
#> SRR390520 4 0.551 -0.217 0.456 0 0 0.480 0.064
#> SRR390521 5 0.346 0.703 0.004 0 0 0.224 0.772
#> SRR390522 5 0.432 0.653 0.036 0 0 0.240 0.724
#> SRR390523 5 0.443 0.675 0.060 0 0 0.200 0.740
#> SRR390524 1 0.285 0.834 0.828 0 0 0.172 0.000
#> SRR390525 1 0.285 0.834 0.828 0 0 0.172 0.000
#> SRR390526 4 0.000 0.971 0.000 0 0 1.000 0.000
#> SRR390527 4 0.000 0.971 0.000 0 0 1.000 0.000
#> SRR390528 4 0.000 0.971 0.000 0 0 1.000 0.000
#> SRR390529 4 0.000 0.971 0.000 0 0 1.000 0.000
#> SRR390530 1 0.355 0.819 0.796 0 0 0.184 0.020
#> SRR390531 1 0.381 0.813 0.784 0 0 0.184 0.032
#> SRR390532 4 0.000 0.971 0.000 0 0 1.000 0.000
#> SRR390533 4 0.000 0.971 0.000 0 0 1.000 0.000
#> SRR390534 4 0.000 0.971 0.000 0 0 1.000 0.000
#> SRR390535 4 0.000 0.971 0.000 0 0 1.000 0.000
#> SRR390536 5 0.000 0.927 0.000 0 0 0.000 1.000
#> SRR390537 5 0.000 0.927 0.000 0 0 0.000 1.000
#> SRR390538 4 0.000 0.971 0.000 0 0 1.000 0.000
#> SRR390539 4 0.000 0.971 0.000 0 0 1.000 0.000
#> SRR390540 4 0.000 0.971 0.000 0 0 1.000 0.000
#> SRR390541 4 0.000 0.971 0.000 0 0 1.000 0.000
#> SRR390542 2 0.000 1.000 0.000 1 0 0.000 0.000
#> SRR390543 2 0.000 1.000 0.000 1 0 0.000 0.000
#> SRR390544 2 0.000 1.000 0.000 1 0 0.000 0.000
#> SRR390545 2 0.000 1.000 0.000 1 0 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.000 0.861 1.000 0 0.000 0.000 0.000 0.000
#> SRR390471 1 0.000 0.861 1.000 0 0.000 0.000 0.000 0.000
#> SRR390472 1 0.000 0.861 1.000 0 0.000 0.000 0.000 0.000
#> SRR390473 1 0.000 0.861 1.000 0 0.000 0.000 0.000 0.000
#> SRR390474 6 0.531 0.899 0.000 0 0.000 0.228 0.176 0.596
#> SRR390475 1 0.000 0.861 1.000 0 0.000 0.000 0.000 0.000
#> SRR390476 1 0.000 0.861 1.000 0 0.000 0.000 0.000 0.000
#> SRR390477 1 0.245 0.793 0.840 0 0.000 0.160 0.000 0.000
#> SRR390478 1 0.214 0.819 0.872 0 0.000 0.128 0.000 0.000
#> SRR390480 4 0.000 0.805 0.000 0 0.000 1.000 0.000 0.000
#> SRR390481 4 0.000 0.805 0.000 0 0.000 1.000 0.000 0.000
#> SRR390482 4 0.000 0.805 0.000 0 0.000 1.000 0.000 0.000
#> SRR390483 4 0.000 0.805 0.000 0 0.000 1.000 0.000 0.000
#> SRR390484 5 0.000 1.000 0.000 0 0.000 0.000 1.000 0.000
#> SRR390485 5 0.000 1.000 0.000 0 0.000 0.000 1.000 0.000
#> SRR390486 3 0.377 1.000 0.000 0 0.596 0.000 0.000 0.404
#> SRR390487 3 0.377 1.000 0.000 0 0.596 0.000 0.000 0.404
#> SRR390488 3 0.377 1.000 0.000 0 0.596 0.000 0.000 0.404
#> SRR390489 3 0.377 1.000 0.000 0 0.596 0.000 0.000 0.404
#> SRR390492 5 0.000 1.000 0.000 0 0.000 0.000 1.000 0.000
#> SRR390493 5 0.000 1.000 0.000 0 0.000 0.000 1.000 0.000
#> SRR390494 5 0.000 1.000 0.000 0 0.000 0.000 1.000 0.000
#> SRR390495 5 0.000 1.000 0.000 0 0.000 0.000 1.000 0.000
#> SRR390496 5 0.000 1.000 0.000 0 0.000 0.000 1.000 0.000
#> SRR390497 5 0.000 1.000 0.000 0 0.000 0.000 1.000 0.000
#> SRR390498 2 0.000 1.000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390499 4 0.000 0.805 0.000 0 0.000 1.000 0.000 0.000
#> SRR390500 4 0.000 0.805 0.000 0 0.000 1.000 0.000 0.000
#> SRR390501 3 0.377 1.000 0.000 0 0.596 0.000 0.000 0.404
#> SRR390502 3 0.377 1.000 0.000 0 0.596 0.000 0.000 0.404
#> SRR390503 3 0.377 1.000 0.000 0 0.596 0.000 0.000 0.404
#> SRR390504 3 0.377 1.000 0.000 0 0.596 0.000 0.000 0.404
#> SRR390505 4 0.377 0.648 0.000 0 0.404 0.596 0.000 0.000
#> SRR390506 4 0.377 0.648 0.000 0 0.404 0.596 0.000 0.000
#> SRR390507 2 0.000 1.000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390508 2 0.000 1.000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390509 2 0.000 1.000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390510 2 0.000 1.000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390512 2 0.000 1.000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390513 2 0.000 1.000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390514 2 0.000 1.000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390515 1 0.000 0.861 1.000 0 0.000 0.000 0.000 0.000
#> SRR390516 3 0.377 1.000 0.000 0 0.596 0.000 0.000 0.404
#> SRR390517 2 0.000 1.000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390519 5 0.000 1.000 0.000 0 0.000 0.000 1.000 0.000
#> SRR390520 6 0.444 0.723 0.000 0 0.000 0.368 0.036 0.596
#> SRR390521 6 0.533 0.901 0.000 0 0.000 0.192 0.212 0.596
#> SRR390522 6 0.533 0.906 0.000 0 0.000 0.204 0.200 0.596
#> SRR390523 6 0.530 0.875 0.000 0 0.000 0.172 0.232 0.596
#> SRR390524 1 0.222 0.814 0.864 0 0.000 0.136 0.000 0.000
#> SRR390525 1 0.230 0.808 0.856 0 0.000 0.144 0.000 0.000
#> SRR390526 4 0.000 0.805 0.000 0 0.000 1.000 0.000 0.000
#> SRR390527 4 0.000 0.805 0.000 0 0.000 1.000 0.000 0.000
#> SRR390528 4 0.000 0.805 0.000 0 0.000 1.000 0.000 0.000
#> SRR390529 4 0.377 0.648 0.000 0 0.404 0.596 0.000 0.000
#> SRR390530 1 0.648 0.014 0.444 0 0.000 0.152 0.048 0.356
#> SRR390531 1 0.524 0.623 0.688 0 0.000 0.156 0.056 0.100
#> SRR390532 4 0.000 0.805 0.000 0 0.000 1.000 0.000 0.000
#> SRR390533 4 0.000 0.805 0.000 0 0.000 1.000 0.000 0.000
#> SRR390534 4 0.000 0.805 0.000 0 0.000 1.000 0.000 0.000
#> SRR390535 4 0.000 0.805 0.000 0 0.000 1.000 0.000 0.000
#> SRR390536 5 0.000 1.000 0.000 0 0.000 0.000 1.000 0.000
#> SRR390537 5 0.000 1.000 0.000 0 0.000 0.000 1.000 0.000
#> SRR390538 4 0.377 0.648 0.000 0 0.404 0.596 0.000 0.000
#> SRR390539 4 0.377 0.648 0.000 0 0.404 0.596 0.000 0.000
#> SRR390540 4 0.377 0.648 0.000 0 0.404 0.596 0.000 0.000
#> SRR390541 4 0.377 0.648 0.000 0 0.404 0.596 0.000 0.000
#> SRR390542 2 0.000 1.000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390543 2 0.000 1.000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390544 2 0.000 1.000 0.000 1 0.000 0.000 0.000 0.000
#> SRR390545 2 0.000 1.000 0.000 1 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
CV:mclust
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"]
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 15244 rows and 71 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'CV' method.
#> Subgroups are detected by 'mclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 4.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)

The plots are:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.526 0.908 0.925 0.3512 0.697 0.697
#> 3 3 0.432 0.553 0.760 0.7382 0.681 0.542
#> 4 4 0.621 0.844 0.864 0.1267 0.847 0.626
#> 5 5 0.664 0.767 0.803 0.1262 0.913 0.700
#> 6 6 0.860 0.841 0.848 0.0627 0.965 0.825
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
suggest_best_k(res)
#> [1] 4
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.0376 0.904 0.996 0.004
#> SRR390471 1 0.0376 0.904 0.996 0.004
#> SRR390472 1 0.0376 0.904 0.996 0.004
#> SRR390473 1 0.0376 0.904 0.996 0.004
#> SRR390474 1 0.0672 0.905 0.992 0.008
#> SRR390475 1 0.0376 0.904 0.996 0.004
#> SRR390476 1 0.0376 0.904 0.996 0.004
#> SRR390477 1 0.0376 0.904 0.996 0.004
#> SRR390478 1 0.0376 0.904 0.996 0.004
#> SRR390480 1 0.5629 0.895 0.868 0.132
#> SRR390481 1 0.5629 0.895 0.868 0.132
#> SRR390482 1 0.5629 0.895 0.868 0.132
#> SRR390483 1 0.5629 0.895 0.868 0.132
#> SRR390484 1 0.7219 0.855 0.800 0.200
#> SRR390485 1 0.7219 0.855 0.800 0.200
#> SRR390486 1 0.4161 0.871 0.916 0.084
#> SRR390487 1 0.4161 0.871 0.916 0.084
#> SRR390488 1 0.4161 0.871 0.916 0.084
#> SRR390489 1 0.4161 0.871 0.916 0.084
#> SRR390492 1 0.7219 0.855 0.800 0.200
#> SRR390493 1 0.7219 0.855 0.800 0.200
#> SRR390494 1 0.7219 0.855 0.800 0.200
#> SRR390495 1 0.7219 0.855 0.800 0.200
#> SRR390496 1 0.7219 0.855 0.800 0.200
#> SRR390497 1 0.7219 0.855 0.800 0.200
#> SRR390498 2 0.0000 1.000 0.000 1.000
#> SRR390499 1 0.5629 0.895 0.868 0.132
#> SRR390500 1 0.5629 0.895 0.868 0.132
#> SRR390501 1 0.4161 0.871 0.916 0.084
#> SRR390502 1 0.4161 0.871 0.916 0.084
#> SRR390503 1 0.4161 0.871 0.916 0.084
#> SRR390504 1 0.4161 0.871 0.916 0.084
#> SRR390505 1 0.5737 0.897 0.864 0.136
#> SRR390506 1 0.5737 0.897 0.864 0.136
#> SRR390507 2 0.0000 1.000 0.000 1.000
#> SRR390508 2 0.0000 1.000 0.000 1.000
#> SRR390509 2 0.0000 1.000 0.000 1.000
#> SRR390510 2 0.0000 1.000 0.000 1.000
#> SRR390512 2 0.0000 1.000 0.000 1.000
#> SRR390513 2 0.0000 1.000 0.000 1.000
#> SRR390514 2 0.0000 1.000 0.000 1.000
#> SRR390515 1 0.0376 0.904 0.996 0.004
#> SRR390516 1 0.4161 0.871 0.916 0.084
#> SRR390517 2 0.0000 1.000 0.000 1.000
#> SRR390519 1 0.7219 0.855 0.800 0.200
#> SRR390520 1 0.0672 0.905 0.992 0.008
#> SRR390521 1 0.0672 0.905 0.992 0.008
#> SRR390522 1 0.0672 0.905 0.992 0.008
#> SRR390523 1 0.0672 0.905 0.992 0.008
#> SRR390524 1 0.0376 0.904 0.996 0.004
#> SRR390525 1 0.0376 0.904 0.996 0.004
#> SRR390526 1 0.1843 0.908 0.972 0.028
#> SRR390527 1 0.1843 0.908 0.972 0.028
#> SRR390528 1 0.5737 0.893 0.864 0.136
#> SRR390529 1 0.5737 0.897 0.864 0.136
#> SRR390530 1 0.0376 0.904 0.996 0.004
#> SRR390531 1 0.0376 0.904 0.996 0.004
#> SRR390532 1 0.5629 0.895 0.868 0.132
#> SRR390533 1 0.2603 0.909 0.956 0.044
#> SRR390534 1 0.2778 0.909 0.952 0.048
#> SRR390535 1 0.2948 0.908 0.948 0.052
#> SRR390536 1 0.7219 0.855 0.800 0.200
#> SRR390537 1 0.7219 0.855 0.800 0.200
#> SRR390538 1 0.5737 0.897 0.864 0.136
#> SRR390539 1 0.5737 0.897 0.864 0.136
#> SRR390540 1 0.5737 0.897 0.864 0.136
#> SRR390541 1 0.5737 0.897 0.864 0.136
#> SRR390542 2 0.0000 1.000 0.000 1.000
#> SRR390543 2 0.0000 1.000 0.000 1.000
#> SRR390544 2 0.0000 1.000 0.000 1.000
#> SRR390545 2 0.0000 1.000 0.000 1.000
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.5431 0.595 0.716 0.000 0.284
#> SRR390471 1 0.5431 0.595 0.716 0.000 0.284
#> SRR390472 1 0.5431 0.595 0.716 0.000 0.284
#> SRR390473 1 0.5431 0.595 0.716 0.000 0.284
#> SRR390474 1 0.5722 0.593 0.704 0.004 0.292
#> SRR390475 1 0.5431 0.595 0.716 0.000 0.284
#> SRR390476 1 0.5431 0.595 0.716 0.000 0.284
#> SRR390477 1 0.5465 0.593 0.712 0.000 0.288
#> SRR390478 1 0.5465 0.593 0.712 0.000 0.288
#> SRR390480 3 0.6698 0.616 0.036 0.280 0.684
#> SRR390481 3 0.6698 0.616 0.036 0.280 0.684
#> SRR390482 3 0.6730 0.615 0.036 0.284 0.680
#> SRR390483 3 0.6730 0.615 0.036 0.284 0.680
#> SRR390484 3 0.0237 0.676 0.000 0.004 0.996
#> SRR390485 3 0.0237 0.676 0.000 0.004 0.996
#> SRR390486 1 0.6225 0.107 0.568 0.000 0.432
#> SRR390487 1 0.6225 0.107 0.568 0.000 0.432
#> SRR390488 1 0.6225 0.107 0.568 0.000 0.432
#> SRR390489 1 0.6225 0.107 0.568 0.000 0.432
#> SRR390492 3 0.0237 0.676 0.000 0.004 0.996
#> SRR390493 3 0.0237 0.676 0.000 0.004 0.996
#> SRR390494 3 0.0237 0.676 0.000 0.004 0.996
#> SRR390495 3 0.0237 0.676 0.000 0.004 0.996
#> SRR390496 3 0.0237 0.676 0.000 0.004 0.996
#> SRR390497 3 0.0237 0.676 0.000 0.004 0.996
#> SRR390498 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390499 3 0.6730 0.615 0.036 0.284 0.680
#> SRR390500 3 0.6730 0.615 0.036 0.284 0.680
#> SRR390501 1 0.6225 0.107 0.568 0.000 0.432
#> SRR390502 1 0.6225 0.107 0.568 0.000 0.432
#> SRR390503 1 0.6225 0.107 0.568 0.000 0.432
#> SRR390504 1 0.5138 0.271 0.748 0.000 0.252
#> SRR390505 1 0.6062 0.350 0.616 0.000 0.384
#> SRR390506 1 0.6062 0.350 0.616 0.000 0.384
#> SRR390507 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390508 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390509 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390510 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390512 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390513 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390514 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390515 1 0.5431 0.595 0.716 0.000 0.284
#> SRR390516 1 0.6225 0.107 0.568 0.000 0.432
#> SRR390517 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390519 3 0.0237 0.676 0.000 0.004 0.996
#> SRR390520 1 0.5722 0.593 0.704 0.004 0.292
#> SRR390521 1 0.5722 0.593 0.704 0.004 0.292
#> SRR390522 1 0.5722 0.593 0.704 0.004 0.292
#> SRR390523 1 0.5722 0.593 0.704 0.004 0.292
#> SRR390524 1 0.5497 0.594 0.708 0.000 0.292
#> SRR390525 1 0.5497 0.594 0.708 0.000 0.292
#> SRR390526 1 0.6682 0.283 0.504 0.008 0.488
#> SRR390527 1 0.6682 0.283 0.504 0.008 0.488
#> SRR390528 3 0.6632 0.617 0.036 0.272 0.692
#> SRR390529 1 0.6062 0.350 0.616 0.000 0.384
#> SRR390530 1 0.5497 0.593 0.708 0.000 0.292
#> SRR390531 1 0.5497 0.593 0.708 0.000 0.292
#> SRR390532 3 0.6730 0.615 0.036 0.284 0.680
#> SRR390533 3 0.6682 -0.321 0.488 0.008 0.504
#> SRR390534 3 0.6682 -0.321 0.488 0.008 0.504
#> SRR390535 3 0.6680 -0.313 0.484 0.008 0.508
#> SRR390536 3 0.0237 0.676 0.000 0.004 0.996
#> SRR390537 3 0.0237 0.676 0.000 0.004 0.996
#> SRR390538 1 0.6062 0.350 0.616 0.000 0.384
#> SRR390539 1 0.6062 0.350 0.616 0.000 0.384
#> SRR390540 1 0.6062 0.350 0.616 0.000 0.384
#> SRR390541 1 0.6062 0.350 0.616 0.000 0.384
#> SRR390542 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390543 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390544 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390545 2 0.0000 1.000 0.000 1.000 0.000
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.3172 0.813 0.840 0.000 0.000 0.160
#> SRR390471 1 0.3172 0.813 0.840 0.000 0.000 0.160
#> SRR390472 1 0.3172 0.813 0.840 0.000 0.000 0.160
#> SRR390473 1 0.3172 0.813 0.840 0.000 0.000 0.160
#> SRR390474 1 0.3402 0.811 0.832 0.004 0.000 0.164
#> SRR390475 1 0.3172 0.813 0.840 0.000 0.000 0.160
#> SRR390476 1 0.3172 0.813 0.840 0.000 0.000 0.160
#> SRR390477 1 0.3498 0.810 0.832 0.008 0.000 0.160
#> SRR390478 1 0.3498 0.810 0.832 0.008 0.000 0.160
#> SRR390480 4 0.2654 0.863 0.108 0.004 0.000 0.888
#> SRR390481 4 0.2654 0.863 0.108 0.004 0.000 0.888
#> SRR390482 4 0.2654 0.863 0.108 0.004 0.000 0.888
#> SRR390483 4 0.2654 0.863 0.108 0.004 0.000 0.888
#> SRR390484 4 0.2737 0.854 0.008 0.000 0.104 0.888
#> SRR390485 4 0.2737 0.854 0.008 0.000 0.104 0.888
#> SRR390486 3 0.0000 0.998 0.000 0.000 1.000 0.000
#> SRR390487 3 0.0000 0.998 0.000 0.000 1.000 0.000
#> SRR390488 3 0.0000 0.998 0.000 0.000 1.000 0.000
#> SRR390489 3 0.0000 0.998 0.000 0.000 1.000 0.000
#> SRR390492 4 0.0927 0.895 0.008 0.000 0.016 0.976
#> SRR390493 4 0.1042 0.894 0.008 0.000 0.020 0.972
#> SRR390494 4 0.0927 0.895 0.008 0.000 0.016 0.976
#> SRR390495 4 0.0927 0.895 0.008 0.000 0.016 0.976
#> SRR390496 4 0.0927 0.895 0.008 0.000 0.016 0.976
#> SRR390497 4 0.2737 0.854 0.008 0.000 0.104 0.888
#> SRR390498 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390499 4 0.2654 0.863 0.108 0.004 0.000 0.888
#> SRR390500 4 0.2654 0.863 0.108 0.004 0.000 0.888
#> SRR390501 3 0.0000 0.998 0.000 0.000 1.000 0.000
#> SRR390502 3 0.0000 0.998 0.000 0.000 1.000 0.000
#> SRR390503 3 0.0000 0.998 0.000 0.000 1.000 0.000
#> SRR390504 3 0.0469 0.982 0.012 0.000 0.988 0.000
#> SRR390505 1 0.4910 0.538 0.704 0.000 0.020 0.276
#> SRR390506 1 0.4910 0.538 0.704 0.000 0.020 0.276
#> SRR390507 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390508 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390509 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390510 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390512 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390513 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390514 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390515 1 0.3172 0.813 0.840 0.000 0.000 0.160
#> SRR390516 3 0.0000 0.998 0.000 0.000 1.000 0.000
#> SRR390517 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390519 4 0.2737 0.854 0.008 0.000 0.104 0.888
#> SRR390520 1 0.3402 0.811 0.832 0.004 0.000 0.164
#> SRR390521 1 0.3402 0.811 0.832 0.004 0.000 0.164
#> SRR390522 1 0.3402 0.811 0.832 0.004 0.000 0.164
#> SRR390523 1 0.3402 0.811 0.832 0.004 0.000 0.164
#> SRR390524 1 0.3172 0.813 0.840 0.000 0.000 0.160
#> SRR390525 1 0.3172 0.813 0.840 0.000 0.000 0.160
#> SRR390526 1 0.4843 0.627 0.604 0.000 0.000 0.396
#> SRR390527 1 0.4843 0.627 0.604 0.000 0.000 0.396
#> SRR390528 4 0.2654 0.863 0.108 0.004 0.000 0.888
#> SRR390529 1 0.4910 0.538 0.704 0.000 0.020 0.276
#> SRR390530 1 0.3172 0.813 0.840 0.000 0.000 0.160
#> SRR390531 1 0.3172 0.813 0.840 0.000 0.000 0.160
#> SRR390532 4 0.2654 0.863 0.108 0.004 0.000 0.888
#> SRR390533 1 0.4916 0.589 0.576 0.000 0.000 0.424
#> SRR390534 1 0.4916 0.589 0.576 0.000 0.000 0.424
#> SRR390535 1 0.4916 0.589 0.576 0.000 0.000 0.424
#> SRR390536 4 0.0927 0.895 0.008 0.000 0.016 0.976
#> SRR390537 4 0.0927 0.895 0.008 0.000 0.016 0.976
#> SRR390538 1 0.4910 0.538 0.704 0.000 0.020 0.276
#> SRR390539 1 0.4910 0.538 0.704 0.000 0.020 0.276
#> SRR390540 1 0.4910 0.538 0.704 0.000 0.020 0.276
#> SRR390541 1 0.4910 0.538 0.704 0.000 0.020 0.276
#> SRR390542 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390543 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390544 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390545 2 0.0000 1.000 0.000 1.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.199 0.815 0.924 0.00 0.000 0.032 0.044
#> SRR390471 1 0.199 0.815 0.924 0.00 0.000 0.032 0.044
#> SRR390472 1 0.170 0.807 0.936 0.00 0.000 0.016 0.048
#> SRR390473 1 0.160 0.806 0.940 0.00 0.000 0.012 0.048
#> SRR390474 1 0.406 0.707 0.792 0.00 0.000 0.092 0.116
#> SRR390475 1 0.199 0.815 0.924 0.00 0.000 0.032 0.044
#> SRR390476 1 0.199 0.815 0.924 0.00 0.000 0.032 0.044
#> SRR390477 1 0.316 0.766 0.852 0.00 0.000 0.104 0.044
#> SRR390478 1 0.316 0.766 0.852 0.00 0.000 0.104 0.044
#> SRR390480 5 0.660 0.377 0.072 0.04 0.004 0.436 0.448
#> SRR390481 5 0.660 0.371 0.072 0.04 0.004 0.440 0.444
#> SRR390482 5 0.660 0.377 0.072 0.04 0.004 0.436 0.448
#> SRR390483 5 0.660 0.377 0.072 0.04 0.004 0.436 0.448
#> SRR390484 5 0.402 0.610 0.100 0.00 0.104 0.000 0.796
#> SRR390485 5 0.402 0.610 0.100 0.00 0.104 0.000 0.796
#> SRR390486 3 0.000 0.991 0.000 0.00 1.000 0.000 0.000
#> SRR390487 3 0.000 0.991 0.000 0.00 1.000 0.000 0.000
#> SRR390488 3 0.000 0.991 0.000 0.00 1.000 0.000 0.000
#> SRR390489 3 0.000 0.991 0.000 0.00 1.000 0.000 0.000
#> SRR390492 5 0.242 0.659 0.100 0.00 0.012 0.000 0.888
#> SRR390493 5 0.242 0.659 0.100 0.00 0.012 0.000 0.888
#> SRR390494 5 0.230 0.660 0.100 0.00 0.008 0.000 0.892
#> SRR390495 5 0.230 0.660 0.100 0.00 0.008 0.000 0.892
#> SRR390496 5 0.230 0.660 0.100 0.00 0.008 0.000 0.892
#> SRR390497 5 0.402 0.610 0.100 0.00 0.104 0.000 0.796
#> SRR390498 2 0.000 1.000 0.000 1.00 0.000 0.000 0.000
#> SRR390499 5 0.660 0.377 0.072 0.04 0.004 0.436 0.448
#> SRR390500 5 0.660 0.371 0.072 0.04 0.004 0.440 0.444
#> SRR390501 3 0.000 0.991 0.000 0.00 1.000 0.000 0.000
#> SRR390502 3 0.000 0.991 0.000 0.00 1.000 0.000 0.000
#> SRR390503 3 0.000 0.991 0.000 0.00 1.000 0.000 0.000
#> SRR390504 3 0.196 0.924 0.048 0.00 0.928 0.020 0.004
#> SRR390505 4 0.377 0.771 0.296 0.00 0.000 0.704 0.000
#> SRR390506 4 0.380 0.769 0.300 0.00 0.000 0.700 0.000
#> SRR390507 2 0.000 1.000 0.000 1.00 0.000 0.000 0.000
#> SRR390508 2 0.000 1.000 0.000 1.00 0.000 0.000 0.000
#> SRR390509 2 0.000 1.000 0.000 1.00 0.000 0.000 0.000
#> SRR390510 2 0.000 1.000 0.000 1.00 0.000 0.000 0.000
#> SRR390512 2 0.000 1.000 0.000 1.00 0.000 0.000 0.000
#> SRR390513 2 0.000 1.000 0.000 1.00 0.000 0.000 0.000
#> SRR390514 2 0.000 1.000 0.000 1.00 0.000 0.000 0.000
#> SRR390515 1 0.199 0.815 0.924 0.00 0.000 0.032 0.044
#> SRR390516 3 0.000 0.991 0.000 0.00 1.000 0.000 0.000
#> SRR390517 2 0.000 1.000 0.000 1.00 0.000 0.000 0.000
#> SRR390519 5 0.375 0.624 0.100 0.00 0.084 0.000 0.816
#> SRR390520 1 0.402 0.711 0.796 0.00 0.000 0.092 0.112
#> SRR390521 1 0.406 0.707 0.792 0.00 0.000 0.092 0.116
#> SRR390522 1 0.406 0.707 0.792 0.00 0.000 0.092 0.116
#> SRR390523 1 0.406 0.707 0.792 0.00 0.000 0.092 0.116
#> SRR390524 1 0.316 0.766 0.852 0.00 0.000 0.104 0.044
#> SRR390525 1 0.316 0.766 0.852 0.00 0.000 0.104 0.044
#> SRR390526 4 0.648 0.640 0.356 0.00 0.000 0.452 0.192
#> SRR390527 4 0.648 0.640 0.356 0.00 0.000 0.452 0.192
#> SRR390528 5 0.658 0.397 0.072 0.04 0.004 0.408 0.476
#> SRR390529 4 0.377 0.771 0.296 0.00 0.000 0.704 0.000
#> SRR390530 1 0.149 0.814 0.948 0.00 0.000 0.024 0.028
#> SRR390531 1 0.149 0.814 0.948 0.00 0.000 0.024 0.028
#> SRR390532 5 0.660 0.377 0.072 0.04 0.004 0.436 0.448
#> SRR390533 4 0.656 0.647 0.332 0.00 0.000 0.452 0.216
#> SRR390534 4 0.656 0.647 0.332 0.00 0.000 0.452 0.216
#> SRR390535 4 0.656 0.647 0.332 0.00 0.000 0.452 0.216
#> SRR390536 5 0.230 0.660 0.100 0.00 0.008 0.000 0.892
#> SRR390537 5 0.230 0.660 0.100 0.00 0.008 0.000 0.892
#> SRR390538 4 0.377 0.771 0.296 0.00 0.000 0.704 0.000
#> SRR390539 4 0.377 0.771 0.296 0.00 0.000 0.704 0.000
#> SRR390540 4 0.377 0.771 0.296 0.00 0.000 0.704 0.000
#> SRR390541 4 0.377 0.771 0.296 0.00 0.000 0.704 0.000
#> SRR390542 2 0.000 1.000 0.000 1.00 0.000 0.000 0.000
#> SRR390543 2 0.000 1.000 0.000 1.00 0.000 0.000 0.000
#> SRR390544 2 0.000 1.000 0.000 1.00 0.000 0.000 0.000
#> SRR390545 2 0.000 1.000 0.000 1.00 0.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.0713 0.684 0.972 0.000 0.000 0.000 0.000 0.028
#> SRR390471 1 0.0865 0.680 0.964 0.000 0.000 0.000 0.000 0.036
#> SRR390472 1 0.0603 0.688 0.980 0.000 0.000 0.004 0.000 0.016
#> SRR390473 1 0.0603 0.688 0.980 0.000 0.000 0.004 0.000 0.016
#> SRR390474 1 0.6591 0.520 0.416 0.000 0.000 0.240 0.032 0.312
#> SRR390475 1 0.0713 0.684 0.972 0.000 0.000 0.000 0.000 0.028
#> SRR390476 1 0.0790 0.682 0.968 0.000 0.000 0.000 0.000 0.032
#> SRR390477 1 0.5138 0.649 0.704 0.000 0.000 0.100 0.064 0.132
#> SRR390478 1 0.5138 0.649 0.704 0.000 0.000 0.100 0.064 0.132
#> SRR390480 4 0.2376 1.000 0.008 0.012 0.000 0.884 0.096 0.000
#> SRR390481 4 0.2376 1.000 0.008 0.012 0.000 0.884 0.096 0.000
#> SRR390482 4 0.2376 1.000 0.008 0.012 0.000 0.884 0.096 0.000
#> SRR390483 4 0.2376 1.000 0.008 0.012 0.000 0.884 0.096 0.000
#> SRR390484 5 0.0363 0.990 0.000 0.000 0.012 0.000 0.988 0.000
#> SRR390485 5 0.0363 0.990 0.000 0.000 0.012 0.000 0.988 0.000
#> SRR390486 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390487 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390488 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390489 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390492 5 0.0000 0.994 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390493 5 0.0000 0.994 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390494 5 0.0363 0.983 0.000 0.000 0.000 0.012 0.988 0.000
#> SRR390495 5 0.0000 0.994 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390496 5 0.0000 0.994 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390497 5 0.0363 0.990 0.000 0.000 0.012 0.000 0.988 0.000
#> SRR390498 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390499 4 0.2376 1.000 0.008 0.012 0.000 0.884 0.096 0.000
#> SRR390500 4 0.2376 1.000 0.008 0.012 0.000 0.884 0.096 0.000
#> SRR390501 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390502 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390503 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390504 3 0.0405 0.987 0.008 0.000 0.988 0.004 0.000 0.000
#> SRR390505 6 0.4120 0.725 0.204 0.000 0.000 0.068 0.000 0.728
#> SRR390506 6 0.4148 0.720 0.208 0.000 0.000 0.068 0.000 0.724
#> SRR390507 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390508 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390509 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390510 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390512 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390513 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390514 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390515 1 0.0713 0.684 0.972 0.000 0.000 0.000 0.000 0.028
#> SRR390516 3 0.0000 0.998 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390517 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390519 5 0.0260 0.991 0.000 0.000 0.008 0.000 0.992 0.000
#> SRR390520 1 0.6591 0.520 0.416 0.000 0.000 0.240 0.032 0.312
#> SRR390521 1 0.6591 0.520 0.416 0.000 0.000 0.240 0.032 0.312
#> SRR390522 1 0.6591 0.520 0.416 0.000 0.000 0.240 0.032 0.312
#> SRR390523 1 0.6591 0.520 0.416 0.000 0.000 0.240 0.032 0.312
#> SRR390524 1 0.5138 0.649 0.704 0.000 0.000 0.100 0.064 0.132
#> SRR390525 1 0.5138 0.649 0.704 0.000 0.000 0.100 0.064 0.132
#> SRR390526 6 0.6390 0.501 0.124 0.000 0.000 0.332 0.060 0.484
#> SRR390527 6 0.6390 0.501 0.124 0.000 0.000 0.332 0.060 0.484
#> SRR390528 4 0.2376 1.000 0.008 0.012 0.000 0.884 0.096 0.000
#> SRR390529 6 0.4176 0.719 0.212 0.000 0.000 0.068 0.000 0.720
#> SRR390530 1 0.4925 0.680 0.724 0.000 0.000 0.124 0.064 0.088
#> SRR390531 1 0.4925 0.680 0.724 0.000 0.000 0.124 0.064 0.088
#> SRR390532 4 0.2376 1.000 0.008 0.012 0.000 0.884 0.096 0.000
#> SRR390533 6 0.6252 0.477 0.100 0.000 0.000 0.364 0.060 0.476
#> SRR390534 6 0.6252 0.477 0.100 0.000 0.000 0.364 0.060 0.476
#> SRR390535 6 0.6181 0.478 0.092 0.000 0.000 0.364 0.060 0.484
#> SRR390536 5 0.0000 0.994 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390537 5 0.0000 0.994 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390538 6 0.4120 0.725 0.204 0.000 0.000 0.068 0.000 0.728
#> SRR390539 6 0.4120 0.725 0.204 0.000 0.000 0.068 0.000 0.728
#> SRR390540 6 0.4120 0.725 0.204 0.000 0.000 0.068 0.000 0.728
#> SRR390541 6 0.4120 0.725 0.204 0.000 0.000 0.068 0.000 0.728
#> SRR390542 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390543 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390544 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390545 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
CV:NMF*
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"]
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 15244 rows and 71 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 6.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)

The plots are:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.696 0.940 0.950 0.454 0.546 0.546
#> 3 3 0.535 0.857 0.874 0.370 0.765 0.599
#> 4 4 0.673 0.581 0.698 0.154 0.828 0.597
#> 5 5 0.860 0.924 0.922 0.107 0.839 0.510
#> 6 6 0.908 0.894 0.913 0.050 0.947 0.751
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
suggest_best_k(res)
#> [1] 6
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.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.0938 0.957 0.988 0.012
#> SRR390471 1 0.0938 0.957 0.988 0.012
#> SRR390472 1 0.0938 0.957 0.988 0.012
#> SRR390473 1 0.0938 0.957 0.988 0.012
#> SRR390474 1 0.1414 0.946 0.980 0.020
#> SRR390475 1 0.0938 0.957 0.988 0.012
#> SRR390476 1 0.0938 0.957 0.988 0.012
#> SRR390477 1 0.0938 0.957 0.988 0.012
#> SRR390478 1 0.0938 0.957 0.988 0.012
#> SRR390480 1 0.2043 0.954 0.968 0.032
#> SRR390481 1 0.2043 0.954 0.968 0.032
#> SRR390482 1 0.2043 0.954 0.968 0.032
#> SRR390483 1 0.2043 0.954 0.968 0.032
#> SRR390484 2 0.4815 0.938 0.104 0.896
#> SRR390485 2 0.4815 0.938 0.104 0.896
#> SRR390486 1 0.5842 0.867 0.860 0.140
#> SRR390487 1 0.5842 0.867 0.860 0.140
#> SRR390488 1 0.5842 0.867 0.860 0.140
#> SRR390489 1 0.5842 0.867 0.860 0.140
#> SRR390492 2 0.4815 0.938 0.104 0.896
#> SRR390493 2 0.4815 0.938 0.104 0.896
#> SRR390494 2 0.4815 0.938 0.104 0.896
#> SRR390495 2 0.4815 0.938 0.104 0.896
#> SRR390496 2 0.4815 0.938 0.104 0.896
#> SRR390497 2 0.4815 0.938 0.104 0.896
#> SRR390498 2 0.1414 0.950 0.020 0.980
#> SRR390499 1 0.2043 0.954 0.968 0.032
#> SRR390500 1 0.2043 0.954 0.968 0.032
#> SRR390501 1 0.5842 0.867 0.860 0.140
#> SRR390502 1 0.5842 0.867 0.860 0.140
#> SRR390503 1 0.5842 0.867 0.860 0.140
#> SRR390504 1 0.5842 0.867 0.860 0.140
#> SRR390505 1 0.2236 0.951 0.964 0.036
#> SRR390506 1 0.2236 0.951 0.964 0.036
#> SRR390507 2 0.1414 0.950 0.020 0.980
#> SRR390508 2 0.1414 0.950 0.020 0.980
#> SRR390509 2 0.1414 0.950 0.020 0.980
#> SRR390510 2 0.1414 0.950 0.020 0.980
#> SRR390512 2 0.1414 0.950 0.020 0.980
#> SRR390513 2 0.1414 0.950 0.020 0.980
#> SRR390514 2 0.1414 0.950 0.020 0.980
#> SRR390515 1 0.0938 0.957 0.988 0.012
#> SRR390516 1 0.5842 0.867 0.860 0.140
#> SRR390517 2 0.1414 0.950 0.020 0.980
#> SRR390519 2 0.4815 0.938 0.104 0.896
#> SRR390520 1 0.1414 0.946 0.980 0.020
#> SRR390521 1 0.1414 0.946 0.980 0.020
#> SRR390522 1 0.1414 0.946 0.980 0.020
#> SRR390523 1 0.1414 0.946 0.980 0.020
#> SRR390524 1 0.0938 0.957 0.988 0.012
#> SRR390525 1 0.0938 0.957 0.988 0.012
#> SRR390526 1 0.0672 0.957 0.992 0.008
#> SRR390527 1 0.0672 0.957 0.992 0.008
#> SRR390528 1 0.1843 0.954 0.972 0.028
#> SRR390529 1 0.2236 0.951 0.964 0.036
#> SRR390530 1 0.0938 0.957 0.988 0.012
#> SRR390531 1 0.0938 0.957 0.988 0.012
#> SRR390532 1 0.2043 0.954 0.968 0.032
#> SRR390533 1 0.1414 0.957 0.980 0.020
#> SRR390534 1 0.1414 0.957 0.980 0.020
#> SRR390535 1 0.2236 0.951 0.964 0.036
#> SRR390536 2 0.4815 0.938 0.104 0.896
#> SRR390537 2 0.4815 0.938 0.104 0.896
#> SRR390538 1 0.2236 0.951 0.964 0.036
#> SRR390539 1 0.2236 0.951 0.964 0.036
#> SRR390540 1 0.2236 0.951 0.964 0.036
#> SRR390541 1 0.2236 0.951 0.964 0.036
#> SRR390542 2 0.1414 0.950 0.020 0.980
#> SRR390543 2 0.1414 0.950 0.020 0.980
#> SRR390544 2 0.1414 0.950 0.020 0.980
#> SRR390545 2 0.1414 0.950 0.020 0.980
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.3941 0.865 0.844 0.000 0.156
#> SRR390471 1 0.3941 0.865 0.844 0.000 0.156
#> SRR390472 1 0.3941 0.865 0.844 0.000 0.156
#> SRR390473 1 0.3941 0.865 0.844 0.000 0.156
#> SRR390474 1 0.4121 0.857 0.832 0.000 0.168
#> SRR390475 1 0.3941 0.865 0.844 0.000 0.156
#> SRR390476 1 0.3941 0.865 0.844 0.000 0.156
#> SRR390477 1 0.3482 0.871 0.872 0.000 0.128
#> SRR390478 1 0.3482 0.871 0.872 0.000 0.128
#> SRR390480 1 0.4121 0.812 0.832 0.000 0.168
#> SRR390481 1 0.4121 0.812 0.832 0.000 0.168
#> SRR390482 1 0.4121 0.812 0.832 0.000 0.168
#> SRR390483 1 0.4121 0.812 0.832 0.000 0.168
#> SRR390484 3 0.6247 0.775 0.044 0.212 0.744
#> SRR390485 3 0.6247 0.775 0.044 0.212 0.744
#> SRR390486 3 0.5393 0.748 0.108 0.072 0.820
#> SRR390487 3 0.5393 0.748 0.108 0.072 0.820
#> SRR390488 3 0.5393 0.748 0.108 0.072 0.820
#> SRR390489 3 0.5393 0.748 0.108 0.072 0.820
#> SRR390492 3 0.6247 0.775 0.044 0.212 0.744
#> SRR390493 3 0.6247 0.775 0.044 0.212 0.744
#> SRR390494 3 0.6247 0.775 0.044 0.212 0.744
#> SRR390495 3 0.6247 0.775 0.044 0.212 0.744
#> SRR390496 3 0.6247 0.775 0.044 0.212 0.744
#> SRR390497 3 0.6247 0.775 0.044 0.212 0.744
#> SRR390498 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390499 1 0.4121 0.812 0.832 0.000 0.168
#> SRR390500 1 0.4121 0.812 0.832 0.000 0.168
#> SRR390501 3 0.5393 0.748 0.108 0.072 0.820
#> SRR390502 3 0.5393 0.748 0.108 0.072 0.820
#> SRR390503 3 0.5393 0.748 0.108 0.072 0.820
#> SRR390504 3 0.5393 0.748 0.108 0.072 0.820
#> SRR390505 1 0.1753 0.878 0.952 0.000 0.048
#> SRR390506 1 0.1753 0.878 0.952 0.000 0.048
#> SRR390507 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390508 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390509 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390510 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390512 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390513 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390514 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390515 1 0.3941 0.865 0.844 0.000 0.156
#> SRR390516 3 0.5393 0.748 0.108 0.072 0.820
#> SRR390517 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390519 3 0.6247 0.775 0.044 0.212 0.744
#> SRR390520 1 0.4121 0.857 0.832 0.000 0.168
#> SRR390521 1 0.4121 0.857 0.832 0.000 0.168
#> SRR390522 1 0.4121 0.857 0.832 0.000 0.168
#> SRR390523 1 0.4121 0.857 0.832 0.000 0.168
#> SRR390524 1 0.3482 0.871 0.872 0.000 0.128
#> SRR390525 1 0.3482 0.871 0.872 0.000 0.128
#> SRR390526 1 0.1031 0.877 0.976 0.000 0.024
#> SRR390527 1 0.0892 0.878 0.980 0.000 0.020
#> SRR390528 1 0.4121 0.812 0.832 0.000 0.168
#> SRR390529 1 0.1753 0.878 0.952 0.000 0.048
#> SRR390530 1 0.3482 0.871 0.872 0.000 0.128
#> SRR390531 1 0.3482 0.871 0.872 0.000 0.128
#> SRR390532 1 0.4121 0.812 0.832 0.000 0.168
#> SRR390533 1 0.1643 0.879 0.956 0.000 0.044
#> SRR390534 1 0.1643 0.879 0.956 0.000 0.044
#> SRR390535 1 0.1643 0.879 0.956 0.000 0.044
#> SRR390536 3 0.6247 0.775 0.044 0.212 0.744
#> SRR390537 3 0.6247 0.775 0.044 0.212 0.744
#> SRR390538 1 0.1753 0.878 0.952 0.000 0.048
#> SRR390539 1 0.1753 0.878 0.952 0.000 0.048
#> SRR390540 1 0.1753 0.878 0.952 0.000 0.048
#> SRR390541 1 0.1753 0.878 0.952 0.000 0.048
#> SRR390542 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390543 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390544 2 0.0000 1.000 0.000 1.000 0.000
#> SRR390545 2 0.0000 1.000 0.000 1.000 0.000
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.0804 0.685 0.980 0.000 0.008 0.012
#> SRR390471 1 0.0804 0.685 0.980 0.000 0.008 0.012
#> SRR390472 1 0.0804 0.685 0.980 0.000 0.008 0.012
#> SRR390473 1 0.0804 0.685 0.980 0.000 0.008 0.012
#> SRR390474 1 0.5979 0.513 0.692 0.000 0.136 0.172
#> SRR390475 1 0.0804 0.685 0.980 0.000 0.008 0.012
#> SRR390476 1 0.0804 0.685 0.980 0.000 0.008 0.012
#> SRR390477 1 0.0000 0.687 1.000 0.000 0.000 0.000
#> SRR390478 1 0.0000 0.687 1.000 0.000 0.000 0.000
#> SRR390480 4 0.7365 -0.228 0.400 0.000 0.160 0.440
#> SRR390481 4 0.7365 -0.228 0.400 0.000 0.160 0.440
#> SRR390482 4 0.7365 -0.228 0.400 0.000 0.160 0.440
#> SRR390483 4 0.7365 -0.228 0.400 0.000 0.160 0.440
#> SRR390484 4 0.7753 0.286 0.064 0.080 0.316 0.540
#> SRR390485 4 0.7753 0.286 0.064 0.080 0.316 0.540
#> SRR390486 3 0.0804 1.000 0.012 0.008 0.980 0.000
#> SRR390487 3 0.0804 1.000 0.012 0.008 0.980 0.000
#> SRR390488 3 0.0804 1.000 0.012 0.008 0.980 0.000
#> SRR390489 3 0.0804 1.000 0.012 0.008 0.980 0.000
#> SRR390492 4 0.7753 0.286 0.064 0.080 0.316 0.540
#> SRR390493 4 0.7753 0.286 0.064 0.080 0.316 0.540
#> SRR390494 4 0.7753 0.286 0.064 0.080 0.316 0.540
#> SRR390495 4 0.7753 0.286 0.064 0.080 0.316 0.540
#> SRR390496 4 0.7753 0.286 0.064 0.080 0.316 0.540
#> SRR390497 4 0.7753 0.286 0.064 0.080 0.316 0.540
#> SRR390498 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390499 4 0.7365 -0.228 0.400 0.000 0.160 0.440
#> SRR390500 4 0.7365 -0.228 0.400 0.000 0.160 0.440
#> SRR390501 3 0.0804 1.000 0.012 0.008 0.980 0.000
#> SRR390502 3 0.0804 1.000 0.012 0.008 0.980 0.000
#> SRR390503 3 0.0804 1.000 0.012 0.008 0.980 0.000
#> SRR390504 3 0.0804 1.000 0.012 0.008 0.980 0.000
#> SRR390505 1 0.5288 0.543 0.520 0.000 0.008 0.472
#> SRR390506 1 0.5288 0.543 0.520 0.000 0.008 0.472
#> SRR390507 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390508 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390509 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390510 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390512 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390513 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390514 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390515 1 0.0804 0.685 0.980 0.000 0.008 0.012
#> SRR390516 3 0.0804 1.000 0.012 0.008 0.980 0.000
#> SRR390517 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390519 4 0.7753 0.286 0.064 0.080 0.316 0.540
#> SRR390520 1 0.5979 0.513 0.692 0.000 0.136 0.172
#> SRR390521 1 0.5979 0.513 0.692 0.000 0.136 0.172
#> SRR390522 1 0.5979 0.513 0.692 0.000 0.136 0.172
#> SRR390523 1 0.5979 0.513 0.692 0.000 0.136 0.172
#> SRR390524 1 0.0000 0.687 1.000 0.000 0.000 0.000
#> SRR390525 1 0.0000 0.687 1.000 0.000 0.000 0.000
#> SRR390526 1 0.5398 0.512 0.580 0.000 0.016 0.404
#> SRR390527 1 0.5398 0.512 0.580 0.000 0.016 0.404
#> SRR390528 4 0.7365 -0.228 0.400 0.000 0.160 0.440
#> SRR390529 1 0.5288 0.543 0.520 0.000 0.008 0.472
#> SRR390530 1 0.0336 0.686 0.992 0.000 0.000 0.008
#> SRR390531 1 0.0336 0.686 0.992 0.000 0.000 0.008
#> SRR390532 4 0.7365 -0.228 0.400 0.000 0.160 0.440
#> SRR390533 1 0.5285 0.543 0.524 0.000 0.008 0.468
#> SRR390534 1 0.5285 0.543 0.524 0.000 0.008 0.468
#> SRR390535 1 0.5285 0.543 0.524 0.000 0.008 0.468
#> SRR390536 4 0.7753 0.286 0.064 0.080 0.316 0.540
#> SRR390537 4 0.7753 0.286 0.064 0.080 0.316 0.540
#> SRR390538 1 0.5288 0.543 0.520 0.000 0.008 0.472
#> SRR390539 1 0.5288 0.543 0.520 0.000 0.008 0.472
#> SRR390540 1 0.5288 0.543 0.520 0.000 0.008 0.472
#> SRR390541 1 0.5288 0.543 0.520 0.000 0.008 0.472
#> SRR390542 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390543 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390544 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390545 2 0.0000 1.000 0.000 1.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.2754 0.866 0.880 0.000 0.000 0.080 0.040
#> SRR390471 1 0.2754 0.866 0.880 0.000 0.000 0.080 0.040
#> SRR390472 1 0.2754 0.866 0.880 0.000 0.000 0.080 0.040
#> SRR390473 1 0.2754 0.866 0.880 0.000 0.000 0.080 0.040
#> SRR390474 1 0.5374 0.756 0.728 0.000 0.096 0.128 0.048
#> SRR390475 1 0.2754 0.866 0.880 0.000 0.000 0.080 0.040
#> SRR390476 1 0.2754 0.866 0.880 0.000 0.000 0.080 0.040
#> SRR390477 1 0.0771 0.872 0.976 0.000 0.000 0.020 0.004
#> SRR390478 1 0.0955 0.873 0.968 0.000 0.000 0.028 0.004
#> SRR390480 4 0.3742 0.890 0.048 0.000 0.064 0.844 0.044
#> SRR390481 4 0.3742 0.890 0.048 0.000 0.064 0.844 0.044
#> SRR390482 4 0.3742 0.890 0.048 0.000 0.064 0.844 0.044
#> SRR390483 4 0.3742 0.890 0.048 0.000 0.064 0.844 0.044
#> SRR390484 5 0.0404 1.000 0.000 0.012 0.000 0.000 0.988
#> SRR390485 5 0.0404 1.000 0.000 0.012 0.000 0.000 0.988
#> SRR390486 3 0.2068 1.000 0.000 0.000 0.904 0.004 0.092
#> SRR390487 3 0.2068 1.000 0.000 0.000 0.904 0.004 0.092
#> SRR390488 3 0.2068 1.000 0.000 0.000 0.904 0.004 0.092
#> SRR390489 3 0.2068 1.000 0.000 0.000 0.904 0.004 0.092
#> SRR390492 5 0.0404 1.000 0.000 0.012 0.000 0.000 0.988
#> SRR390493 5 0.0404 1.000 0.000 0.012 0.000 0.000 0.988
#> SRR390494 5 0.0404 1.000 0.000 0.012 0.000 0.000 0.988
#> SRR390495 5 0.0404 1.000 0.000 0.012 0.000 0.000 0.988
#> SRR390496 5 0.0404 1.000 0.000 0.012 0.000 0.000 0.988
#> SRR390497 5 0.0404 1.000 0.000 0.012 0.000 0.000 0.988
#> SRR390498 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390499 4 0.3742 0.890 0.048 0.000 0.064 0.844 0.044
#> SRR390500 4 0.3742 0.890 0.048 0.000 0.064 0.844 0.044
#> SRR390501 3 0.2068 1.000 0.000 0.000 0.904 0.004 0.092
#> SRR390502 3 0.2068 1.000 0.000 0.000 0.904 0.004 0.092
#> SRR390503 3 0.2068 1.000 0.000 0.000 0.904 0.004 0.092
#> SRR390504 3 0.2068 1.000 0.000 0.000 0.904 0.004 0.092
#> SRR390505 4 0.0771 0.894 0.020 0.000 0.004 0.976 0.000
#> SRR390506 4 0.0771 0.894 0.020 0.000 0.004 0.976 0.000
#> SRR390507 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390508 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390509 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390510 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390512 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390513 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390514 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390515 1 0.2754 0.866 0.880 0.000 0.000 0.080 0.040
#> SRR390516 3 0.2068 1.000 0.000 0.000 0.904 0.004 0.092
#> SRR390517 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390519 5 0.0404 1.000 0.000 0.012 0.000 0.000 0.988
#> SRR390520 1 0.5374 0.756 0.728 0.000 0.096 0.128 0.048
#> SRR390521 1 0.5374 0.756 0.728 0.000 0.096 0.128 0.048
#> SRR390522 1 0.5374 0.756 0.728 0.000 0.096 0.128 0.048
#> SRR390523 1 0.5374 0.756 0.728 0.000 0.096 0.128 0.048
#> SRR390524 1 0.0671 0.872 0.980 0.000 0.000 0.016 0.004
#> SRR390525 1 0.0671 0.872 0.980 0.000 0.000 0.016 0.004
#> SRR390526 4 0.3018 0.887 0.084 0.000 0.036 0.872 0.008
#> SRR390527 4 0.3107 0.882 0.096 0.000 0.032 0.864 0.008
#> SRR390528 4 0.3742 0.890 0.048 0.000 0.064 0.844 0.044
#> SRR390529 4 0.0771 0.894 0.020 0.000 0.004 0.976 0.000
#> SRR390530 1 0.1041 0.861 0.964 0.000 0.032 0.000 0.004
#> SRR390531 1 0.0865 0.863 0.972 0.000 0.024 0.000 0.004
#> SRR390532 4 0.3742 0.890 0.048 0.000 0.064 0.844 0.044
#> SRR390533 4 0.3359 0.807 0.084 0.000 0.072 0.844 0.000
#> SRR390534 4 0.3359 0.807 0.084 0.000 0.072 0.844 0.000
#> SRR390535 4 0.3416 0.803 0.088 0.000 0.072 0.840 0.000
#> SRR390536 5 0.0404 1.000 0.000 0.012 0.000 0.000 0.988
#> SRR390537 5 0.0404 1.000 0.000 0.012 0.000 0.000 0.988
#> SRR390538 4 0.0771 0.894 0.020 0.000 0.004 0.976 0.000
#> SRR390539 4 0.0771 0.894 0.020 0.000 0.004 0.976 0.000
#> SRR390540 4 0.0771 0.894 0.020 0.000 0.004 0.976 0.000
#> SRR390541 4 0.0771 0.894 0.020 0.000 0.004 0.976 0.000
#> SRR390542 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390543 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390544 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
#> SRR390545 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.0405 0.937 0.988 0.000 0.000 0.000 0.004 0.008
#> SRR390471 1 0.0405 0.937 0.988 0.000 0.000 0.000 0.004 0.008
#> SRR390472 1 0.0405 0.937 0.988 0.000 0.000 0.000 0.004 0.008
#> SRR390473 1 0.0405 0.937 0.988 0.000 0.000 0.000 0.004 0.008
#> SRR390474 6 0.4273 0.883 0.080 0.000 0.000 0.204 0.000 0.716
#> SRR390475 1 0.0405 0.937 0.988 0.000 0.000 0.000 0.004 0.008
#> SRR390476 1 0.0405 0.937 0.988 0.000 0.000 0.000 0.004 0.008
#> SRR390477 1 0.1531 0.923 0.928 0.000 0.004 0.000 0.000 0.068
#> SRR390478 1 0.1471 0.924 0.932 0.000 0.004 0.000 0.000 0.064
#> SRR390480 4 0.5555 0.771 0.024 0.000 0.052 0.572 0.016 0.336
#> SRR390481 4 0.5555 0.771 0.024 0.000 0.052 0.572 0.016 0.336
#> SRR390482 4 0.5555 0.771 0.024 0.000 0.052 0.572 0.016 0.336
#> SRR390483 4 0.5555 0.771 0.024 0.000 0.052 0.572 0.016 0.336
#> SRR390484 5 0.0520 0.995 0.000 0.008 0.000 0.000 0.984 0.008
#> SRR390485 5 0.0520 0.995 0.000 0.008 0.000 0.000 0.984 0.008
#> SRR390486 3 0.1204 1.000 0.000 0.000 0.944 0.000 0.056 0.000
#> SRR390487 3 0.1204 1.000 0.000 0.000 0.944 0.000 0.056 0.000
#> SRR390488 3 0.1204 1.000 0.000 0.000 0.944 0.000 0.056 0.000
#> SRR390489 3 0.1204 1.000 0.000 0.000 0.944 0.000 0.056 0.000
#> SRR390492 5 0.0260 0.998 0.000 0.008 0.000 0.000 0.992 0.000
#> SRR390493 5 0.0260 0.998 0.000 0.008 0.000 0.000 0.992 0.000
#> SRR390494 5 0.0260 0.998 0.000 0.008 0.000 0.000 0.992 0.000
#> SRR390495 5 0.0260 0.998 0.000 0.008 0.000 0.000 0.992 0.000
#> SRR390496 5 0.0260 0.998 0.000 0.008 0.000 0.000 0.992 0.000
#> SRR390497 5 0.0520 0.995 0.000 0.008 0.000 0.000 0.984 0.008
#> SRR390498 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390499 4 0.5555 0.771 0.024 0.000 0.052 0.572 0.016 0.336
#> SRR390500 4 0.5555 0.771 0.024 0.000 0.052 0.572 0.016 0.336
#> SRR390501 3 0.1204 1.000 0.000 0.000 0.944 0.000 0.056 0.000
#> SRR390502 3 0.1204 1.000 0.000 0.000 0.944 0.000 0.056 0.000
#> SRR390503 3 0.1204 1.000 0.000 0.000 0.944 0.000 0.056 0.000
#> SRR390504 3 0.1204 1.000 0.000 0.000 0.944 0.000 0.056 0.000
#> SRR390505 4 0.0146 0.615 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR390506 4 0.0146 0.615 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR390507 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390508 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390509 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390510 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390512 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390513 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390514 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390515 1 0.0405 0.937 0.988 0.000 0.000 0.000 0.004 0.008
#> SRR390516 3 0.1204 1.000 0.000 0.000 0.944 0.000 0.056 0.000
#> SRR390517 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390519 5 0.0260 0.998 0.000 0.008 0.000 0.000 0.992 0.000
#> SRR390520 6 0.4273 0.883 0.080 0.000 0.000 0.204 0.000 0.716
#> SRR390521 6 0.4273 0.883 0.080 0.000 0.000 0.204 0.000 0.716
#> SRR390522 6 0.4273 0.883 0.080 0.000 0.000 0.204 0.000 0.716
#> SRR390523 6 0.4273 0.883 0.080 0.000 0.000 0.204 0.000 0.716
#> SRR390524 1 0.1588 0.921 0.924 0.000 0.004 0.000 0.000 0.072
#> SRR390525 1 0.1588 0.921 0.924 0.000 0.004 0.000 0.000 0.072
#> SRR390526 4 0.5955 0.732 0.068 0.000 0.056 0.536 0.004 0.336
#> SRR390527 4 0.5936 0.722 0.084 0.000 0.052 0.532 0.000 0.332
#> SRR390528 4 0.5555 0.771 0.024 0.000 0.052 0.572 0.016 0.336
#> SRR390529 4 0.0146 0.615 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR390530 1 0.3109 0.765 0.772 0.000 0.004 0.000 0.000 0.224
#> SRR390531 1 0.2738 0.828 0.820 0.000 0.004 0.000 0.000 0.176
#> SRR390532 4 0.5555 0.771 0.024 0.000 0.052 0.572 0.016 0.336
#> SRR390533 6 0.3810 0.769 0.000 0.000 0.000 0.428 0.000 0.572
#> SRR390534 6 0.3817 0.764 0.000 0.000 0.000 0.432 0.000 0.568
#> SRR390535 6 0.3810 0.769 0.000 0.000 0.000 0.428 0.000 0.572
#> SRR390536 5 0.0260 0.998 0.000 0.008 0.000 0.000 0.992 0.000
#> SRR390537 5 0.0260 0.998 0.000 0.008 0.000 0.000 0.992 0.000
#> SRR390538 4 0.0146 0.615 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR390539 4 0.0146 0.615 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR390540 4 0.0146 0.615 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR390541 4 0.0146 0.615 0.004 0.000 0.000 0.996 0.000 0.000
#> SRR390542 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390543 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390544 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390545 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
MAD:hclust
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"]
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 15244 rows and 71 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'hclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 4.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)

The plots are:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.512 0.785 0.897 0.2440 0.775 0.775
#> 3 3 0.525 0.926 0.881 0.9423 0.568 0.473
#> 4 4 0.756 0.888 0.919 0.3137 0.920 0.815
#> 5 5 0.672 0.446 0.680 0.1600 0.848 0.594
#> 6 6 0.780 0.876 0.909 0.0994 0.812 0.402
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
suggest_best_k(res)
#> [1] 4
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.644 0.813 0.836 0.164
#> SRR390471 1 0.644 0.813 0.836 0.164
#> SRR390472 1 0.644 0.813 0.836 0.164
#> SRR390473 1 0.644 0.813 0.836 0.164
#> SRR390474 1 0.000 0.873 1.000 0.000
#> SRR390475 1 0.644 0.813 0.836 0.164
#> SRR390476 1 0.644 0.813 0.836 0.164
#> SRR390477 1 0.644 0.813 0.836 0.164
#> SRR390478 1 0.644 0.813 0.836 0.164
#> SRR390480 1 0.000 0.873 1.000 0.000
#> SRR390481 1 0.000 0.873 1.000 0.000
#> SRR390482 1 0.000 0.873 1.000 0.000
#> SRR390483 1 0.000 0.873 1.000 0.000
#> SRR390484 2 0.000 0.705 0.000 1.000
#> SRR390485 2 0.000 0.705 0.000 1.000
#> SRR390486 1 0.821 0.705 0.744 0.256
#> SRR390487 1 0.821 0.705 0.744 0.256
#> SRR390488 1 0.821 0.705 0.744 0.256
#> SRR390489 1 0.821 0.705 0.744 0.256
#> SRR390492 1 0.000 0.873 1.000 0.000
#> SRR390493 1 0.000 0.873 1.000 0.000
#> SRR390494 1 0.000 0.873 1.000 0.000
#> SRR390495 1 0.000 0.873 1.000 0.000
#> SRR390496 1 0.000 0.873 1.000 0.000
#> SRR390497 2 0.000 0.705 0.000 1.000
#> SRR390498 2 0.000 0.705 0.000 1.000
#> SRR390499 1 0.000 0.873 1.000 0.000
#> SRR390500 1 0.000 0.873 1.000 0.000
#> SRR390501 1 0.821 0.705 0.744 0.256
#> SRR390502 1 0.821 0.705 0.744 0.256
#> SRR390503 1 0.821 0.705 0.744 0.256
#> SRR390504 2 0.999 0.186 0.480 0.520
#> SRR390505 2 0.998 0.213 0.472 0.528
#> SRR390506 2 0.998 0.213 0.472 0.528
#> SRR390507 1 0.000 0.873 1.000 0.000
#> SRR390508 1 0.000 0.873 1.000 0.000
#> SRR390509 1 0.000 0.873 1.000 0.000
#> SRR390510 1 0.000 0.873 1.000 0.000
#> SRR390512 1 0.000 0.873 1.000 0.000
#> SRR390513 1 0.000 0.873 1.000 0.000
#> SRR390514 1 0.000 0.873 1.000 0.000
#> SRR390515 1 0.644 0.813 0.836 0.164
#> SRR390516 2 0.999 0.186 0.480 0.520
#> SRR390517 1 0.000 0.873 1.000 0.000
#> SRR390519 2 0.000 0.705 0.000 1.000
#> SRR390520 1 0.000 0.873 1.000 0.000
#> SRR390521 1 0.000 0.873 1.000 0.000
#> SRR390522 1 0.000 0.873 1.000 0.000
#> SRR390523 1 0.000 0.873 1.000 0.000
#> SRR390524 1 0.644 0.813 0.836 0.164
#> SRR390525 1 0.644 0.813 0.836 0.164
#> SRR390526 1 0.644 0.813 0.836 0.164
#> SRR390527 1 0.644 0.813 0.836 0.164
#> SRR390528 1 0.000 0.873 1.000 0.000
#> SRR390529 1 0.775 0.746 0.772 0.228
#> SRR390530 1 0.644 0.813 0.836 0.164
#> SRR390531 1 0.644 0.813 0.836 0.164
#> SRR390532 1 0.000 0.873 1.000 0.000
#> SRR390533 1 0.000 0.873 1.000 0.000
#> SRR390534 1 0.000 0.873 1.000 0.000
#> SRR390535 1 0.000 0.873 1.000 0.000
#> SRR390536 1 0.000 0.873 1.000 0.000
#> SRR390537 1 0.000 0.873 1.000 0.000
#> SRR390538 1 0.775 0.746 0.772 0.228
#> SRR390539 1 0.775 0.746 0.772 0.228
#> SRR390540 1 0.775 0.746 0.772 0.228
#> SRR390541 1 0.775 0.746 0.772 0.228
#> SRR390542 1 0.000 0.873 1.000 0.000
#> SRR390543 1 0.000 0.873 1.000 0.000
#> SRR390544 1 0.000 0.873 1.000 0.000
#> SRR390545 1 0.000 0.873 1.000 0.000
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.304 0.879 0.896 0.104 0.000
#> SRR390471 1 0.304 0.879 0.896 0.104 0.000
#> SRR390472 1 0.304 0.879 0.896 0.104 0.000
#> SRR390473 1 0.304 0.879 0.896 0.104 0.000
#> SRR390474 2 0.506 1.000 0.244 0.756 0.000
#> SRR390475 1 0.304 0.879 0.896 0.104 0.000
#> SRR390476 1 0.304 0.879 0.896 0.104 0.000
#> SRR390477 1 0.304 0.879 0.896 0.104 0.000
#> SRR390478 1 0.304 0.879 0.896 0.104 0.000
#> SRR390480 2 0.506 1.000 0.244 0.756 0.000
#> SRR390481 2 0.506 1.000 0.244 0.756 0.000
#> SRR390482 2 0.506 1.000 0.244 0.756 0.000
#> SRR390483 2 0.506 1.000 0.244 0.756 0.000
#> SRR390484 3 0.000 1.000 0.000 0.000 1.000
#> SRR390485 3 0.000 1.000 0.000 0.000 1.000
#> SRR390486 1 0.000 0.872 1.000 0.000 0.000
#> SRR390487 1 0.000 0.872 1.000 0.000 0.000
#> SRR390488 1 0.000 0.872 1.000 0.000 0.000
#> SRR390489 1 0.000 0.872 1.000 0.000 0.000
#> SRR390492 2 0.506 1.000 0.244 0.756 0.000
#> SRR390493 2 0.506 1.000 0.244 0.756 0.000
#> SRR390494 2 0.506 1.000 0.244 0.756 0.000
#> SRR390495 2 0.506 1.000 0.244 0.756 0.000
#> SRR390496 2 0.506 1.000 0.244 0.756 0.000
#> SRR390497 3 0.000 1.000 0.000 0.000 1.000
#> SRR390498 3 0.000 1.000 0.000 0.000 1.000
#> SRR390499 2 0.506 1.000 0.244 0.756 0.000
#> SRR390500 2 0.506 1.000 0.244 0.756 0.000
#> SRR390501 1 0.000 0.872 1.000 0.000 0.000
#> SRR390502 1 0.000 0.872 1.000 0.000 0.000
#> SRR390503 1 0.000 0.872 1.000 0.000 0.000
#> SRR390504 1 0.590 0.512 0.736 0.244 0.020
#> SRR390505 1 0.687 0.498 0.700 0.244 0.056
#> SRR390506 1 0.687 0.498 0.700 0.244 0.056
#> SRR390507 2 0.506 1.000 0.244 0.756 0.000
#> SRR390508 2 0.506 1.000 0.244 0.756 0.000
#> SRR390509 2 0.506 1.000 0.244 0.756 0.000
#> SRR390510 2 0.506 1.000 0.244 0.756 0.000
#> SRR390512 2 0.506 1.000 0.244 0.756 0.000
#> SRR390513 2 0.506 1.000 0.244 0.756 0.000
#> SRR390514 2 0.506 1.000 0.244 0.756 0.000
#> SRR390515 1 0.304 0.879 0.896 0.104 0.000
#> SRR390516 1 0.590 0.512 0.736 0.244 0.020
#> SRR390517 2 0.506 1.000 0.244 0.756 0.000
#> SRR390519 3 0.000 1.000 0.000 0.000 1.000
#> SRR390520 2 0.506 1.000 0.244 0.756 0.000
#> SRR390521 2 0.506 1.000 0.244 0.756 0.000
#> SRR390522 2 0.506 1.000 0.244 0.756 0.000
#> SRR390523 2 0.506 1.000 0.244 0.756 0.000
#> SRR390524 1 0.304 0.879 0.896 0.104 0.000
#> SRR390525 1 0.304 0.879 0.896 0.104 0.000
#> SRR390526 1 0.304 0.879 0.896 0.104 0.000
#> SRR390527 1 0.304 0.879 0.896 0.104 0.000
#> SRR390528 2 0.506 1.000 0.244 0.756 0.000
#> SRR390529 1 0.141 0.884 0.964 0.036 0.000
#> SRR390530 1 0.304 0.879 0.896 0.104 0.000
#> SRR390531 1 0.304 0.879 0.896 0.104 0.000
#> SRR390532 2 0.506 1.000 0.244 0.756 0.000
#> SRR390533 2 0.506 1.000 0.244 0.756 0.000
#> SRR390534 2 0.506 1.000 0.244 0.756 0.000
#> SRR390535 2 0.506 1.000 0.244 0.756 0.000
#> SRR390536 2 0.506 1.000 0.244 0.756 0.000
#> SRR390537 2 0.506 1.000 0.244 0.756 0.000
#> SRR390538 1 0.141 0.884 0.964 0.036 0.000
#> SRR390539 1 0.141 0.884 0.964 0.036 0.000
#> SRR390540 1 0.141 0.884 0.964 0.036 0.000
#> SRR390541 1 0.141 0.884 0.964 0.036 0.000
#> SRR390542 2 0.506 1.000 0.244 0.756 0.000
#> SRR390543 2 0.506 1.000 0.244 0.756 0.000
#> SRR390544 2 0.506 1.000 0.244 0.756 0.000
#> SRR390545 2 0.506 1.000 0.244 0.756 0.000
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.401 0.736 0.756 0.000 0.000 0.244
#> SRR390471 1 0.401 0.736 0.756 0.000 0.000 0.244
#> SRR390472 1 0.401 0.736 0.756 0.000 0.000 0.244
#> SRR390473 1 0.401 0.736 0.756 0.000 0.000 0.244
#> SRR390474 4 0.130 0.949 0.044 0.000 0.000 0.956
#> SRR390475 1 0.401 0.736 0.756 0.000 0.000 0.244
#> SRR390476 1 0.401 0.736 0.756 0.000 0.000 0.244
#> SRR390477 1 0.179 0.813 0.932 0.000 0.000 0.068
#> SRR390478 1 0.179 0.813 0.932 0.000 0.000 0.068
#> SRR390480 4 0.000 0.975 0.000 0.000 0.000 1.000
#> SRR390481 4 0.000 0.975 0.000 0.000 0.000 1.000
#> SRR390482 4 0.000 0.975 0.000 0.000 0.000 1.000
#> SRR390483 4 0.000 0.975 0.000 0.000 0.000 1.000
#> SRR390484 2 0.000 1.000 0.000 1.000 0.000 0.000
#> SRR390485 2 0.000 1.000 0.000 1.000 0.000 0.000
#> SRR390486 3 0.438 0.913 0.296 0.000 0.704 0.000
#> SRR390487 3 0.438 0.913 0.296 0.000 0.704 0.000
#> SRR390488 3 0.438 0.913 0.296 0.000 0.704 0.000
#> SRR390489 3 0.438 0.913 0.296 0.000 0.704 0.000
#> SRR390492 4 0.000 0.975 0.000 0.000 0.000 1.000
#> SRR390493 4 0.000 0.975 0.000 0.000 0.000 1.000
#> SRR390494 4 0.000 0.975 0.000 0.000 0.000 1.000
#> SRR390495 4 0.000 0.975 0.000 0.000 0.000 1.000
#> SRR390496 4 0.000 0.975 0.000 0.000 0.000 1.000
#> SRR390497 2 0.000 1.000 0.000 1.000 0.000 0.000
#> SRR390498 2 0.000 1.000 0.000 1.000 0.000 0.000
#> SRR390499 4 0.000 0.975 0.000 0.000 0.000 1.000
#> SRR390500 4 0.000 0.975 0.000 0.000 0.000 1.000
#> SRR390501 3 0.438 0.913 0.296 0.000 0.704 0.000
#> SRR390502 3 0.438 0.913 0.296 0.000 0.704 0.000
#> SRR390503 3 0.438 0.913 0.296 0.000 0.704 0.000
#> SRR390504 3 0.102 0.650 0.032 0.000 0.968 0.000
#> SRR390505 1 0.520 0.535 0.700 0.036 0.264 0.000
#> SRR390506 1 0.520 0.535 0.700 0.036 0.264 0.000
#> SRR390507 4 0.102 0.970 0.000 0.000 0.032 0.968
#> SRR390508 4 0.102 0.970 0.000 0.000 0.032 0.968
#> SRR390509 4 0.102 0.970 0.000 0.000 0.032 0.968
#> SRR390510 4 0.102 0.970 0.000 0.000 0.032 0.968
#> SRR390512 4 0.102 0.970 0.000 0.000 0.032 0.968
#> SRR390513 4 0.102 0.970 0.000 0.000 0.032 0.968
#> SRR390514 4 0.102 0.970 0.000 0.000 0.032 0.968
#> SRR390515 1 0.401 0.736 0.756 0.000 0.000 0.244
#> SRR390516 3 0.102 0.650 0.032 0.000 0.968 0.000
#> SRR390517 4 0.102 0.970 0.000 0.000 0.032 0.968
#> SRR390519 2 0.000 1.000 0.000 1.000 0.000 0.000
#> SRR390520 4 0.130 0.949 0.044 0.000 0.000 0.956
#> SRR390521 4 0.130 0.949 0.044 0.000 0.000 0.956
#> SRR390522 4 0.130 0.949 0.044 0.000 0.000 0.956
#> SRR390523 4 0.130 0.949 0.044 0.000 0.000 0.956
#> SRR390524 1 0.179 0.813 0.932 0.000 0.000 0.068
#> SRR390525 1 0.179 0.813 0.932 0.000 0.000 0.068
#> SRR390526 1 0.179 0.813 0.932 0.000 0.000 0.068
#> SRR390527 1 0.179 0.813 0.932 0.000 0.000 0.068
#> SRR390528 4 0.000 0.975 0.000 0.000 0.000 1.000
#> SRR390529 1 0.000 0.761 1.000 0.000 0.000 0.000
#> SRR390530 1 0.179 0.813 0.932 0.000 0.000 0.068
#> SRR390531 1 0.179 0.813 0.932 0.000 0.000 0.068
#> SRR390532 4 0.000 0.975 0.000 0.000 0.000 1.000
#> SRR390533 4 0.164 0.933 0.060 0.000 0.000 0.940
#> SRR390534 4 0.164 0.933 0.060 0.000 0.000 0.940
#> SRR390535 4 0.164 0.933 0.060 0.000 0.000 0.940
#> SRR390536 4 0.000 0.975 0.000 0.000 0.000 1.000
#> SRR390537 4 0.000 0.975 0.000 0.000 0.000 1.000
#> SRR390538 1 0.000 0.761 1.000 0.000 0.000 0.000
#> SRR390539 1 0.000 0.761 1.000 0.000 0.000 0.000
#> SRR390540 1 0.000 0.761 1.000 0.000 0.000 0.000
#> SRR390541 1 0.000 0.761 1.000 0.000 0.000 0.000
#> SRR390542 4 0.102 0.970 0.000 0.000 0.032 0.968
#> SRR390543 4 0.102 0.970 0.000 0.000 0.032 0.968
#> SRR390544 4 0.102 0.970 0.000 0.000 0.032 0.968
#> SRR390545 4 0.102 0.970 0.000 0.000 0.032 0.968
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 4 0.4101 -0.346 0.372 0.000 0.000 0.628 0.000
#> SRR390471 4 0.4101 -0.346 0.372 0.000 0.000 0.628 0.000
#> SRR390472 4 0.4101 -0.346 0.372 0.000 0.000 0.628 0.000
#> SRR390473 4 0.4101 -0.346 0.372 0.000 0.000 0.628 0.000
#> SRR390474 4 0.4948 -0.344 0.028 0.436 0.000 0.536 0.000
#> SRR390475 4 0.4101 -0.346 0.372 0.000 0.000 0.628 0.000
#> SRR390476 4 0.4101 -0.346 0.372 0.000 0.000 0.628 0.000
#> SRR390477 1 0.4262 0.686 0.560 0.000 0.000 0.440 0.000
#> SRR390478 1 0.4262 0.686 0.560 0.000 0.000 0.440 0.000
#> SRR390480 2 0.4101 0.596 0.000 0.628 0.000 0.372 0.000
#> SRR390481 2 0.4101 0.596 0.000 0.628 0.000 0.372 0.000
#> SRR390482 2 0.4101 0.596 0.000 0.628 0.000 0.372 0.000
#> SRR390483 2 0.4101 0.596 0.000 0.628 0.000 0.372 0.000
#> SRR390484 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR390485 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR390486 3 0.3863 0.909 0.248 0.000 0.740 0.012 0.000
#> SRR390487 3 0.3863 0.909 0.248 0.000 0.740 0.012 0.000
#> SRR390488 3 0.3863 0.909 0.248 0.000 0.740 0.012 0.000
#> SRR390489 3 0.3863 0.909 0.248 0.000 0.740 0.012 0.000
#> SRR390492 2 0.4088 0.596 0.000 0.632 0.000 0.368 0.000
#> SRR390493 2 0.4088 0.596 0.000 0.632 0.000 0.368 0.000
#> SRR390494 2 0.4088 0.596 0.000 0.632 0.000 0.368 0.000
#> SRR390495 2 0.4088 0.596 0.000 0.632 0.000 0.368 0.000
#> SRR390496 2 0.4088 0.596 0.000 0.632 0.000 0.368 0.000
#> SRR390497 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR390498 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR390499 2 0.4101 0.596 0.000 0.628 0.000 0.372 0.000
#> SRR390500 2 0.4101 0.596 0.000 0.628 0.000 0.372 0.000
#> SRR390501 3 0.3863 0.909 0.248 0.000 0.740 0.012 0.000
#> SRR390502 3 0.3863 0.909 0.248 0.000 0.740 0.012 0.000
#> SRR390503 3 0.3863 0.909 0.248 0.000 0.740 0.012 0.000
#> SRR390504 3 0.0162 0.663 0.004 0.000 0.996 0.000 0.000
#> SRR390505 1 0.4455 0.332 0.704 0.000 0.260 0.000 0.036
#> SRR390506 1 0.4455 0.332 0.704 0.000 0.260 0.000 0.036
#> SRR390507 2 0.2891 0.506 0.000 0.824 0.000 0.176 0.000
#> SRR390508 2 0.2891 0.506 0.000 0.824 0.000 0.176 0.000
#> SRR390509 2 0.2891 0.506 0.000 0.824 0.000 0.176 0.000
#> SRR390510 2 0.2891 0.506 0.000 0.824 0.000 0.176 0.000
#> SRR390512 2 0.2891 0.506 0.000 0.824 0.000 0.176 0.000
#> SRR390513 2 0.2891 0.506 0.000 0.824 0.000 0.176 0.000
#> SRR390514 2 0.2891 0.506 0.000 0.824 0.000 0.176 0.000
#> SRR390515 4 0.4101 -0.346 0.372 0.000 0.000 0.628 0.000
#> SRR390516 3 0.0162 0.663 0.004 0.000 0.996 0.000 0.000
#> SRR390517 2 0.2891 0.506 0.000 0.824 0.000 0.176 0.000
#> SRR390519 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR390520 4 0.4948 -0.344 0.028 0.436 0.000 0.536 0.000
#> SRR390521 4 0.4948 -0.344 0.028 0.436 0.000 0.536 0.000
#> SRR390522 4 0.4948 -0.344 0.028 0.436 0.000 0.536 0.000
#> SRR390523 4 0.4948 -0.344 0.028 0.436 0.000 0.536 0.000
#> SRR390524 1 0.4262 0.686 0.560 0.000 0.000 0.440 0.000
#> SRR390525 1 0.4262 0.686 0.560 0.000 0.000 0.440 0.000
#> SRR390526 1 0.4262 0.686 0.560 0.000 0.000 0.440 0.000
#> SRR390527 1 0.4262 0.686 0.560 0.000 0.000 0.440 0.000
#> SRR390528 2 0.4101 0.596 0.000 0.628 0.000 0.372 0.000
#> SRR390529 1 0.0162 0.583 0.996 0.000 0.000 0.004 0.000
#> SRR390530 1 0.4262 0.686 0.560 0.000 0.000 0.440 0.000
#> SRR390531 1 0.4262 0.686 0.560 0.000 0.000 0.440 0.000
#> SRR390532 2 0.4101 0.596 0.000 0.628 0.000 0.372 0.000
#> SRR390533 4 0.5211 -0.329 0.044 0.432 0.000 0.524 0.000
#> SRR390534 4 0.5211 -0.329 0.044 0.432 0.000 0.524 0.000
#> SRR390535 4 0.5211 -0.329 0.044 0.432 0.000 0.524 0.000
#> SRR390536 2 0.4088 0.596 0.000 0.632 0.000 0.368 0.000
#> SRR390537 2 0.4088 0.596 0.000 0.632 0.000 0.368 0.000
#> SRR390538 1 0.0162 0.583 0.996 0.000 0.000 0.004 0.000
#> SRR390539 1 0.0162 0.583 0.996 0.000 0.000 0.004 0.000
#> SRR390540 1 0.0162 0.583 0.996 0.000 0.000 0.004 0.000
#> SRR390541 1 0.0162 0.583 0.996 0.000 0.000 0.004 0.000
#> SRR390542 2 0.2891 0.506 0.000 0.824 0.000 0.176 0.000
#> SRR390543 2 0.2891 0.506 0.000 0.824 0.000 0.176 0.000
#> SRR390544 2 0.2891 0.506 0.000 0.824 0.000 0.176 0.000
#> SRR390545 2 0.2891 0.506 0.000 0.824 0.000 0.176 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.312 0.808 0.804 0.176 0.020 0.000 0 0.000
#> SRR390471 1 0.312 0.808 0.804 0.176 0.020 0.000 0 0.000
#> SRR390472 1 0.312 0.808 0.804 0.176 0.020 0.000 0 0.000
#> SRR390473 1 0.312 0.808 0.804 0.176 0.020 0.000 0 0.000
#> SRR390474 4 0.391 0.785 0.020 0.200 0.024 0.756 0 0.000
#> SRR390475 1 0.312 0.808 0.804 0.176 0.020 0.000 0 0.000
#> SRR390476 1 0.312 0.808 0.804 0.176 0.020 0.000 0 0.000
#> SRR390477 1 0.000 0.815 1.000 0.000 0.000 0.000 0 0.000
#> SRR390478 1 0.000 0.815 1.000 0.000 0.000 0.000 0 0.000
#> SRR390480 4 0.107 0.856 0.000 0.000 0.000 0.952 0 0.048
#> SRR390481 4 0.107 0.856 0.000 0.000 0.000 0.952 0 0.048
#> SRR390482 4 0.107 0.856 0.000 0.000 0.000 0.952 0 0.048
#> SRR390483 4 0.107 0.856 0.000 0.000 0.000 0.952 0 0.048
#> SRR390484 5 0.000 1.000 0.000 0.000 0.000 0.000 1 0.000
#> SRR390485 5 0.000 1.000 0.000 0.000 0.000 0.000 1 0.000
#> SRR390486 3 0.000 0.939 0.000 0.000 1.000 0.000 0 0.000
#> SRR390487 3 0.000 0.939 0.000 0.000 1.000 0.000 0 0.000
#> SRR390488 3 0.000 0.939 0.000 0.000 1.000 0.000 0 0.000
#> SRR390489 3 0.000 0.939 0.000 0.000 1.000 0.000 0 0.000
#> SRR390492 4 0.101 0.869 0.000 0.044 0.000 0.956 0 0.000
#> SRR390493 4 0.101 0.869 0.000 0.044 0.000 0.956 0 0.000
#> SRR390494 4 0.101 0.869 0.000 0.044 0.000 0.956 0 0.000
#> SRR390495 4 0.101 0.869 0.000 0.044 0.000 0.956 0 0.000
#> SRR390496 4 0.101 0.869 0.000 0.044 0.000 0.956 0 0.000
#> SRR390497 5 0.000 1.000 0.000 0.000 0.000 0.000 1 0.000
#> SRR390498 5 0.000 1.000 0.000 0.000 0.000 0.000 1 0.000
#> SRR390499 4 0.107 0.856 0.000 0.000 0.000 0.952 0 0.048
#> SRR390500 4 0.107 0.856 0.000 0.000 0.000 0.952 0 0.048
#> SRR390501 3 0.000 0.939 0.000 0.000 1.000 0.000 0 0.000
#> SRR390502 3 0.000 0.939 0.000 0.000 1.000 0.000 0 0.000
#> SRR390503 3 0.000 0.939 0.000 0.000 1.000 0.000 0 0.000
#> SRR390504 3 0.322 0.767 0.000 0.000 0.736 0.000 0 0.264
#> SRR390505 6 0.107 0.666 0.048 0.000 0.000 0.000 0 0.952
#> SRR390506 6 0.107 0.666 0.048 0.000 0.000 0.000 0 0.952
#> SRR390507 2 0.000 1.000 0.000 1.000 0.000 0.000 0 0.000
#> SRR390508 2 0.000 1.000 0.000 1.000 0.000 0.000 0 0.000
#> SRR390509 2 0.000 1.000 0.000 1.000 0.000 0.000 0 0.000
#> SRR390510 2 0.000 1.000 0.000 1.000 0.000 0.000 0 0.000
#> SRR390512 2 0.000 1.000 0.000 1.000 0.000 0.000 0 0.000
#> SRR390513 2 0.000 1.000 0.000 1.000 0.000 0.000 0 0.000
#> SRR390514 2 0.000 1.000 0.000 1.000 0.000 0.000 0 0.000
#> SRR390515 1 0.312 0.808 0.804 0.176 0.020 0.000 0 0.000
#> SRR390516 3 0.322 0.767 0.000 0.000 0.736 0.000 0 0.264
#> SRR390517 2 0.000 1.000 0.000 1.000 0.000 0.000 0 0.000
#> SRR390519 5 0.000 1.000 0.000 0.000 0.000 0.000 1 0.000
#> SRR390520 4 0.391 0.785 0.020 0.200 0.024 0.756 0 0.000
#> SRR390521 4 0.391 0.785 0.020 0.200 0.024 0.756 0 0.000
#> SRR390522 4 0.391 0.785 0.020 0.200 0.024 0.756 0 0.000
#> SRR390523 4 0.391 0.785 0.020 0.200 0.024 0.756 0 0.000
#> SRR390524 1 0.000 0.815 1.000 0.000 0.000 0.000 0 0.000
#> SRR390525 1 0.000 0.815 1.000 0.000 0.000 0.000 0 0.000
#> SRR390526 1 0.000 0.815 1.000 0.000 0.000 0.000 0 0.000
#> SRR390527 1 0.000 0.815 1.000 0.000 0.000 0.000 0 0.000
#> SRR390528 4 0.107 0.856 0.000 0.000 0.000 0.952 0 0.048
#> SRR390529 6 0.373 0.872 0.344 0.000 0.004 0.000 0 0.652
#> SRR390530 1 0.000 0.815 1.000 0.000 0.000 0.000 0 0.000
#> SRR390531 1 0.000 0.815 1.000 0.000 0.000 0.000 0 0.000
#> SRR390532 4 0.107 0.856 0.000 0.000 0.000 0.952 0 0.048
#> SRR390533 4 0.442 0.776 0.036 0.196 0.024 0.736 0 0.008
#> SRR390534 4 0.442 0.776 0.036 0.196 0.024 0.736 0 0.008
#> SRR390535 4 0.442 0.776 0.036 0.196 0.024 0.736 0 0.008
#> SRR390536 4 0.101 0.869 0.000 0.044 0.000 0.956 0 0.000
#> SRR390537 4 0.101 0.869 0.000 0.044 0.000 0.956 0 0.000
#> SRR390538 6 0.373 0.872 0.344 0.000 0.004 0.000 0 0.652
#> SRR390539 6 0.373 0.872 0.344 0.000 0.004 0.000 0 0.652
#> SRR390540 6 0.373 0.872 0.344 0.000 0.004 0.000 0 0.652
#> SRR390541 6 0.373 0.872 0.344 0.000 0.004 0.000 0 0.652
#> SRR390542 2 0.000 1.000 0.000 1.000 0.000 0.000 0 0.000
#> SRR390543 2 0.000 1.000 0.000 1.000 0.000 0.000 0 0.000
#> SRR390544 2 0.000 1.000 0.000 1.000 0.000 0.000 0 0.000
#> SRR390545 2 0.000 1.000 0.000 1.000 0.000 0.000 0 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
MAD:kmeans
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"]
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 15244 rows and 71 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'kmeans' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 3.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)

The plots are:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.194 0.544 0.725 0.4634 0.495 0.495
#> 3 3 0.344 0.590 0.758 0.3526 0.786 0.597
#> 4 4 0.403 0.620 0.721 0.1391 0.786 0.472
#> 5 5 0.562 0.687 0.741 0.0800 0.928 0.736
#> 6 6 0.636 0.538 0.678 0.0517 0.933 0.733
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
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.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.932 0.5582 0.652 0.348
#> SRR390471 1 0.932 0.5582 0.652 0.348
#> SRR390472 1 0.343 0.6282 0.936 0.064
#> SRR390473 1 0.343 0.6282 0.936 0.064
#> SRR390474 2 0.855 0.5376 0.280 0.720
#> SRR390475 1 0.932 0.5582 0.652 0.348
#> SRR390476 1 0.932 0.5582 0.652 0.348
#> SRR390477 1 0.900 0.5864 0.684 0.316
#> SRR390478 1 0.900 0.5864 0.684 0.316
#> SRR390480 2 0.839 0.5538 0.268 0.732
#> SRR390481 2 0.839 0.5538 0.268 0.732
#> SRR390482 2 0.891 0.5791 0.308 0.692
#> SRR390483 2 0.891 0.5791 0.308 0.692
#> SRR390484 1 0.961 0.1732 0.616 0.384
#> SRR390485 1 0.961 0.1732 0.616 0.384
#> SRR390486 1 0.343 0.6034 0.936 0.064
#> SRR390487 1 0.343 0.6034 0.936 0.064
#> SRR390488 1 0.541 0.6277 0.876 0.124
#> SRR390489 1 0.541 0.6277 0.876 0.124
#> SRR390492 2 0.584 0.6778 0.140 0.860
#> SRR390493 2 0.584 0.6778 0.140 0.860
#> SRR390494 2 0.443 0.7090 0.092 0.908
#> SRR390495 2 0.388 0.7147 0.076 0.924
#> SRR390496 2 0.388 0.7147 0.076 0.924
#> SRR390497 1 0.961 0.1732 0.616 0.384
#> SRR390498 1 0.988 0.0780 0.564 0.436
#> SRR390499 2 0.839 0.5538 0.268 0.732
#> SRR390500 2 0.839 0.5538 0.268 0.732
#> SRR390501 1 0.827 0.6028 0.740 0.260
#> SRR390502 1 0.827 0.6028 0.740 0.260
#> SRR390503 1 0.343 0.6034 0.936 0.064
#> SRR390504 1 0.343 0.6034 0.936 0.064
#> SRR390505 1 0.416 0.6375 0.916 0.084
#> SRR390506 1 0.141 0.6165 0.980 0.020
#> SRR390507 2 0.482 0.6747 0.104 0.896
#> SRR390508 2 0.482 0.6747 0.104 0.896
#> SRR390509 2 0.482 0.6747 0.104 0.896
#> SRR390510 2 0.482 0.6747 0.104 0.896
#> SRR390512 2 0.163 0.7142 0.024 0.976
#> SRR390513 2 0.163 0.7142 0.024 0.976
#> SRR390514 2 0.163 0.7142 0.024 0.976
#> SRR390515 1 0.482 0.6385 0.896 0.104
#> SRR390516 1 0.327 0.6052 0.940 0.060
#> SRR390517 2 0.932 0.3262 0.348 0.652
#> SRR390519 1 0.961 0.1732 0.616 0.384
#> SRR390520 1 0.738 0.4733 0.792 0.208
#> SRR390521 2 0.861 0.5339 0.284 0.716
#> SRR390522 2 0.861 0.5339 0.284 0.716
#> SRR390523 2 0.861 0.5339 0.284 0.716
#> SRR390524 1 0.900 0.5864 0.684 0.316
#> SRR390525 1 0.900 0.5864 0.684 0.316
#> SRR390526 1 0.925 0.5782 0.660 0.340
#> SRR390527 1 0.925 0.5782 0.660 0.340
#> SRR390528 2 0.985 0.3453 0.428 0.572
#> SRR390529 1 0.443 0.6382 0.908 0.092
#> SRR390530 1 0.900 0.5864 0.684 0.316
#> SRR390531 1 0.900 0.5864 0.684 0.316
#> SRR390532 1 0.971 0.0254 0.600 0.400
#> SRR390533 2 0.990 0.0543 0.440 0.560
#> SRR390534 2 0.990 0.0543 0.440 0.560
#> SRR390535 2 0.990 0.0543 0.440 0.560
#> SRR390536 2 0.388 0.7147 0.076 0.924
#> SRR390537 2 0.388 0.7147 0.076 0.924
#> SRR390538 1 0.932 0.5582 0.652 0.348
#> SRR390539 1 0.932 0.5582 0.652 0.348
#> SRR390540 1 0.932 0.5582 0.652 0.348
#> SRR390541 1 0.932 0.5582 0.652 0.348
#> SRR390542 2 0.163 0.7142 0.024 0.976
#> SRR390543 2 0.163 0.7142 0.024 0.976
#> SRR390544 2 0.163 0.7142 0.024 0.976
#> SRR390545 2 0.163 0.7142 0.024 0.976
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.215 0.7700 0.948 0.036 0.016
#> SRR390471 1 0.215 0.7700 0.948 0.036 0.016
#> SRR390472 1 0.550 0.6145 0.772 0.020 0.208
#> SRR390473 1 0.550 0.6145 0.772 0.020 0.208
#> SRR390474 2 0.942 0.4814 0.352 0.464 0.184
#> SRR390475 1 0.215 0.7700 0.948 0.036 0.016
#> SRR390476 1 0.215 0.7700 0.948 0.036 0.016
#> SRR390477 1 0.311 0.7713 0.916 0.028 0.056
#> SRR390478 1 0.311 0.7713 0.916 0.028 0.056
#> SRR390480 2 0.934 0.5315 0.324 0.492 0.184
#> SRR390481 2 0.934 0.5315 0.324 0.492 0.184
#> SRR390482 2 0.953 0.5427 0.272 0.488 0.240
#> SRR390483 2 0.951 0.5469 0.284 0.488 0.228
#> SRR390484 3 0.421 0.7180 0.020 0.120 0.860
#> SRR390485 3 0.421 0.7180 0.020 0.120 0.860
#> SRR390486 3 0.645 0.6671 0.252 0.036 0.712
#> SRR390487 3 0.645 0.6671 0.252 0.036 0.712
#> SRR390488 1 0.752 0.2155 0.568 0.044 0.388
#> SRR390489 1 0.752 0.2155 0.568 0.044 0.388
#> SRR390492 2 0.792 0.6010 0.108 0.644 0.248
#> SRR390493 2 0.792 0.6010 0.108 0.644 0.248
#> SRR390494 2 0.837 0.6235 0.144 0.616 0.240
#> SRR390495 2 0.817 0.6405 0.148 0.640 0.212
#> SRR390496 2 0.817 0.6405 0.148 0.640 0.212
#> SRR390497 3 0.421 0.7180 0.020 0.120 0.860
#> SRR390498 3 0.594 0.6386 0.020 0.248 0.732
#> SRR390499 2 0.934 0.5315 0.324 0.492 0.184
#> SRR390500 2 0.934 0.5315 0.324 0.492 0.184
#> SRR390501 1 0.731 0.3287 0.616 0.044 0.340
#> SRR390502 1 0.731 0.3287 0.616 0.044 0.340
#> SRR390503 3 0.554 0.7131 0.200 0.024 0.776
#> SRR390504 3 0.520 0.7176 0.184 0.020 0.796
#> SRR390505 1 0.525 0.5201 0.736 0.000 0.264
#> SRR390506 3 0.603 0.4593 0.376 0.000 0.624
#> SRR390507 2 0.292 0.6030 0.032 0.924 0.044
#> SRR390508 2 0.292 0.6030 0.032 0.924 0.044
#> SRR390509 2 0.292 0.6030 0.032 0.924 0.044
#> SRR390510 2 0.292 0.6030 0.032 0.924 0.044
#> SRR390512 2 0.230 0.6381 0.060 0.936 0.004
#> SRR390513 2 0.230 0.6381 0.060 0.936 0.004
#> SRR390514 2 0.230 0.6381 0.060 0.936 0.004
#> SRR390515 1 0.400 0.6775 0.840 0.000 0.160
#> SRR390516 3 0.558 0.7103 0.204 0.024 0.772
#> SRR390517 2 0.668 -0.3354 0.008 0.508 0.484
#> SRR390519 3 0.421 0.7180 0.020 0.120 0.860
#> SRR390520 3 0.673 0.6275 0.184 0.080 0.736
#> SRR390521 2 0.945 0.4726 0.364 0.452 0.184
#> SRR390522 2 0.945 0.4726 0.364 0.452 0.184
#> SRR390523 2 0.945 0.4726 0.364 0.452 0.184
#> SRR390524 1 0.311 0.7713 0.916 0.028 0.056
#> SRR390525 1 0.311 0.7713 0.916 0.028 0.056
#> SRR390526 1 0.353 0.7658 0.900 0.032 0.068
#> SRR390527 1 0.353 0.7658 0.900 0.032 0.068
#> SRR390528 3 0.827 0.3863 0.212 0.156 0.632
#> SRR390529 1 0.424 0.6515 0.824 0.000 0.176
#> SRR390530 1 0.311 0.7713 0.916 0.028 0.056
#> SRR390531 1 0.311 0.7713 0.916 0.028 0.056
#> SRR390532 3 0.720 0.5610 0.124 0.160 0.716
#> SRR390533 1 0.884 0.1203 0.568 0.268 0.164
#> SRR390534 1 0.884 0.1203 0.568 0.268 0.164
#> SRR390535 1 0.893 0.0961 0.556 0.276 0.168
#> SRR390536 2 0.817 0.6405 0.148 0.640 0.212
#> SRR390537 2 0.817 0.6405 0.148 0.640 0.212
#> SRR390538 1 0.145 0.7741 0.968 0.024 0.008
#> SRR390539 1 0.145 0.7741 0.968 0.024 0.008
#> SRR390540 1 0.145 0.7741 0.968 0.024 0.008
#> SRR390541 1 0.145 0.7741 0.968 0.024 0.008
#> SRR390542 2 0.230 0.6381 0.060 0.936 0.004
#> SRR390543 2 0.230 0.6381 0.060 0.936 0.004
#> SRR390544 2 0.230 0.6381 0.060 0.936 0.004
#> SRR390545 2 0.230 0.6381 0.060 0.936 0.004
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.3222 0.8540 0.884 0.004 0.036 0.076
#> SRR390471 1 0.3222 0.8540 0.884 0.004 0.036 0.076
#> SRR390472 1 0.4579 0.8072 0.812 0.012 0.124 0.052
#> SRR390473 1 0.4579 0.8072 0.812 0.012 0.124 0.052
#> SRR390474 4 0.8104 0.6363 0.176 0.260 0.040 0.524
#> SRR390475 1 0.3222 0.8540 0.884 0.004 0.036 0.076
#> SRR390476 1 0.3222 0.8540 0.884 0.004 0.036 0.076
#> SRR390477 1 0.2750 0.8646 0.908 0.004 0.032 0.056
#> SRR390478 1 0.2750 0.8646 0.908 0.004 0.032 0.056
#> SRR390480 4 0.7109 0.6630 0.132 0.268 0.012 0.588
#> SRR390481 4 0.7109 0.6630 0.132 0.268 0.012 0.588
#> SRR390482 4 0.7594 0.6417 0.124 0.244 0.044 0.588
#> SRR390483 4 0.7502 0.6450 0.116 0.244 0.044 0.596
#> SRR390484 3 0.5881 0.5940 0.020 0.028 0.656 0.296
#> SRR390485 3 0.5881 0.5940 0.020 0.028 0.656 0.296
#> SRR390486 3 0.5748 0.6575 0.144 0.020 0.744 0.092
#> SRR390487 3 0.5748 0.6575 0.144 0.020 0.744 0.092
#> SRR390488 3 0.7247 0.4774 0.316 0.004 0.532 0.148
#> SRR390489 3 0.7247 0.4774 0.316 0.004 0.532 0.148
#> SRR390492 4 0.7203 0.0613 0.016 0.428 0.088 0.468
#> SRR390493 4 0.7203 0.0613 0.016 0.428 0.088 0.468
#> SRR390494 4 0.6813 0.0470 0.020 0.460 0.052 0.468
#> SRR390495 2 0.6837 -0.1403 0.024 0.468 0.048 0.460
#> SRR390496 2 0.6837 -0.1403 0.024 0.468 0.048 0.460
#> SRR390497 3 0.5881 0.5940 0.020 0.028 0.656 0.296
#> SRR390498 3 0.6990 0.5435 0.024 0.164 0.644 0.168
#> SRR390499 4 0.7109 0.6630 0.132 0.268 0.012 0.588
#> SRR390500 4 0.7109 0.6630 0.132 0.268 0.012 0.588
#> SRR390501 3 0.7289 0.4595 0.328 0.004 0.520 0.148
#> SRR390502 3 0.7289 0.4595 0.328 0.004 0.520 0.148
#> SRR390503 3 0.3767 0.6787 0.084 0.008 0.860 0.048
#> SRR390504 3 0.5173 0.6681 0.072 0.008 0.768 0.152
#> SRR390505 1 0.3877 0.8100 0.840 0.000 0.112 0.048
#> SRR390506 3 0.6928 0.4560 0.308 0.000 0.556 0.136
#> SRR390507 2 0.2466 0.7041 0.000 0.916 0.056 0.028
#> SRR390508 2 0.2466 0.7041 0.000 0.916 0.056 0.028
#> SRR390509 2 0.2466 0.7041 0.000 0.916 0.056 0.028
#> SRR390510 2 0.2466 0.7041 0.000 0.916 0.056 0.028
#> SRR390512 2 0.0592 0.7303 0.000 0.984 0.000 0.016
#> SRR390513 2 0.0592 0.7303 0.000 0.984 0.000 0.016
#> SRR390514 2 0.0592 0.7303 0.000 0.984 0.000 0.016
#> SRR390515 1 0.3222 0.8617 0.884 0.004 0.076 0.036
#> SRR390516 3 0.4024 0.6797 0.100 0.008 0.844 0.048
#> SRR390517 2 0.6449 0.3344 0.000 0.636 0.232 0.132
#> SRR390519 3 0.5881 0.5940 0.020 0.028 0.656 0.296
#> SRR390520 4 0.8682 0.4871 0.172 0.096 0.220 0.512
#> SRR390521 4 0.8086 0.6375 0.184 0.276 0.032 0.508
#> SRR390522 4 0.8086 0.6375 0.184 0.276 0.032 0.508
#> SRR390523 4 0.8086 0.6375 0.184 0.276 0.032 0.508
#> SRR390524 1 0.2750 0.8646 0.908 0.004 0.032 0.056
#> SRR390525 1 0.2750 0.8646 0.908 0.004 0.032 0.056
#> SRR390526 1 0.4045 0.8036 0.824 0.004 0.028 0.144
#> SRR390527 1 0.4045 0.8036 0.824 0.004 0.028 0.144
#> SRR390528 4 0.7883 0.5848 0.120 0.124 0.144 0.612
#> SRR390529 1 0.2983 0.8539 0.892 0.000 0.068 0.040
#> SRR390530 1 0.2750 0.8646 0.908 0.004 0.032 0.056
#> SRR390531 1 0.2750 0.8646 0.908 0.004 0.032 0.056
#> SRR390532 4 0.7744 0.5503 0.084 0.132 0.168 0.616
#> SRR390533 4 0.7735 0.5388 0.340 0.104 0.040 0.516
#> SRR390534 4 0.7735 0.5388 0.340 0.104 0.040 0.516
#> SRR390535 4 0.7284 0.5759 0.296 0.108 0.024 0.572
#> SRR390536 2 0.6837 -0.1403 0.024 0.468 0.048 0.460
#> SRR390537 2 0.6837 -0.1403 0.024 0.468 0.048 0.460
#> SRR390538 1 0.2983 0.8552 0.892 0.000 0.040 0.068
#> SRR390539 1 0.2983 0.8573 0.892 0.000 0.040 0.068
#> SRR390540 1 0.3128 0.8543 0.884 0.000 0.040 0.076
#> SRR390541 1 0.2983 0.8573 0.892 0.000 0.040 0.068
#> SRR390542 2 0.0592 0.7303 0.000 0.984 0.000 0.016
#> SRR390543 2 0.0592 0.7303 0.000 0.984 0.000 0.016
#> SRR390544 2 0.0592 0.7303 0.000 0.984 0.000 0.016
#> SRR390545 2 0.0592 0.7303 0.000 0.984 0.000 0.016
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.439 0.764 0.788 0.000 0.112 0.084 0.016
#> SRR390471 1 0.439 0.764 0.788 0.000 0.112 0.084 0.016
#> SRR390472 1 0.500 0.742 0.780 0.016 0.056 0.064 0.084
#> SRR390473 1 0.500 0.742 0.780 0.016 0.056 0.064 0.084
#> SRR390474 4 0.775 0.541 0.160 0.088 0.220 0.516 0.016
#> SRR390475 1 0.439 0.764 0.788 0.000 0.112 0.084 0.016
#> SRR390476 1 0.439 0.764 0.788 0.000 0.112 0.084 0.016
#> SRR390477 1 0.344 0.773 0.852 0.000 0.080 0.056 0.012
#> SRR390478 1 0.344 0.773 0.852 0.000 0.080 0.056 0.012
#> SRR390480 4 0.290 0.630 0.048 0.080 0.000 0.872 0.000
#> SRR390481 4 0.290 0.630 0.048 0.080 0.000 0.872 0.000
#> SRR390482 4 0.387 0.612 0.052 0.088 0.016 0.836 0.008
#> SRR390483 4 0.380 0.613 0.048 0.088 0.016 0.840 0.008
#> SRR390484 5 0.182 0.759 0.004 0.024 0.000 0.036 0.936
#> SRR390485 5 0.182 0.759 0.004 0.024 0.000 0.036 0.936
#> SRR390486 3 0.640 0.724 0.072 0.004 0.584 0.048 0.292
#> SRR390487 3 0.640 0.724 0.072 0.004 0.584 0.048 0.292
#> SRR390488 3 0.609 0.783 0.140 0.000 0.664 0.052 0.144
#> SRR390489 3 0.609 0.783 0.140 0.000 0.664 0.052 0.144
#> SRR390492 4 0.823 0.417 0.000 0.240 0.144 0.392 0.224
#> SRR390493 4 0.823 0.417 0.000 0.240 0.144 0.392 0.224
#> SRR390494 4 0.807 0.446 0.000 0.236 0.128 0.420 0.216
#> SRR390495 4 0.807 0.446 0.000 0.236 0.128 0.420 0.216
#> SRR390496 4 0.807 0.446 0.000 0.236 0.128 0.420 0.216
#> SRR390497 5 0.182 0.759 0.004 0.024 0.000 0.036 0.936
#> SRR390498 5 0.427 0.586 0.020 0.180 0.028 0.000 0.772
#> SRR390499 4 0.290 0.630 0.048 0.080 0.000 0.872 0.000
#> SRR390500 4 0.290 0.630 0.048 0.080 0.000 0.872 0.000
#> SRR390501 3 0.609 0.783 0.140 0.000 0.664 0.052 0.144
#> SRR390502 3 0.609 0.783 0.140 0.000 0.664 0.052 0.144
#> SRR390503 3 0.569 0.605 0.036 0.000 0.552 0.028 0.384
#> SRR390504 5 0.468 0.236 0.028 0.000 0.260 0.012 0.700
#> SRR390505 1 0.522 0.717 0.732 0.008 0.148 0.016 0.096
#> SRR390506 5 0.585 0.314 0.240 0.008 0.088 0.016 0.648
#> SRR390507 2 0.231 0.915 0.000 0.912 0.060 0.012 0.016
#> SRR390508 2 0.231 0.915 0.000 0.912 0.060 0.012 0.016
#> SRR390509 2 0.231 0.915 0.000 0.912 0.060 0.012 0.016
#> SRR390510 2 0.231 0.915 0.000 0.912 0.060 0.012 0.016
#> SRR390512 2 0.112 0.939 0.000 0.960 0.004 0.036 0.000
#> SRR390513 2 0.112 0.939 0.000 0.960 0.004 0.036 0.000
#> SRR390514 2 0.112 0.939 0.000 0.960 0.004 0.036 0.000
#> SRR390515 1 0.339 0.781 0.864 0.000 0.036 0.052 0.048
#> SRR390516 3 0.525 0.602 0.024 0.000 0.564 0.016 0.396
#> SRR390517 2 0.415 0.784 0.000 0.804 0.064 0.016 0.116
#> SRR390519 5 0.190 0.756 0.004 0.024 0.000 0.040 0.932
#> SRR390520 4 0.827 0.467 0.164 0.040 0.232 0.476 0.088
#> SRR390521 4 0.773 0.547 0.160 0.084 0.224 0.516 0.016
#> SRR390522 4 0.773 0.547 0.160 0.084 0.224 0.516 0.016
#> SRR390523 4 0.773 0.547 0.160 0.084 0.224 0.516 0.016
#> SRR390524 1 0.344 0.773 0.852 0.000 0.080 0.056 0.012
#> SRR390525 1 0.344 0.773 0.852 0.000 0.080 0.056 0.012
#> SRR390526 1 0.458 0.717 0.764 0.000 0.076 0.148 0.012
#> SRR390527 1 0.458 0.717 0.764 0.000 0.076 0.148 0.012
#> SRR390528 4 0.400 0.603 0.044 0.056 0.012 0.840 0.048
#> SRR390529 1 0.495 0.736 0.752 0.008 0.160 0.024 0.056
#> SRR390530 1 0.344 0.773 0.852 0.000 0.080 0.056 0.012
#> SRR390531 1 0.344 0.773 0.852 0.000 0.080 0.056 0.012
#> SRR390532 4 0.425 0.592 0.040 0.068 0.020 0.828 0.044
#> SRR390533 4 0.632 0.419 0.264 0.012 0.140 0.580 0.004
#> SRR390534 4 0.632 0.419 0.264 0.012 0.140 0.580 0.004
#> SRR390535 4 0.544 0.485 0.248 0.012 0.080 0.660 0.000
#> SRR390536 4 0.807 0.446 0.000 0.236 0.128 0.420 0.216
#> SRR390537 4 0.807 0.446 0.000 0.236 0.128 0.420 0.216
#> SRR390538 1 0.491 0.743 0.756 0.008 0.160 0.044 0.032
#> SRR390539 1 0.498 0.745 0.752 0.008 0.160 0.048 0.032
#> SRR390540 1 0.498 0.745 0.752 0.008 0.160 0.048 0.032
#> SRR390541 1 0.498 0.745 0.752 0.008 0.160 0.048 0.032
#> SRR390542 2 0.104 0.940 0.000 0.960 0.000 0.040 0.000
#> SRR390543 2 0.104 0.940 0.000 0.960 0.000 0.040 0.000
#> SRR390544 2 0.104 0.940 0.000 0.960 0.000 0.040 0.000
#> SRR390545 2 0.104 0.940 0.000 0.960 0.000 0.040 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.1793 0.556 0.928 0.000 0.036 0.032 0.004 0.000
#> SRR390471 1 0.1793 0.556 0.928 0.000 0.036 0.032 0.004 0.000
#> SRR390472 1 0.2859 0.540 0.880 0.000 0.056 0.024 0.008 0.032
#> SRR390473 1 0.2859 0.540 0.880 0.000 0.056 0.024 0.008 0.032
#> SRR390474 4 0.9397 0.450 0.124 0.144 0.104 0.348 0.172 0.108
#> SRR390475 1 0.1793 0.556 0.928 0.000 0.036 0.032 0.004 0.000
#> SRR390476 1 0.1793 0.556 0.928 0.000 0.036 0.032 0.004 0.000
#> SRR390477 1 0.5197 0.546 0.532 0.000 0.028 0.040 0.000 0.400
#> SRR390478 1 0.5197 0.546 0.532 0.000 0.028 0.040 0.000 0.400
#> SRR390480 4 0.2238 0.645 0.016 0.076 0.000 0.900 0.004 0.004
#> SRR390481 4 0.2238 0.645 0.016 0.076 0.000 0.900 0.004 0.004
#> SRR390482 4 0.1812 0.631 0.012 0.040 0.008 0.932 0.008 0.000
#> SRR390483 4 0.1812 0.631 0.012 0.040 0.008 0.932 0.008 0.000
#> SRR390484 5 0.5875 -0.135 0.004 0.004 0.168 0.024 0.608 0.192
#> SRR390485 5 0.5875 -0.135 0.004 0.004 0.168 0.024 0.608 0.192
#> SRR390486 3 0.2638 0.780 0.036 0.000 0.896 0.032 0.016 0.020
#> SRR390487 3 0.2638 0.780 0.036 0.000 0.896 0.032 0.016 0.020
#> SRR390488 3 0.3036 0.785 0.124 0.000 0.840 0.028 0.000 0.008
#> SRR390489 3 0.3036 0.785 0.124 0.000 0.840 0.028 0.000 0.008
#> SRR390492 5 0.6402 0.453 0.000 0.212 0.024 0.228 0.524 0.012
#> SRR390493 5 0.6402 0.453 0.000 0.212 0.024 0.228 0.524 0.012
#> SRR390494 5 0.6202 0.470 0.008 0.260 0.012 0.208 0.512 0.000
#> SRR390495 5 0.6222 0.469 0.008 0.260 0.012 0.212 0.508 0.000
#> SRR390496 5 0.6222 0.469 0.008 0.260 0.012 0.212 0.508 0.000
#> SRR390497 5 0.5875 -0.135 0.004 0.004 0.168 0.024 0.608 0.192
#> SRR390498 5 0.7443 -0.294 0.004 0.128 0.164 0.012 0.456 0.236
#> SRR390499 4 0.2238 0.645 0.016 0.076 0.000 0.900 0.004 0.004
#> SRR390500 4 0.2238 0.645 0.016 0.076 0.000 0.900 0.004 0.004
#> SRR390501 3 0.3079 0.782 0.128 0.000 0.836 0.028 0.000 0.008
#> SRR390502 3 0.3079 0.782 0.128 0.000 0.836 0.028 0.000 0.008
#> SRR390503 3 0.2706 0.739 0.016 0.000 0.888 0.016 0.060 0.020
#> SRR390504 3 0.6160 -0.184 0.004 0.000 0.456 0.012 0.356 0.172
#> SRR390505 1 0.5906 0.340 0.592 0.000 0.056 0.028 0.040 0.284
#> SRR390506 6 0.7848 0.000 0.176 0.000 0.136 0.028 0.300 0.360
#> SRR390507 2 0.3772 0.861 0.000 0.820 0.032 0.036 0.012 0.100
#> SRR390508 2 0.3772 0.861 0.000 0.820 0.032 0.036 0.012 0.100
#> SRR390509 2 0.3772 0.861 0.000 0.820 0.032 0.036 0.012 0.100
#> SRR390510 2 0.3772 0.861 0.000 0.820 0.032 0.036 0.012 0.100
#> SRR390512 2 0.0146 0.904 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR390513 2 0.0146 0.904 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR390514 2 0.0146 0.904 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR390515 1 0.2543 0.560 0.892 0.000 0.024 0.016 0.004 0.064
#> SRR390516 3 0.2458 0.731 0.012 0.000 0.896 0.012 0.068 0.012
#> SRR390517 2 0.5313 0.764 0.000 0.724 0.056 0.040 0.068 0.112
#> SRR390519 5 0.5846 -0.132 0.004 0.004 0.164 0.024 0.612 0.192
#> SRR390520 4 0.9416 0.449 0.144 0.084 0.124 0.336 0.184 0.128
#> SRR390521 4 0.9437 0.449 0.128 0.160 0.096 0.336 0.172 0.108
#> SRR390522 4 0.9437 0.449 0.128 0.160 0.096 0.336 0.172 0.108
#> SRR390523 4 0.9437 0.449 0.128 0.160 0.096 0.336 0.172 0.108
#> SRR390524 1 0.5197 0.546 0.532 0.000 0.028 0.040 0.000 0.400
#> SRR390525 1 0.5197 0.546 0.532 0.000 0.028 0.040 0.000 0.400
#> SRR390526 1 0.6363 0.440 0.416 0.000 0.024 0.164 0.004 0.392
#> SRR390527 1 0.6363 0.440 0.416 0.000 0.024 0.164 0.004 0.392
#> SRR390528 4 0.2274 0.621 0.004 0.028 0.008 0.916 0.016 0.028
#> SRR390529 1 0.5750 0.381 0.620 0.000 0.052 0.032 0.036 0.260
#> SRR390530 1 0.5422 0.543 0.528 0.000 0.028 0.040 0.008 0.396
#> SRR390531 1 0.5422 0.543 0.528 0.000 0.028 0.040 0.008 0.396
#> SRR390532 4 0.2212 0.612 0.004 0.028 0.012 0.920 0.016 0.020
#> SRR390533 4 0.7623 0.519 0.260 0.028 0.064 0.496 0.076 0.076
#> SRR390534 4 0.7623 0.519 0.260 0.028 0.064 0.496 0.076 0.076
#> SRR390535 4 0.7246 0.563 0.124 0.028 0.032 0.560 0.076 0.180
#> SRR390536 5 0.6222 0.469 0.008 0.260 0.012 0.212 0.508 0.000
#> SRR390537 5 0.6222 0.469 0.008 0.260 0.012 0.212 0.508 0.000
#> SRR390538 1 0.5512 0.402 0.648 0.000 0.052 0.028 0.032 0.240
#> SRR390539 1 0.5534 0.401 0.644 0.000 0.052 0.028 0.032 0.244
#> SRR390540 1 0.5512 0.402 0.648 0.000 0.052 0.028 0.032 0.240
#> SRR390541 1 0.5534 0.401 0.644 0.000 0.052 0.028 0.032 0.244
#> SRR390542 2 0.0146 0.904 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR390543 2 0.0146 0.904 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR390544 2 0.0146 0.904 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR390545 2 0.0146 0.904 0.000 0.996 0.000 0.004 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
MAD:skmeans
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"]
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 15244 rows and 71 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 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:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.699 0.887 0.948 0.5048 0.494 0.494
#> 3 3 0.610 0.793 0.857 0.3134 0.766 0.558
#> 4 4 0.849 0.902 0.936 0.1283 0.838 0.566
#> 5 5 0.803 0.756 0.821 0.0625 0.941 0.770
#> 6 6 0.789 0.614 0.789 0.0410 0.939 0.739
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
suggest_best_k(res)
#> [1] 4
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.000 0.975 1.000 0.000
#> SRR390471 1 0.000 0.975 1.000 0.000
#> SRR390472 1 0.000 0.975 1.000 0.000
#> SRR390473 1 0.000 0.975 1.000 0.000
#> SRR390474 2 0.917 0.545 0.332 0.668
#> SRR390475 1 0.000 0.975 1.000 0.000
#> SRR390476 1 0.000 0.975 1.000 0.000
#> SRR390477 1 0.000 0.975 1.000 0.000
#> SRR390478 1 0.000 0.975 1.000 0.000
#> SRR390480 2 0.141 0.904 0.020 0.980
#> SRR390481 2 0.141 0.904 0.020 0.980
#> SRR390482 2 0.141 0.904 0.020 0.980
#> SRR390483 2 0.141 0.904 0.020 0.980
#> SRR390484 2 0.788 0.707 0.236 0.764
#> SRR390485 2 0.788 0.707 0.236 0.764
#> SRR390486 1 0.000 0.975 1.000 0.000
#> SRR390487 1 0.000 0.975 1.000 0.000
#> SRR390488 1 0.000 0.975 1.000 0.000
#> SRR390489 1 0.000 0.975 1.000 0.000
#> SRR390492 2 0.000 0.909 0.000 1.000
#> SRR390493 2 0.000 0.909 0.000 1.000
#> SRR390494 2 0.000 0.909 0.000 1.000
#> SRR390495 2 0.000 0.909 0.000 1.000
#> SRR390496 2 0.000 0.909 0.000 1.000
#> SRR390497 2 0.788 0.707 0.236 0.764
#> SRR390498 2 0.788 0.707 0.236 0.764
#> SRR390499 2 0.141 0.904 0.020 0.980
#> SRR390500 2 0.141 0.904 0.020 0.980
#> SRR390501 1 0.000 0.975 1.000 0.000
#> SRR390502 1 0.000 0.975 1.000 0.000
#> SRR390503 1 0.000 0.975 1.000 0.000
#> SRR390504 1 0.000 0.975 1.000 0.000
#> SRR390505 1 0.000 0.975 1.000 0.000
#> SRR390506 1 0.000 0.975 1.000 0.000
#> SRR390507 2 0.000 0.909 0.000 1.000
#> SRR390508 2 0.000 0.909 0.000 1.000
#> SRR390509 2 0.000 0.909 0.000 1.000
#> SRR390510 2 0.000 0.909 0.000 1.000
#> SRR390512 2 0.000 0.909 0.000 1.000
#> SRR390513 2 0.000 0.909 0.000 1.000
#> SRR390514 2 0.000 0.909 0.000 1.000
#> SRR390515 1 0.000 0.975 1.000 0.000
#> SRR390516 1 0.000 0.975 1.000 0.000
#> SRR390517 2 0.000 0.909 0.000 1.000
#> SRR390519 2 0.781 0.712 0.232 0.768
#> SRR390520 2 0.932 0.519 0.348 0.652
#> SRR390521 2 0.917 0.545 0.332 0.668
#> SRR390522 2 0.917 0.545 0.332 0.668
#> SRR390523 2 0.917 0.545 0.332 0.668
#> SRR390524 1 0.000 0.975 1.000 0.000
#> SRR390525 1 0.000 0.975 1.000 0.000
#> SRR390526 1 0.000 0.975 1.000 0.000
#> SRR390527 1 0.000 0.975 1.000 0.000
#> SRR390528 2 0.118 0.905 0.016 0.984
#> SRR390529 1 0.000 0.975 1.000 0.000
#> SRR390530 1 0.000 0.975 1.000 0.000
#> SRR390531 1 0.000 0.975 1.000 0.000
#> SRR390532 2 0.118 0.905 0.016 0.984
#> SRR390533 1 0.788 0.669 0.764 0.236
#> SRR390534 1 0.788 0.669 0.764 0.236
#> SRR390535 1 0.788 0.669 0.764 0.236
#> SRR390536 2 0.000 0.909 0.000 1.000
#> SRR390537 2 0.000 0.909 0.000 1.000
#> SRR390538 1 0.000 0.975 1.000 0.000
#> SRR390539 1 0.000 0.975 1.000 0.000
#> SRR390540 1 0.000 0.975 1.000 0.000
#> SRR390541 1 0.000 0.975 1.000 0.000
#> SRR390542 2 0.000 0.909 0.000 1.000
#> SRR390543 2 0.000 0.909 0.000 1.000
#> SRR390544 2 0.000 0.909 0.000 1.000
#> SRR390545 2 0.000 0.909 0.000 1.000
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.0000 0.921 1.000 0.000 0.000
#> SRR390471 1 0.0000 0.921 1.000 0.000 0.000
#> SRR390472 1 0.3619 0.797 0.864 0.000 0.136
#> SRR390473 1 0.3619 0.797 0.864 0.000 0.136
#> SRR390474 2 0.6271 0.752 0.088 0.772 0.140
#> SRR390475 1 0.0000 0.921 1.000 0.000 0.000
#> SRR390476 1 0.0000 0.921 1.000 0.000 0.000
#> SRR390477 1 0.0000 0.921 1.000 0.000 0.000
#> SRR390478 1 0.0000 0.921 1.000 0.000 0.000
#> SRR390480 2 0.6393 0.744 0.088 0.764 0.148
#> SRR390481 2 0.6393 0.744 0.088 0.764 0.148
#> SRR390482 2 0.6511 0.731 0.072 0.748 0.180
#> SRR390483 2 0.6458 0.734 0.072 0.752 0.176
#> SRR390484 3 0.5291 0.699 0.000 0.268 0.732
#> SRR390485 3 0.5291 0.699 0.000 0.268 0.732
#> SRR390486 3 0.4796 0.774 0.220 0.000 0.780
#> SRR390487 3 0.4796 0.774 0.220 0.000 0.780
#> SRR390488 3 0.5327 0.742 0.272 0.000 0.728
#> SRR390489 3 0.5327 0.742 0.272 0.000 0.728
#> SRR390492 2 0.0592 0.823 0.000 0.988 0.012
#> SRR390493 2 0.0592 0.823 0.000 0.988 0.012
#> SRR390494 2 0.0592 0.823 0.000 0.988 0.012
#> SRR390495 2 0.0592 0.823 0.000 0.988 0.012
#> SRR390496 2 0.0592 0.823 0.000 0.988 0.012
#> SRR390497 3 0.5291 0.699 0.000 0.268 0.732
#> SRR390498 3 0.4062 0.650 0.000 0.164 0.836
#> SRR390499 2 0.6393 0.744 0.088 0.764 0.148
#> SRR390500 2 0.6393 0.744 0.088 0.764 0.148
#> SRR390501 3 0.5678 0.694 0.316 0.000 0.684
#> SRR390502 3 0.5678 0.694 0.316 0.000 0.684
#> SRR390503 3 0.4796 0.774 0.220 0.000 0.780
#> SRR390504 3 0.4796 0.774 0.220 0.000 0.780
#> SRR390505 1 0.2796 0.843 0.908 0.000 0.092
#> SRR390506 3 0.5706 0.676 0.320 0.000 0.680
#> SRR390507 2 0.3941 0.806 0.000 0.844 0.156
#> SRR390508 2 0.3941 0.806 0.000 0.844 0.156
#> SRR390509 2 0.3941 0.806 0.000 0.844 0.156
#> SRR390510 2 0.3941 0.806 0.000 0.844 0.156
#> SRR390512 2 0.3941 0.806 0.000 0.844 0.156
#> SRR390513 2 0.3941 0.806 0.000 0.844 0.156
#> SRR390514 2 0.3941 0.806 0.000 0.844 0.156
#> SRR390515 1 0.2625 0.855 0.916 0.000 0.084
#> SRR390516 3 0.4796 0.774 0.220 0.000 0.780
#> SRR390517 3 0.4702 0.595 0.000 0.212 0.788
#> SRR390519 3 0.5291 0.699 0.000 0.268 0.732
#> SRR390520 3 0.4937 0.722 0.028 0.148 0.824
#> SRR390521 2 0.6425 0.747 0.096 0.764 0.140
#> SRR390522 2 0.6425 0.747 0.096 0.764 0.140
#> SRR390523 2 0.6425 0.747 0.096 0.764 0.140
#> SRR390524 1 0.0000 0.921 1.000 0.000 0.000
#> SRR390525 1 0.0000 0.921 1.000 0.000 0.000
#> SRR390526 1 0.0237 0.918 0.996 0.000 0.004
#> SRR390527 1 0.0237 0.918 0.996 0.000 0.004
#> SRR390528 3 0.4663 0.707 0.016 0.156 0.828
#> SRR390529 1 0.2261 0.867 0.932 0.000 0.068
#> SRR390530 1 0.0000 0.921 1.000 0.000 0.000
#> SRR390531 1 0.0000 0.921 1.000 0.000 0.000
#> SRR390532 3 0.4514 0.708 0.012 0.156 0.832
#> SRR390533 1 0.7453 0.589 0.700 0.152 0.148
#> SRR390534 1 0.7453 0.589 0.700 0.152 0.148
#> SRR390535 1 0.7453 0.589 0.700 0.152 0.148
#> SRR390536 2 0.0592 0.823 0.000 0.988 0.012
#> SRR390537 2 0.0592 0.823 0.000 0.988 0.012
#> SRR390538 1 0.0000 0.921 1.000 0.000 0.000
#> SRR390539 1 0.0000 0.921 1.000 0.000 0.000
#> SRR390540 1 0.0000 0.921 1.000 0.000 0.000
#> SRR390541 1 0.0000 0.921 1.000 0.000 0.000
#> SRR390542 2 0.3941 0.806 0.000 0.844 0.156
#> SRR390543 2 0.3941 0.806 0.000 0.844 0.156
#> SRR390544 2 0.3941 0.806 0.000 0.844 0.156
#> SRR390545 2 0.3941 0.806 0.000 0.844 0.156
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.0000 0.993 1.000 0.000 0.000 0.000
#> SRR390471 1 0.0000 0.993 1.000 0.000 0.000 0.000
#> SRR390472 1 0.1576 0.948 0.948 0.004 0.048 0.000
#> SRR390473 1 0.1576 0.948 0.948 0.004 0.048 0.000
#> SRR390474 4 0.3211 0.835 0.008 0.024 0.084 0.884
#> SRR390475 1 0.0000 0.993 1.000 0.000 0.000 0.000
#> SRR390476 1 0.0000 0.993 1.000 0.000 0.000 0.000
#> SRR390477 1 0.0188 0.992 0.996 0.000 0.000 0.004
#> SRR390478 1 0.0188 0.992 0.996 0.000 0.000 0.004
#> SRR390480 4 0.0376 0.856 0.000 0.004 0.004 0.992
#> SRR390481 4 0.0376 0.856 0.000 0.004 0.004 0.992
#> SRR390482 4 0.0188 0.855 0.000 0.000 0.004 0.996
#> SRR390483 4 0.0376 0.856 0.000 0.004 0.004 0.992
#> SRR390484 3 0.3400 0.863 0.000 0.064 0.872 0.064
#> SRR390485 3 0.3400 0.863 0.000 0.064 0.872 0.064
#> SRR390486 3 0.0524 0.911 0.004 0.000 0.988 0.008
#> SRR390487 3 0.0524 0.911 0.004 0.000 0.988 0.008
#> SRR390488 3 0.0804 0.910 0.012 0.000 0.980 0.008
#> SRR390489 3 0.0804 0.910 0.012 0.000 0.980 0.008
#> SRR390492 4 0.5141 0.707 0.000 0.268 0.032 0.700
#> SRR390493 4 0.5141 0.707 0.000 0.268 0.032 0.700
#> SRR390494 4 0.5141 0.707 0.000 0.268 0.032 0.700
#> SRR390495 4 0.5141 0.707 0.000 0.268 0.032 0.700
#> SRR390496 4 0.5141 0.707 0.000 0.268 0.032 0.700
#> SRR390497 3 0.3400 0.863 0.000 0.064 0.872 0.064
#> SRR390498 3 0.3764 0.758 0.000 0.216 0.784 0.000
#> SRR390499 4 0.0376 0.856 0.000 0.004 0.004 0.992
#> SRR390500 4 0.0376 0.856 0.000 0.004 0.004 0.992
#> SRR390501 3 0.1042 0.907 0.020 0.000 0.972 0.008
#> SRR390502 3 0.1042 0.907 0.020 0.000 0.972 0.008
#> SRR390503 3 0.0524 0.911 0.004 0.000 0.988 0.008
#> SRR390504 3 0.0712 0.910 0.004 0.004 0.984 0.008
#> SRR390505 1 0.0188 0.991 0.996 0.004 0.000 0.000
#> SRR390506 3 0.3945 0.734 0.216 0.004 0.780 0.000
#> SRR390507 2 0.0188 0.996 0.000 0.996 0.000 0.004
#> SRR390508 2 0.0188 0.996 0.000 0.996 0.000 0.004
#> SRR390509 2 0.0188 0.996 0.000 0.996 0.000 0.004
#> SRR390510 2 0.0188 0.996 0.000 0.996 0.000 0.004
#> SRR390512 2 0.0188 0.996 0.000 0.996 0.000 0.004
#> SRR390513 2 0.0188 0.996 0.000 0.996 0.000 0.004
#> SRR390514 2 0.0188 0.996 0.000 0.996 0.000 0.004
#> SRR390515 1 0.0188 0.991 0.996 0.004 0.000 0.000
#> SRR390516 3 0.0524 0.911 0.004 0.000 0.988 0.008
#> SRR390517 2 0.1022 0.955 0.000 0.968 0.032 0.000
#> SRR390519 3 0.3400 0.863 0.000 0.064 0.872 0.064
#> SRR390520 3 0.4522 0.653 0.004 0.004 0.728 0.264
#> SRR390521 4 0.3211 0.835 0.008 0.024 0.084 0.884
#> SRR390522 4 0.3211 0.835 0.008 0.024 0.084 0.884
#> SRR390523 4 0.3211 0.835 0.008 0.024 0.084 0.884
#> SRR390524 1 0.0188 0.992 0.996 0.000 0.000 0.004
#> SRR390525 1 0.0188 0.992 0.996 0.000 0.000 0.004
#> SRR390526 1 0.0336 0.990 0.992 0.000 0.000 0.008
#> SRR390527 1 0.0336 0.990 0.992 0.000 0.000 0.008
#> SRR390528 4 0.1004 0.849 0.000 0.004 0.024 0.972
#> SRR390529 1 0.0000 0.993 1.000 0.000 0.000 0.000
#> SRR390530 1 0.0188 0.992 0.996 0.000 0.000 0.004
#> SRR390531 1 0.0188 0.992 0.996 0.000 0.000 0.004
#> SRR390532 4 0.2197 0.815 0.000 0.004 0.080 0.916
#> SRR390533 4 0.2335 0.832 0.060 0.000 0.020 0.920
#> SRR390534 4 0.2335 0.832 0.060 0.000 0.020 0.920
#> SRR390535 4 0.2256 0.833 0.056 0.000 0.020 0.924
#> SRR390536 4 0.5141 0.707 0.000 0.268 0.032 0.700
#> SRR390537 4 0.5141 0.707 0.000 0.268 0.032 0.700
#> SRR390538 1 0.0000 0.993 1.000 0.000 0.000 0.000
#> SRR390539 1 0.0000 0.993 1.000 0.000 0.000 0.000
#> SRR390540 1 0.0000 0.993 1.000 0.000 0.000 0.000
#> SRR390541 1 0.0000 0.993 1.000 0.000 0.000 0.000
#> SRR390542 2 0.0188 0.996 0.000 0.996 0.000 0.004
#> SRR390543 2 0.0188 0.996 0.000 0.996 0.000 0.004
#> SRR390544 2 0.0188 0.996 0.000 0.996 0.000 0.004
#> SRR390545 2 0.0188 0.996 0.000 0.996 0.000 0.004
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.1410 0.926 0.940 0.000 0.000 0.060 0.000
#> SRR390471 1 0.1410 0.926 0.940 0.000 0.000 0.060 0.000
#> SRR390472 1 0.3337 0.877 0.856 0.000 0.072 0.064 0.008
#> SRR390473 1 0.3275 0.881 0.860 0.000 0.068 0.064 0.008
#> SRR390474 5 0.5684 0.157 0.008 0.004 0.048 0.444 0.496
#> SRR390475 1 0.1410 0.926 0.940 0.000 0.000 0.060 0.000
#> SRR390476 1 0.1410 0.926 0.940 0.000 0.000 0.060 0.000
#> SRR390477 1 0.1740 0.928 0.932 0.000 0.000 0.056 0.012
#> SRR390478 1 0.1740 0.928 0.932 0.000 0.000 0.056 0.012
#> SRR390480 4 0.3752 0.781 0.000 0.000 0.000 0.708 0.292
#> SRR390481 4 0.3752 0.781 0.000 0.000 0.000 0.708 0.292
#> SRR390482 4 0.3752 0.781 0.000 0.000 0.000 0.708 0.292
#> SRR390483 4 0.3752 0.781 0.000 0.000 0.000 0.708 0.292
#> SRR390484 3 0.5795 0.467 0.000 0.000 0.496 0.092 0.412
#> SRR390485 3 0.5795 0.467 0.000 0.000 0.496 0.092 0.412
#> SRR390486 3 0.0162 0.738 0.000 0.000 0.996 0.004 0.000
#> SRR390487 3 0.0162 0.738 0.000 0.000 0.996 0.004 0.000
#> SRR390488 3 0.2278 0.720 0.032 0.000 0.916 0.044 0.008
#> SRR390489 3 0.2278 0.720 0.032 0.000 0.916 0.044 0.008
#> SRR390492 5 0.1357 0.716 0.000 0.048 0.004 0.000 0.948
#> SRR390493 5 0.1357 0.716 0.000 0.048 0.004 0.000 0.948
#> SRR390494 5 0.1282 0.712 0.000 0.044 0.004 0.000 0.952
#> SRR390495 5 0.1357 0.716 0.000 0.048 0.004 0.000 0.948
#> SRR390496 5 0.1357 0.716 0.000 0.048 0.004 0.000 0.948
#> SRR390497 3 0.5795 0.467 0.000 0.000 0.496 0.092 0.412
#> SRR390498 3 0.6442 0.285 0.000 0.392 0.488 0.092 0.028
#> SRR390499 4 0.3752 0.781 0.000 0.000 0.000 0.708 0.292
#> SRR390500 4 0.3752 0.781 0.000 0.000 0.000 0.708 0.292
#> SRR390501 3 0.2278 0.720 0.032 0.000 0.916 0.044 0.008
#> SRR390502 3 0.2278 0.720 0.032 0.000 0.916 0.044 0.008
#> SRR390503 3 0.0000 0.738 0.000 0.000 1.000 0.000 0.000
#> SRR390504 3 0.2597 0.710 0.000 0.000 0.884 0.092 0.024
#> SRR390505 1 0.1399 0.930 0.952 0.000 0.020 0.028 0.000
#> SRR390506 3 0.6473 0.158 0.416 0.000 0.460 0.100 0.024
#> SRR390507 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390508 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390509 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390510 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390512 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390513 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390514 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390515 1 0.1830 0.930 0.924 0.000 0.000 0.068 0.008
#> SRR390516 3 0.0000 0.738 0.000 0.000 1.000 0.000 0.000
#> SRR390517 2 0.1815 0.931 0.000 0.940 0.016 0.020 0.024
#> SRR390519 3 0.5810 0.444 0.000 0.000 0.480 0.092 0.428
#> SRR390520 4 0.6566 -0.101 0.008 0.000 0.176 0.496 0.320
#> SRR390521 5 0.5684 0.157 0.008 0.004 0.048 0.444 0.496
#> SRR390522 5 0.5684 0.157 0.008 0.004 0.048 0.444 0.496
#> SRR390523 5 0.5684 0.157 0.008 0.004 0.048 0.444 0.496
#> SRR390524 1 0.1740 0.928 0.932 0.000 0.000 0.056 0.012
#> SRR390525 1 0.1740 0.928 0.932 0.000 0.000 0.056 0.012
#> SRR390526 1 0.2624 0.896 0.872 0.000 0.000 0.116 0.012
#> SRR390527 1 0.2624 0.896 0.872 0.000 0.000 0.116 0.012
#> SRR390528 4 0.3650 0.690 0.000 0.000 0.028 0.796 0.176
#> SRR390529 1 0.1386 0.931 0.952 0.000 0.016 0.032 0.000
#> SRR390530 1 0.1740 0.928 0.932 0.000 0.000 0.056 0.012
#> SRR390531 1 0.1740 0.928 0.932 0.000 0.000 0.056 0.012
#> SRR390532 4 0.3991 0.677 0.000 0.000 0.048 0.780 0.172
#> SRR390533 4 0.3688 0.673 0.060 0.000 0.000 0.816 0.124
#> SRR390534 4 0.3688 0.673 0.060 0.000 0.000 0.816 0.124
#> SRR390535 4 0.3359 0.687 0.052 0.000 0.000 0.840 0.108
#> SRR390536 5 0.1357 0.716 0.000 0.048 0.004 0.000 0.948
#> SRR390537 5 0.1357 0.716 0.000 0.048 0.004 0.000 0.948
#> SRR390538 1 0.1121 0.931 0.956 0.000 0.000 0.044 0.000
#> SRR390539 1 0.1043 0.932 0.960 0.000 0.000 0.040 0.000
#> SRR390540 1 0.1121 0.931 0.956 0.000 0.000 0.044 0.000
#> SRR390541 1 0.1043 0.932 0.960 0.000 0.000 0.040 0.000
#> SRR390542 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390543 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390544 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
#> SRR390545 2 0.0000 0.994 0.000 1.000 0.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.2019 0.75668 0.900 0.000 0.000 0.012 0.000 0.088
#> SRR390471 1 0.2019 0.75668 0.900 0.000 0.000 0.012 0.000 0.088
#> SRR390472 1 0.4221 0.66973 0.736 0.000 0.048 0.008 0.004 0.204
#> SRR390473 1 0.4221 0.66973 0.736 0.000 0.048 0.008 0.004 0.204
#> SRR390474 5 0.7002 -0.37833 0.012 0.004 0.024 0.280 0.344 0.336
#> SRR390475 1 0.2019 0.75668 0.900 0.000 0.000 0.012 0.000 0.088
#> SRR390476 1 0.2019 0.75668 0.900 0.000 0.000 0.012 0.000 0.088
#> SRR390477 1 0.3617 0.74518 0.736 0.000 0.000 0.020 0.000 0.244
#> SRR390478 1 0.3617 0.74518 0.736 0.000 0.000 0.020 0.000 0.244
#> SRR390480 4 0.2340 0.78015 0.000 0.000 0.000 0.852 0.148 0.000
#> SRR390481 4 0.2340 0.78015 0.000 0.000 0.000 0.852 0.148 0.000
#> SRR390482 4 0.2340 0.78015 0.000 0.000 0.000 0.852 0.148 0.000
#> SRR390483 4 0.2340 0.78015 0.000 0.000 0.000 0.852 0.148 0.000
#> SRR390484 5 0.6778 0.11083 0.000 0.004 0.196 0.052 0.452 0.296
#> SRR390485 5 0.6778 0.11083 0.000 0.004 0.196 0.052 0.452 0.296
#> SRR390486 3 0.0146 0.89722 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR390487 3 0.0146 0.89722 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR390488 3 0.1333 0.89342 0.048 0.000 0.944 0.008 0.000 0.000
#> SRR390489 3 0.1333 0.89342 0.048 0.000 0.944 0.008 0.000 0.000
#> SRR390492 5 0.0777 0.49130 0.000 0.024 0.000 0.004 0.972 0.000
#> SRR390493 5 0.0777 0.49130 0.000 0.024 0.000 0.004 0.972 0.000
#> SRR390494 5 0.0632 0.48872 0.000 0.024 0.000 0.000 0.976 0.000
#> SRR390495 5 0.0777 0.49130 0.000 0.024 0.000 0.004 0.972 0.000
#> SRR390496 5 0.0777 0.49130 0.000 0.024 0.000 0.004 0.972 0.000
#> SRR390497 5 0.6778 0.11083 0.000 0.004 0.196 0.052 0.452 0.296
#> SRR390498 2 0.7157 -0.00433 0.000 0.436 0.192 0.052 0.024 0.296
#> SRR390499 4 0.2340 0.78015 0.000 0.000 0.000 0.852 0.148 0.000
#> SRR390500 4 0.2340 0.78015 0.000 0.000 0.000 0.852 0.148 0.000
#> SRR390501 3 0.1333 0.89342 0.048 0.000 0.944 0.008 0.000 0.000
#> SRR390502 3 0.1333 0.89342 0.048 0.000 0.944 0.008 0.000 0.000
#> SRR390503 3 0.0260 0.89582 0.000 0.000 0.992 0.000 0.000 0.008
#> SRR390504 3 0.4810 0.40554 0.000 0.000 0.644 0.052 0.016 0.288
#> SRR390505 1 0.3850 0.68464 0.764 0.000 0.004 0.024 0.012 0.196
#> SRR390506 1 0.7037 0.14599 0.416 0.000 0.160 0.048 0.024 0.352
#> SRR390507 2 0.0000 0.94185 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390508 2 0.0000 0.94185 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390509 2 0.0000 0.94185 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390510 2 0.0000 0.94185 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390512 2 0.0000 0.94185 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390513 2 0.0000 0.94185 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390514 2 0.0000 0.94185 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390515 1 0.3333 0.74839 0.784 0.000 0.000 0.024 0.000 0.192
#> SRR390516 3 0.0363 0.89376 0.000 0.000 0.988 0.000 0.000 0.012
#> SRR390517 2 0.1722 0.88041 0.000 0.936 0.004 0.008 0.016 0.036
#> SRR390519 5 0.6698 0.11895 0.000 0.004 0.180 0.052 0.468 0.296
#> SRR390520 6 0.6358 0.00000 0.000 0.000 0.068 0.240 0.148 0.544
#> SRR390521 5 0.7002 -0.37833 0.012 0.004 0.024 0.280 0.344 0.336
#> SRR390522 5 0.7002 -0.37833 0.012 0.004 0.024 0.280 0.344 0.336
#> SRR390523 5 0.7002 -0.37833 0.012 0.004 0.024 0.280 0.344 0.336
#> SRR390524 1 0.3617 0.74518 0.736 0.000 0.000 0.020 0.000 0.244
#> SRR390525 1 0.3617 0.74518 0.736 0.000 0.000 0.020 0.000 0.244
#> SRR390526 1 0.4377 0.71343 0.688 0.000 0.000 0.068 0.000 0.244
#> SRR390527 1 0.4377 0.71343 0.688 0.000 0.000 0.068 0.000 0.244
#> SRR390528 4 0.3266 0.64673 0.000 0.000 0.004 0.832 0.084 0.080
#> SRR390529 1 0.2631 0.74566 0.860 0.000 0.004 0.004 0.008 0.124
#> SRR390530 1 0.3617 0.74518 0.736 0.000 0.000 0.020 0.000 0.244
#> SRR390531 1 0.3617 0.74518 0.736 0.000 0.000 0.020 0.000 0.244
#> SRR390532 4 0.3318 0.64223 0.000 0.000 0.004 0.828 0.084 0.084
#> SRR390533 4 0.5498 0.25681 0.136 0.000 0.000 0.616 0.020 0.228
#> SRR390534 4 0.5498 0.25681 0.136 0.000 0.000 0.616 0.020 0.228
#> SRR390535 4 0.4093 0.32007 0.008 0.000 0.000 0.656 0.012 0.324
#> SRR390536 5 0.0777 0.49130 0.000 0.024 0.000 0.004 0.972 0.000
#> SRR390537 5 0.0777 0.49130 0.000 0.024 0.000 0.004 0.972 0.000
#> SRR390538 1 0.1931 0.76267 0.916 0.000 0.004 0.004 0.008 0.068
#> SRR390539 1 0.1787 0.76346 0.920 0.000 0.004 0.000 0.008 0.068
#> SRR390540 1 0.1787 0.76346 0.920 0.000 0.004 0.000 0.008 0.068
#> SRR390541 1 0.1787 0.76346 0.920 0.000 0.004 0.000 0.008 0.068
#> SRR390542 2 0.0000 0.94185 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390543 2 0.0000 0.94185 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390544 2 0.0000 0.94185 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390545 2 0.0000 0.94185 0.000 1.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
MAD:pam*
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"]
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 15244 rows and 71 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'MAD' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)

The plots are:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.914 0.948 0.978 0.4562 0.537 0.537
#> 3 3 0.573 0.823 0.885 0.3736 0.750 0.561
#> 4 4 0.718 0.720 0.884 0.1816 0.800 0.505
#> 5 5 0.886 0.846 0.933 0.0754 0.879 0.586
#> 6 6 0.850 0.811 0.890 0.0484 0.926 0.663
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
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.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.0000 0.9883 1.000 0.000
#> SRR390471 1 0.0000 0.9883 1.000 0.000
#> SRR390472 1 0.0000 0.9883 1.000 0.000
#> SRR390473 1 0.0000 0.9883 1.000 0.000
#> SRR390474 1 0.0000 0.9883 1.000 0.000
#> SRR390475 1 0.0000 0.9883 1.000 0.000
#> SRR390476 1 0.0000 0.9883 1.000 0.000
#> SRR390477 1 0.0000 0.9883 1.000 0.000
#> SRR390478 1 0.0000 0.9883 1.000 0.000
#> SRR390480 1 0.0000 0.9883 1.000 0.000
#> SRR390481 1 0.0000 0.9883 1.000 0.000
#> SRR390482 1 0.9996 -0.0677 0.512 0.488
#> SRR390483 1 0.0376 0.9842 0.996 0.004
#> SRR390484 2 0.7299 0.7791 0.204 0.796
#> SRR390485 2 0.7299 0.7791 0.204 0.796
#> SRR390486 1 0.0000 0.9883 1.000 0.000
#> SRR390487 1 0.0000 0.9883 1.000 0.000
#> SRR390488 1 0.0000 0.9883 1.000 0.000
#> SRR390489 1 0.0000 0.9883 1.000 0.000
#> SRR390492 2 0.0000 0.9534 0.000 1.000
#> SRR390493 2 0.0000 0.9534 0.000 1.000
#> SRR390494 2 0.0672 0.9482 0.008 0.992
#> SRR390495 2 0.0000 0.9534 0.000 1.000
#> SRR390496 2 0.0000 0.9534 0.000 1.000
#> SRR390497 2 0.7453 0.7686 0.212 0.788
#> SRR390498 2 0.0000 0.9534 0.000 1.000
#> SRR390499 1 0.0000 0.9883 1.000 0.000
#> SRR390500 1 0.0000 0.9883 1.000 0.000
#> SRR390501 1 0.0000 0.9883 1.000 0.000
#> SRR390502 1 0.0000 0.9883 1.000 0.000
#> SRR390503 1 0.0000 0.9883 1.000 0.000
#> SRR390504 1 0.0000 0.9883 1.000 0.000
#> SRR390505 1 0.0000 0.9883 1.000 0.000
#> SRR390506 1 0.0000 0.9883 1.000 0.000
#> SRR390507 2 0.0000 0.9534 0.000 1.000
#> SRR390508 2 0.0000 0.9534 0.000 1.000
#> SRR390509 2 0.0000 0.9534 0.000 1.000
#> SRR390510 2 0.0000 0.9534 0.000 1.000
#> SRR390512 2 0.0000 0.9534 0.000 1.000
#> SRR390513 2 0.0000 0.9534 0.000 1.000
#> SRR390514 2 0.0000 0.9534 0.000 1.000
#> SRR390515 1 0.0000 0.9883 1.000 0.000
#> SRR390516 1 0.0000 0.9883 1.000 0.000
#> SRR390517 2 0.0000 0.9534 0.000 1.000
#> SRR390519 2 0.7219 0.7836 0.200 0.800
#> SRR390520 1 0.0000 0.9883 1.000 0.000
#> SRR390521 1 0.0000 0.9883 1.000 0.000
#> SRR390522 1 0.0000 0.9883 1.000 0.000
#> SRR390523 1 0.0000 0.9883 1.000 0.000
#> SRR390524 1 0.0000 0.9883 1.000 0.000
#> SRR390525 1 0.0000 0.9883 1.000 0.000
#> SRR390526 1 0.0000 0.9883 1.000 0.000
#> SRR390527 1 0.0000 0.9883 1.000 0.000
#> SRR390528 2 0.8081 0.7146 0.248 0.752
#> SRR390529 1 0.0000 0.9883 1.000 0.000
#> SRR390530 1 0.0000 0.9883 1.000 0.000
#> SRR390531 1 0.0000 0.9883 1.000 0.000
#> SRR390532 1 0.0000 0.9883 1.000 0.000
#> SRR390533 1 0.0000 0.9883 1.000 0.000
#> SRR390534 1 0.0000 0.9883 1.000 0.000
#> SRR390535 1 0.0000 0.9883 1.000 0.000
#> SRR390536 2 0.0000 0.9534 0.000 1.000
#> SRR390537 2 0.0000 0.9534 0.000 1.000
#> SRR390538 1 0.0000 0.9883 1.000 0.000
#> SRR390539 1 0.0000 0.9883 1.000 0.000
#> SRR390540 1 0.0000 0.9883 1.000 0.000
#> SRR390541 1 0.0000 0.9883 1.000 0.000
#> SRR390542 2 0.0000 0.9534 0.000 1.000
#> SRR390543 2 0.0000 0.9534 0.000 1.000
#> SRR390544 2 0.0000 0.9534 0.000 1.000
#> SRR390545 2 0.0000 0.9534 0.000 1.000
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.0000 0.9303 1.000 0.000 0.000
#> SRR390471 1 0.0000 0.9303 1.000 0.000 0.000
#> SRR390472 1 0.0000 0.9303 1.000 0.000 0.000
#> SRR390473 1 0.0000 0.9303 1.000 0.000 0.000
#> SRR390474 1 0.3340 0.8706 0.880 0.000 0.120
#> SRR390475 1 0.0000 0.9303 1.000 0.000 0.000
#> SRR390476 1 0.0000 0.9303 1.000 0.000 0.000
#> SRR390477 1 0.0000 0.9303 1.000 0.000 0.000
#> SRR390478 1 0.0000 0.9303 1.000 0.000 0.000
#> SRR390480 1 0.3752 0.8517 0.856 0.000 0.144
#> SRR390481 1 0.3686 0.8556 0.860 0.000 0.140
#> SRR390482 3 0.5465 0.8051 0.288 0.000 0.712
#> SRR390483 3 0.4452 0.7746 0.192 0.000 0.808
#> SRR390484 3 0.0983 0.6706 0.016 0.004 0.980
#> SRR390485 3 0.0892 0.6732 0.020 0.000 0.980
#> SRR390486 3 0.5621 0.8082 0.308 0.000 0.692
#> SRR390487 3 0.5621 0.8082 0.308 0.000 0.692
#> SRR390488 3 0.5529 0.8098 0.296 0.000 0.704
#> SRR390489 3 0.5529 0.8098 0.296 0.000 0.704
#> SRR390492 3 0.4062 0.4648 0.000 0.164 0.836
#> SRR390493 3 0.0892 0.6499 0.000 0.020 0.980
#> SRR390494 2 0.6155 0.7009 0.008 0.664 0.328
#> SRR390495 2 0.5678 0.7177 0.000 0.684 0.316
#> SRR390496 2 0.5678 0.7177 0.000 0.684 0.316
#> SRR390497 3 0.0892 0.6571 0.000 0.020 0.980
#> SRR390498 2 0.4605 0.6701 0.000 0.796 0.204
#> SRR390499 1 0.3686 0.8556 0.860 0.000 0.140
#> SRR390500 1 0.3752 0.8517 0.856 0.000 0.144
#> SRR390501 3 0.5650 0.8058 0.312 0.000 0.688
#> SRR390502 3 0.5465 0.8115 0.288 0.000 0.712
#> SRR390503 3 0.5678 0.8027 0.316 0.000 0.684
#> SRR390504 3 0.5678 0.8027 0.316 0.000 0.684
#> SRR390505 1 0.0747 0.9177 0.984 0.000 0.016
#> SRR390506 3 0.5678 0.8027 0.316 0.000 0.684
#> SRR390507 2 0.0000 0.8760 0.000 1.000 0.000
#> SRR390508 2 0.0000 0.8760 0.000 1.000 0.000
#> SRR390509 2 0.0000 0.8760 0.000 1.000 0.000
#> SRR390510 2 0.0000 0.8760 0.000 1.000 0.000
#> SRR390512 2 0.0000 0.8760 0.000 1.000 0.000
#> SRR390513 2 0.0000 0.8760 0.000 1.000 0.000
#> SRR390514 2 0.0000 0.8760 0.000 1.000 0.000
#> SRR390515 1 0.0000 0.9303 1.000 0.000 0.000
#> SRR390516 3 0.5327 0.8126 0.272 0.000 0.728
#> SRR390517 2 0.0000 0.8760 0.000 1.000 0.000
#> SRR390519 3 0.5948 -0.0743 0.000 0.360 0.640
#> SRR390520 1 0.3816 0.8553 0.852 0.000 0.148
#> SRR390521 1 0.4750 0.7609 0.784 0.000 0.216
#> SRR390522 1 0.4702 0.7666 0.788 0.000 0.212
#> SRR390523 1 0.3412 0.8682 0.876 0.000 0.124
#> SRR390524 1 0.0000 0.9303 1.000 0.000 0.000
#> SRR390525 1 0.0000 0.9303 1.000 0.000 0.000
#> SRR390526 1 0.0000 0.9303 1.000 0.000 0.000
#> SRR390527 1 0.0000 0.9303 1.000 0.000 0.000
#> SRR390528 2 0.8437 0.4681 0.180 0.620 0.200
#> SRR390529 1 0.0237 0.9275 0.996 0.000 0.004
#> SRR390530 1 0.0000 0.9303 1.000 0.000 0.000
#> SRR390531 1 0.0000 0.9303 1.000 0.000 0.000
#> SRR390532 3 0.4178 0.7785 0.172 0.000 0.828
#> SRR390533 1 0.3340 0.8706 0.880 0.000 0.120
#> SRR390534 1 0.3340 0.8706 0.880 0.000 0.120
#> SRR390535 1 0.1411 0.9160 0.964 0.000 0.036
#> SRR390536 2 0.5678 0.7177 0.000 0.684 0.316
#> SRR390537 2 0.5678 0.7177 0.000 0.684 0.316
#> SRR390538 1 0.0000 0.9303 1.000 0.000 0.000
#> SRR390539 1 0.0000 0.9303 1.000 0.000 0.000
#> SRR390540 1 0.0892 0.9211 0.980 0.000 0.020
#> SRR390541 1 0.0000 0.9303 1.000 0.000 0.000
#> SRR390542 2 0.0000 0.8760 0.000 1.000 0.000
#> SRR390543 2 0.0000 0.8760 0.000 1.000 0.000
#> SRR390544 2 0.0000 0.8760 0.000 1.000 0.000
#> SRR390545 2 0.0000 0.8760 0.000 1.000 0.000
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.0000 0.8355 1.000 0.000 0.000 0.000
#> SRR390471 1 0.0000 0.8355 1.000 0.000 0.000 0.000
#> SRR390472 1 0.1557 0.8087 0.944 0.000 0.056 0.000
#> SRR390473 1 0.1557 0.8087 0.944 0.000 0.056 0.000
#> SRR390474 4 0.4994 -0.0974 0.480 0.000 0.000 0.520
#> SRR390475 1 0.0000 0.8355 1.000 0.000 0.000 0.000
#> SRR390476 1 0.0000 0.8355 1.000 0.000 0.000 0.000
#> SRR390477 1 0.0000 0.8355 1.000 0.000 0.000 0.000
#> SRR390478 1 0.0000 0.8355 1.000 0.000 0.000 0.000
#> SRR390480 4 0.0000 0.8190 0.000 0.000 0.000 1.000
#> SRR390481 4 0.1940 0.7999 0.076 0.000 0.000 0.924
#> SRR390482 4 0.2011 0.7895 0.080 0.000 0.000 0.920
#> SRR390483 4 0.1716 0.8060 0.064 0.000 0.000 0.936
#> SRR390484 3 0.5000 0.1650 0.000 0.000 0.504 0.496
#> SRR390485 3 0.5000 0.1650 0.000 0.000 0.504 0.496
#> SRR390486 3 0.0000 0.7969 0.000 0.000 1.000 0.000
#> SRR390487 3 0.0000 0.7969 0.000 0.000 1.000 0.000
#> SRR390488 3 0.0000 0.7969 0.000 0.000 1.000 0.000
#> SRR390489 3 0.0000 0.7969 0.000 0.000 1.000 0.000
#> SRR390492 4 0.0707 0.8138 0.000 0.000 0.020 0.980
#> SRR390493 4 0.2909 0.7496 0.000 0.020 0.092 0.888
#> SRR390494 4 0.2002 0.8014 0.000 0.044 0.020 0.936
#> SRR390495 4 0.1118 0.8117 0.000 0.036 0.000 0.964
#> SRR390496 4 0.0000 0.8190 0.000 0.000 0.000 1.000
#> SRR390497 3 0.5000 0.1650 0.000 0.000 0.504 0.496
#> SRR390498 2 0.0707 0.9779 0.000 0.980 0.020 0.000
#> SRR390499 4 0.2814 0.7528 0.132 0.000 0.000 0.868
#> SRR390500 4 0.0188 0.8195 0.004 0.000 0.000 0.996
#> SRR390501 3 0.0000 0.7969 0.000 0.000 1.000 0.000
#> SRR390502 3 0.0000 0.7969 0.000 0.000 1.000 0.000
#> SRR390503 3 0.0000 0.7969 0.000 0.000 1.000 0.000
#> SRR390504 3 0.0000 0.7969 0.000 0.000 1.000 0.000
#> SRR390505 1 0.2589 0.7480 0.884 0.000 0.116 0.000
#> SRR390506 3 0.4961 0.1701 0.448 0.000 0.552 0.000
#> SRR390507 2 0.0000 0.9982 0.000 1.000 0.000 0.000
#> SRR390508 2 0.0000 0.9982 0.000 1.000 0.000 0.000
#> SRR390509 2 0.0000 0.9982 0.000 1.000 0.000 0.000
#> SRR390510 2 0.0000 0.9982 0.000 1.000 0.000 0.000
#> SRR390512 2 0.0000 0.9982 0.000 1.000 0.000 0.000
#> SRR390513 2 0.0000 0.9982 0.000 1.000 0.000 0.000
#> SRR390514 2 0.0000 0.9982 0.000 1.000 0.000 0.000
#> SRR390515 1 0.0000 0.8355 1.000 0.000 0.000 0.000
#> SRR390516 3 0.0000 0.7969 0.000 0.000 1.000 0.000
#> SRR390517 2 0.0000 0.9982 0.000 1.000 0.000 0.000
#> SRR390519 4 0.6850 0.2356 0.000 0.376 0.108 0.516
#> SRR390520 3 0.6984 0.3507 0.236 0.000 0.580 0.184
#> SRR390521 1 0.4992 0.1450 0.524 0.000 0.000 0.476
#> SRR390522 1 0.4992 0.1420 0.524 0.000 0.000 0.476
#> SRR390523 4 0.4776 0.2980 0.376 0.000 0.000 0.624
#> SRR390524 1 0.0000 0.8355 1.000 0.000 0.000 0.000
#> SRR390525 1 0.0000 0.8355 1.000 0.000 0.000 0.000
#> SRR390526 1 0.3172 0.7190 0.840 0.000 0.000 0.160
#> SRR390527 1 0.3172 0.7190 0.840 0.000 0.000 0.160
#> SRR390528 4 0.0000 0.8190 0.000 0.000 0.000 1.000
#> SRR390529 1 0.4661 0.4512 0.652 0.000 0.348 0.000
#> SRR390530 1 0.0000 0.8355 1.000 0.000 0.000 0.000
#> SRR390531 1 0.0000 0.8355 1.000 0.000 0.000 0.000
#> SRR390532 4 0.2868 0.7267 0.000 0.000 0.136 0.864
#> SRR390533 1 0.6804 0.2782 0.520 0.000 0.104 0.376
#> SRR390534 1 0.6911 0.2481 0.504 0.000 0.112 0.384
#> SRR390535 4 0.2704 0.7619 0.124 0.000 0.000 0.876
#> SRR390536 4 0.4072 0.6032 0.000 0.252 0.000 0.748
#> SRR390537 4 0.0000 0.8190 0.000 0.000 0.000 1.000
#> SRR390538 1 0.3975 0.6242 0.760 0.000 0.240 0.000
#> SRR390539 1 0.0000 0.8355 1.000 0.000 0.000 0.000
#> SRR390540 1 0.4564 0.4881 0.672 0.000 0.000 0.328
#> SRR390541 1 0.0000 0.8355 1.000 0.000 0.000 0.000
#> SRR390542 2 0.0000 0.9982 0.000 1.000 0.000 0.000
#> SRR390543 2 0.0000 0.9982 0.000 1.000 0.000 0.000
#> SRR390544 2 0.0000 0.9982 0.000 1.000 0.000 0.000
#> SRR390545 2 0.0000 0.9982 0.000 1.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.0000 0.869 1.000 0.000 0.000 0.000 0.000
#> SRR390471 1 0.0000 0.869 1.000 0.000 0.000 0.000 0.000
#> SRR390472 1 0.0000 0.869 1.000 0.000 0.000 0.000 0.000
#> SRR390473 1 0.0000 0.869 1.000 0.000 0.000 0.000 0.000
#> SRR390474 1 0.4552 0.214 0.524 0.000 0.000 0.468 0.008
#> SRR390475 1 0.0000 0.869 1.000 0.000 0.000 0.000 0.000
#> SRR390476 1 0.0000 0.869 1.000 0.000 0.000 0.000 0.000
#> SRR390477 1 0.0290 0.867 0.992 0.000 0.000 0.000 0.008
#> SRR390478 1 0.0290 0.867 0.992 0.000 0.000 0.000 0.008
#> SRR390480 4 0.0000 0.900 0.000 0.000 0.000 1.000 0.000
#> SRR390481 4 0.0000 0.900 0.000 0.000 0.000 1.000 0.000
#> SRR390482 4 0.0000 0.900 0.000 0.000 0.000 1.000 0.000
#> SRR390483 4 0.0000 0.900 0.000 0.000 0.000 1.000 0.000
#> SRR390484 5 0.0290 0.954 0.000 0.000 0.008 0.000 0.992
#> SRR390485 5 0.0290 0.954 0.000 0.000 0.008 0.000 0.992
#> SRR390486 3 0.0000 0.912 0.000 0.000 1.000 0.000 0.000
#> SRR390487 3 0.0000 0.912 0.000 0.000 1.000 0.000 0.000
#> SRR390488 3 0.0000 0.912 0.000 0.000 1.000 0.000 0.000
#> SRR390489 3 0.0000 0.912 0.000 0.000 1.000 0.000 0.000
#> SRR390492 5 0.0671 0.957 0.000 0.000 0.004 0.016 0.980
#> SRR390493 5 0.0579 0.957 0.000 0.000 0.008 0.008 0.984
#> SRR390494 5 0.0609 0.957 0.000 0.000 0.000 0.020 0.980
#> SRR390495 5 0.0609 0.957 0.000 0.000 0.000 0.020 0.980
#> SRR390496 5 0.0609 0.957 0.000 0.000 0.000 0.020 0.980
#> SRR390497 5 0.0290 0.954 0.000 0.000 0.008 0.000 0.992
#> SRR390498 2 0.0404 0.989 0.000 0.988 0.000 0.000 0.012
#> SRR390499 4 0.0000 0.900 0.000 0.000 0.000 1.000 0.000
#> SRR390500 4 0.0000 0.900 0.000 0.000 0.000 1.000 0.000
#> SRR390501 3 0.0000 0.912 0.000 0.000 1.000 0.000 0.000
#> SRR390502 3 0.0000 0.912 0.000 0.000 1.000 0.000 0.000
#> SRR390503 3 0.0000 0.912 0.000 0.000 1.000 0.000 0.000
#> SRR390504 3 0.0404 0.904 0.000 0.000 0.988 0.000 0.012
#> SRR390505 1 0.3209 0.687 0.812 0.000 0.180 0.000 0.008
#> SRR390506 3 0.4599 0.417 0.356 0.000 0.624 0.000 0.020
#> SRR390507 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> SRR390508 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> SRR390509 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> SRR390510 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> SRR390512 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> SRR390513 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> SRR390514 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> SRR390515 1 0.0000 0.869 1.000 0.000 0.000 0.000 0.000
#> SRR390516 3 0.0000 0.912 0.000 0.000 1.000 0.000 0.000
#> SRR390517 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> SRR390519 5 0.0290 0.953 0.000 0.008 0.000 0.000 0.992
#> SRR390520 3 0.6072 0.401 0.252 0.000 0.568 0.180 0.000
#> SRR390521 1 0.5355 0.500 0.624 0.000 0.000 0.292 0.084
#> SRR390522 1 0.5404 0.496 0.620 0.000 0.000 0.292 0.088
#> SRR390523 5 0.4769 0.569 0.256 0.000 0.000 0.056 0.688
#> SRR390524 1 0.0290 0.867 0.992 0.000 0.000 0.000 0.008
#> SRR390525 1 0.0290 0.867 0.992 0.000 0.000 0.000 0.008
#> SRR390526 4 0.4367 0.426 0.372 0.000 0.000 0.620 0.008
#> SRR390527 4 0.4354 0.434 0.368 0.000 0.000 0.624 0.008
#> SRR390528 4 0.0000 0.900 0.000 0.000 0.000 1.000 0.000
#> SRR390529 1 0.4182 0.359 0.600 0.000 0.400 0.000 0.000
#> SRR390530 1 0.0290 0.867 0.992 0.000 0.000 0.000 0.008
#> SRR390531 1 0.0290 0.867 0.992 0.000 0.000 0.000 0.008
#> SRR390532 4 0.0000 0.900 0.000 0.000 0.000 1.000 0.000
#> SRR390533 4 0.1965 0.830 0.096 0.000 0.000 0.904 0.000
#> SRR390534 4 0.2020 0.826 0.100 0.000 0.000 0.900 0.000
#> SRR390535 4 0.0000 0.900 0.000 0.000 0.000 1.000 0.000
#> SRR390536 5 0.0693 0.954 0.000 0.012 0.000 0.008 0.980
#> SRR390537 5 0.0609 0.957 0.000 0.000 0.000 0.020 0.980
#> SRR390538 1 0.3876 0.527 0.684 0.000 0.316 0.000 0.000
#> SRR390539 1 0.0000 0.869 1.000 0.000 0.000 0.000 0.000
#> SRR390540 1 0.3730 0.586 0.712 0.000 0.000 0.288 0.000
#> SRR390541 1 0.0000 0.869 1.000 0.000 0.000 0.000 0.000
#> SRR390542 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> SRR390543 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> SRR390544 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
#> SRR390545 2 0.0000 0.999 0.000 1.000 0.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.0000 0.768 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390471 1 0.0000 0.768 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390472 1 0.0000 0.768 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390473 1 0.0000 0.768 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390474 1 0.4840 0.209 0.552 0.000 0.000 0.400 0.012 0.036
#> SRR390475 1 0.0000 0.768 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390476 1 0.0000 0.768 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390477 6 0.3659 0.747 0.364 0.000 0.000 0.000 0.000 0.636
#> SRR390478 6 0.3672 0.744 0.368 0.000 0.000 0.000 0.000 0.632
#> SRR390480 4 0.0000 0.898 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390481 4 0.0000 0.898 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390482 4 0.0000 0.898 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390483 4 0.0000 0.898 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390484 5 0.2219 0.876 0.000 0.000 0.000 0.000 0.864 0.136
#> SRR390485 5 0.2219 0.876 0.000 0.000 0.000 0.000 0.864 0.136
#> SRR390486 3 0.0000 0.982 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390487 3 0.0000 0.982 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390488 3 0.0000 0.982 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390489 3 0.0000 0.982 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390492 5 0.0363 0.917 0.000 0.000 0.000 0.012 0.988 0.000
#> SRR390493 5 0.0146 0.915 0.000 0.000 0.000 0.004 0.996 0.000
#> SRR390494 5 0.0363 0.917 0.000 0.000 0.000 0.012 0.988 0.000
#> SRR390495 5 0.0363 0.917 0.000 0.000 0.000 0.012 0.988 0.000
#> SRR390496 5 0.0363 0.917 0.000 0.000 0.000 0.012 0.988 0.000
#> SRR390497 5 0.2219 0.876 0.000 0.000 0.000 0.000 0.864 0.136
#> SRR390498 2 0.2572 0.846 0.000 0.852 0.000 0.000 0.012 0.136
#> SRR390499 4 0.0000 0.898 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390500 4 0.0000 0.898 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390501 3 0.0000 0.982 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390502 3 0.0000 0.982 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390503 3 0.0000 0.982 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390504 3 0.2572 0.849 0.000 0.000 0.852 0.000 0.012 0.136
#> SRR390505 6 0.3083 0.671 0.132 0.000 0.040 0.000 0.000 0.828
#> SRR390506 6 0.1364 0.613 0.016 0.000 0.020 0.000 0.012 0.952
#> SRR390507 2 0.0000 0.988 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390508 2 0.0000 0.988 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390509 2 0.0000 0.988 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390510 2 0.0000 0.988 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390512 2 0.0000 0.988 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390513 2 0.0000 0.988 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390514 2 0.0000 0.988 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390515 1 0.0000 0.768 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390516 3 0.0000 0.982 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390517 2 0.0000 0.988 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390519 5 0.2219 0.876 0.000 0.000 0.000 0.000 0.864 0.136
#> SRR390520 1 0.4482 0.395 0.580 0.000 0.384 0.000 0.000 0.036
#> SRR390521 1 0.2911 0.693 0.856 0.000 0.000 0.008 0.100 0.036
#> SRR390522 1 0.3604 0.632 0.788 0.000 0.000 0.008 0.168 0.036
#> SRR390523 5 0.4444 0.526 0.280 0.000 0.000 0.012 0.672 0.036
#> SRR390524 6 0.3672 0.744 0.368 0.000 0.000 0.000 0.000 0.632
#> SRR390525 6 0.3659 0.747 0.364 0.000 0.000 0.000 0.000 0.636
#> SRR390526 6 0.4167 0.486 0.024 0.000 0.000 0.344 0.000 0.632
#> SRR390527 6 0.4105 0.479 0.020 0.000 0.000 0.348 0.000 0.632
#> SRR390528 4 0.0000 0.898 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390529 1 0.5625 0.422 0.532 0.000 0.192 0.000 0.000 0.276
#> SRR390530 6 0.3499 0.752 0.320 0.000 0.000 0.000 0.000 0.680
#> SRR390531 6 0.3266 0.740 0.272 0.000 0.000 0.000 0.000 0.728
#> SRR390532 4 0.0000 0.898 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390533 4 0.4159 0.313 0.396 0.000 0.000 0.588 0.000 0.016
#> SRR390534 4 0.4131 0.345 0.384 0.000 0.000 0.600 0.000 0.016
#> SRR390535 4 0.0000 0.898 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390536 5 0.0405 0.916 0.000 0.004 0.000 0.008 0.988 0.000
#> SRR390537 5 0.0363 0.917 0.000 0.000 0.000 0.012 0.988 0.000
#> SRR390538 1 0.2902 0.692 0.800 0.000 0.004 0.000 0.000 0.196
#> SRR390539 1 0.3288 0.635 0.724 0.000 0.000 0.000 0.000 0.276
#> SRR390540 1 0.2762 0.693 0.804 0.000 0.000 0.000 0.000 0.196
#> SRR390541 1 0.3607 0.537 0.652 0.000 0.000 0.000 0.000 0.348
#> SRR390542 2 0.0000 0.988 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390543 2 0.0000 0.988 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390544 2 0.0000 0.988 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390545 2 0.0000 0.988 0.000 1.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
MAD:mclust**
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"]
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 15244 rows and 71 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:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or k-1.
The detailed explanations of these statistics can be found in the cola
vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)

The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.996 0.998 0.2688 0.734 0.734
#> 3 3 0.839 0.886 0.931 1.0742 0.741 0.647
#> 4 4 0.649 0.647 0.831 0.2126 0.826 0.638
#> 5 5 0.621 0.577 0.705 0.1142 0.763 0.382
#> 6 6 0.652 0.555 0.722 0.0681 0.868 0.523
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
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.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.0000 0.998 1.000 0.000
#> SRR390471 1 0.0000 0.998 1.000 0.000
#> SRR390472 1 0.0000 0.998 1.000 0.000
#> SRR390473 1 0.0000 0.998 1.000 0.000
#> SRR390474 1 0.0000 0.998 1.000 0.000
#> SRR390475 1 0.0000 0.998 1.000 0.000
#> SRR390476 1 0.0000 0.998 1.000 0.000
#> SRR390477 1 0.0000 0.998 1.000 0.000
#> SRR390478 1 0.0000 0.998 1.000 0.000
#> SRR390480 1 0.0000 0.998 1.000 0.000
#> SRR390481 1 0.0000 0.998 1.000 0.000
#> SRR390482 1 0.0376 0.994 0.996 0.004
#> SRR390483 1 0.0000 0.998 1.000 0.000
#> SRR390484 1 0.0000 0.998 1.000 0.000
#> SRR390485 1 0.0000 0.998 1.000 0.000
#> SRR390486 1 0.0000 0.998 1.000 0.000
#> SRR390487 1 0.0000 0.998 1.000 0.000
#> SRR390488 1 0.0376 0.994 0.996 0.004
#> SRR390489 1 0.0376 0.994 0.996 0.004
#> SRR390492 1 0.0000 0.998 1.000 0.000
#> SRR390493 1 0.0000 0.998 1.000 0.000
#> SRR390494 1 0.0000 0.998 1.000 0.000
#> SRR390495 1 0.0000 0.998 1.000 0.000
#> SRR390496 1 0.0000 0.998 1.000 0.000
#> SRR390497 1 0.0000 0.998 1.000 0.000
#> SRR390498 1 0.3274 0.938 0.940 0.060
#> SRR390499 1 0.0000 0.998 1.000 0.000
#> SRR390500 1 0.0000 0.998 1.000 0.000
#> SRR390501 1 0.0000 0.998 1.000 0.000
#> SRR390502 1 0.0000 0.998 1.000 0.000
#> SRR390503 1 0.0000 0.998 1.000 0.000
#> SRR390504 1 0.0000 0.998 1.000 0.000
#> SRR390505 1 0.0000 0.998 1.000 0.000
#> SRR390506 1 0.0000 0.998 1.000 0.000
#> SRR390507 2 0.0000 1.000 0.000 1.000
#> SRR390508 2 0.0000 1.000 0.000 1.000
#> SRR390509 2 0.0000 1.000 0.000 1.000
#> SRR390510 2 0.0000 1.000 0.000 1.000
#> SRR390512 2 0.0000 1.000 0.000 1.000
#> SRR390513 2 0.0000 1.000 0.000 1.000
#> SRR390514 2 0.0000 1.000 0.000 1.000
#> SRR390515 1 0.0000 0.998 1.000 0.000
#> SRR390516 1 0.0376 0.994 0.996 0.004
#> SRR390517 1 0.3274 0.938 0.940 0.060
#> SRR390519 1 0.0000 0.998 1.000 0.000
#> SRR390520 1 0.0000 0.998 1.000 0.000
#> SRR390521 1 0.0000 0.998 1.000 0.000
#> SRR390522 1 0.0000 0.998 1.000 0.000
#> SRR390523 1 0.0000 0.998 1.000 0.000
#> SRR390524 1 0.0000 0.998 1.000 0.000
#> SRR390525 1 0.0000 0.998 1.000 0.000
#> SRR390526 1 0.0000 0.998 1.000 0.000
#> SRR390527 1 0.0000 0.998 1.000 0.000
#> SRR390528 1 0.0000 0.998 1.000 0.000
#> SRR390529 1 0.0000 0.998 1.000 0.000
#> SRR390530 1 0.0000 0.998 1.000 0.000
#> SRR390531 1 0.0000 0.998 1.000 0.000
#> SRR390532 1 0.0000 0.998 1.000 0.000
#> SRR390533 1 0.0000 0.998 1.000 0.000
#> SRR390534 1 0.0000 0.998 1.000 0.000
#> SRR390535 1 0.0000 0.998 1.000 0.000
#> SRR390536 1 0.0000 0.998 1.000 0.000
#> SRR390537 1 0.0000 0.998 1.000 0.000
#> SRR390538 1 0.0000 0.998 1.000 0.000
#> SRR390539 1 0.0000 0.998 1.000 0.000
#> SRR390540 1 0.0000 0.998 1.000 0.000
#> SRR390541 1 0.0000 0.998 1.000 0.000
#> SRR390542 2 0.0000 1.000 0.000 1.000
#> SRR390543 2 0.0000 1.000 0.000 1.000
#> SRR390544 2 0.0000 1.000 0.000 1.000
#> SRR390545 2 0.0000 1.000 0.000 1.000
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.0892 0.960 0.980 0.00 0.020
#> SRR390471 1 0.1163 0.952 0.972 0.00 0.028
#> SRR390472 3 0.5835 0.592 0.340 0.00 0.660
#> SRR390473 3 0.5835 0.592 0.340 0.00 0.660
#> SRR390474 3 0.1411 0.903 0.036 0.00 0.964
#> SRR390475 1 0.0000 0.979 1.000 0.00 0.000
#> SRR390476 1 0.0000 0.979 1.000 0.00 0.000
#> SRR390477 1 0.0000 0.979 1.000 0.00 0.000
#> SRR390478 1 0.0000 0.979 1.000 0.00 0.000
#> SRR390480 3 0.1411 0.898 0.036 0.00 0.964
#> SRR390481 3 0.1411 0.898 0.036 0.00 0.964
#> SRR390482 3 0.0747 0.904 0.016 0.00 0.984
#> SRR390483 3 0.0424 0.901 0.008 0.00 0.992
#> SRR390484 3 0.1411 0.906 0.036 0.00 0.964
#> SRR390485 3 0.1411 0.906 0.036 0.00 0.964
#> SRR390486 3 0.2066 0.904 0.060 0.00 0.940
#> SRR390487 3 0.2066 0.904 0.060 0.00 0.940
#> SRR390488 3 0.1964 0.906 0.056 0.00 0.944
#> SRR390489 3 0.1964 0.906 0.056 0.00 0.944
#> SRR390492 3 0.0000 0.898 0.000 0.00 1.000
#> SRR390493 3 0.0000 0.898 0.000 0.00 1.000
#> SRR390494 3 0.1031 0.906 0.024 0.00 0.976
#> SRR390495 3 0.1163 0.895 0.028 0.00 0.972
#> SRR390496 3 0.1163 0.895 0.028 0.00 0.972
#> SRR390497 3 0.1411 0.906 0.036 0.00 0.964
#> SRR390498 3 0.2926 0.895 0.036 0.04 0.924
#> SRR390499 3 0.1529 0.897 0.040 0.00 0.960
#> SRR390500 3 0.1529 0.897 0.040 0.00 0.960
#> SRR390501 3 0.2066 0.905 0.060 0.00 0.940
#> SRR390502 3 0.1964 0.906 0.056 0.00 0.944
#> SRR390503 3 0.1643 0.907 0.044 0.00 0.956
#> SRR390504 3 0.2066 0.904 0.060 0.00 0.940
#> SRR390505 3 0.6168 0.455 0.412 0.00 0.588
#> SRR390506 3 0.5760 0.614 0.328 0.00 0.672
#> SRR390507 2 0.0000 1.000 0.000 1.00 0.000
#> SRR390508 2 0.0000 1.000 0.000 1.00 0.000
#> SRR390509 2 0.0000 1.000 0.000 1.00 0.000
#> SRR390510 2 0.0000 1.000 0.000 1.00 0.000
#> SRR390512 2 0.0000 1.000 0.000 1.00 0.000
#> SRR390513 2 0.0000 1.000 0.000 1.00 0.000
#> SRR390514 2 0.0000 1.000 0.000 1.00 0.000
#> SRR390515 3 0.6154 0.463 0.408 0.00 0.592
#> SRR390516 3 0.1643 0.907 0.044 0.00 0.956
#> SRR390517 3 0.2926 0.895 0.036 0.04 0.924
#> SRR390519 3 0.1411 0.906 0.036 0.00 0.964
#> SRR390520 3 0.1860 0.906 0.052 0.00 0.948
#> SRR390521 3 0.2261 0.892 0.068 0.00 0.932
#> SRR390522 3 0.2261 0.892 0.068 0.00 0.932
#> SRR390523 3 0.2261 0.892 0.068 0.00 0.932
#> SRR390524 1 0.0000 0.979 1.000 0.00 0.000
#> SRR390525 1 0.0000 0.979 1.000 0.00 0.000
#> SRR390526 3 0.6045 0.545 0.380 0.00 0.620
#> SRR390527 3 0.6008 0.561 0.372 0.00 0.628
#> SRR390528 3 0.1643 0.907 0.044 0.00 0.956
#> SRR390529 3 0.6168 0.455 0.412 0.00 0.588
#> SRR390530 1 0.0237 0.976 0.996 0.00 0.004
#> SRR390531 1 0.0237 0.976 0.996 0.00 0.004
#> SRR390532 3 0.1643 0.907 0.044 0.00 0.956
#> SRR390533 3 0.1643 0.908 0.044 0.00 0.956
#> SRR390534 3 0.1643 0.908 0.044 0.00 0.956
#> SRR390535 3 0.4399 0.818 0.188 0.00 0.812
#> SRR390536 3 0.1163 0.895 0.028 0.00 0.972
#> SRR390537 3 0.1163 0.895 0.028 0.00 0.972
#> SRR390538 1 0.3686 0.802 0.860 0.00 0.140
#> SRR390539 1 0.0000 0.979 1.000 0.00 0.000
#> SRR390540 1 0.0000 0.979 1.000 0.00 0.000
#> SRR390541 1 0.0000 0.979 1.000 0.00 0.000
#> SRR390542 2 0.0000 1.000 0.000 1.00 0.000
#> SRR390543 2 0.0000 1.000 0.000 1.00 0.000
#> SRR390544 2 0.0000 1.000 0.000 1.00 0.000
#> SRR390545 2 0.0000 1.000 0.000 1.00 0.000
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.0804 0.900 0.980 0.000 0.008 0.012
#> SRR390471 1 0.1284 0.880 0.964 0.000 0.012 0.024
#> SRR390472 3 0.6822 0.396 0.412 0.000 0.488 0.100
#> SRR390473 3 0.6831 0.379 0.420 0.000 0.480 0.100
#> SRR390474 4 0.2255 0.699 0.012 0.000 0.068 0.920
#> SRR390475 1 0.0000 0.917 1.000 0.000 0.000 0.000
#> SRR390476 1 0.0000 0.917 1.000 0.000 0.000 0.000
#> SRR390477 1 0.0000 0.917 1.000 0.000 0.000 0.000
#> SRR390478 1 0.0000 0.917 1.000 0.000 0.000 0.000
#> SRR390480 4 0.0000 0.692 0.000 0.000 0.000 1.000
#> SRR390481 4 0.0000 0.692 0.000 0.000 0.000 1.000
#> SRR390482 4 0.2281 0.696 0.000 0.000 0.096 0.904
#> SRR390483 4 0.1792 0.700 0.000 0.000 0.068 0.932
#> SRR390484 3 0.4679 0.230 0.000 0.000 0.648 0.352
#> SRR390485 3 0.4661 0.240 0.000 0.000 0.652 0.348
#> SRR390486 4 0.5329 0.366 0.012 0.000 0.420 0.568
#> SRR390487 4 0.4889 0.508 0.004 0.000 0.360 0.636
#> SRR390488 4 0.5289 0.521 0.020 0.000 0.344 0.636
#> SRR390489 4 0.5355 0.500 0.020 0.000 0.360 0.620
#> SRR390492 4 0.1867 0.700 0.000 0.000 0.072 0.928
#> SRR390493 4 0.1867 0.700 0.000 0.000 0.072 0.928
#> SRR390494 4 0.3801 0.648 0.000 0.000 0.220 0.780
#> SRR390495 4 0.0188 0.691 0.000 0.000 0.004 0.996
#> SRR390496 4 0.0188 0.691 0.000 0.000 0.004 0.996
#> SRR390497 3 0.4661 0.240 0.000 0.000 0.652 0.348
#> SRR390498 3 0.0524 0.503 0.004 0.008 0.988 0.000
#> SRR390499 4 0.0000 0.692 0.000 0.000 0.000 1.000
#> SRR390500 4 0.0000 0.692 0.000 0.000 0.000 1.000
#> SRR390501 4 0.5213 0.538 0.020 0.000 0.328 0.652
#> SRR390502 4 0.5213 0.538 0.020 0.000 0.328 0.652
#> SRR390503 4 0.5407 0.194 0.012 0.000 0.484 0.504
#> SRR390504 3 0.5510 -0.207 0.016 0.000 0.504 0.480
#> SRR390505 3 0.7216 0.408 0.412 0.000 0.448 0.140
#> SRR390506 3 0.7382 0.520 0.260 0.000 0.520 0.220
#> SRR390507 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390508 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390509 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390510 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390512 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390513 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390514 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390515 1 0.6842 -0.360 0.464 0.000 0.436 0.100
#> SRR390516 4 0.5337 0.349 0.012 0.000 0.424 0.564
#> SRR390517 3 0.0524 0.503 0.004 0.008 0.988 0.000
#> SRR390519 4 0.4907 0.403 0.000 0.000 0.420 0.580
#> SRR390520 4 0.4431 0.583 0.000 0.000 0.304 0.696
#> SRR390521 4 0.0469 0.686 0.012 0.000 0.000 0.988
#> SRR390522 4 0.0469 0.686 0.012 0.000 0.000 0.988
#> SRR390523 4 0.0469 0.686 0.012 0.000 0.000 0.988
#> SRR390524 1 0.0000 0.917 1.000 0.000 0.000 0.000
#> SRR390525 1 0.0000 0.917 1.000 0.000 0.000 0.000
#> SRR390526 4 0.4992 0.116 0.476 0.000 0.000 0.524
#> SRR390527 4 0.4992 0.116 0.476 0.000 0.000 0.524
#> SRR390528 4 0.4585 0.553 0.000 0.000 0.332 0.668
#> SRR390529 3 0.7184 0.401 0.416 0.000 0.448 0.136
#> SRR390530 1 0.0336 0.914 0.992 0.000 0.008 0.000
#> SRR390531 1 0.0336 0.914 0.992 0.000 0.008 0.000
#> SRR390532 4 0.4431 0.583 0.000 0.000 0.304 0.696
#> SRR390533 4 0.4327 0.645 0.016 0.000 0.216 0.768
#> SRR390534 4 0.4327 0.645 0.016 0.000 0.216 0.768
#> SRR390535 4 0.5497 0.415 0.284 0.000 0.044 0.672
#> SRR390536 4 0.0188 0.691 0.000 0.000 0.004 0.996
#> SRR390537 4 0.0188 0.691 0.000 0.000 0.004 0.996
#> SRR390538 1 0.5147 0.490 0.740 0.000 0.200 0.060
#> SRR390539 1 0.0000 0.917 1.000 0.000 0.000 0.000
#> SRR390540 1 0.0000 0.917 1.000 0.000 0.000 0.000
#> SRR390541 1 0.0000 0.917 1.000 0.000 0.000 0.000
#> SRR390542 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390543 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390544 2 0.0000 1.000 0.000 1.000 0.000 0.000
#> SRR390545 2 0.0000 1.000 0.000 1.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.0727 0.75599 0.980 0.000 0.012 0.004 0.004
#> SRR390471 1 0.0981 0.75517 0.972 0.000 0.012 0.008 0.008
#> SRR390472 1 0.7507 0.41882 0.472 0.000 0.288 0.080 0.160
#> SRR390473 1 0.7494 0.42566 0.476 0.000 0.284 0.080 0.160
#> SRR390474 4 0.5651 0.49575 0.008 0.000 0.212 0.652 0.128
#> SRR390475 1 0.0324 0.75526 0.992 0.000 0.000 0.004 0.004
#> SRR390476 1 0.0324 0.75526 0.992 0.000 0.000 0.004 0.004
#> SRR390477 1 0.2074 0.75790 0.896 0.000 0.000 0.000 0.104
#> SRR390478 1 0.2074 0.75790 0.896 0.000 0.000 0.000 0.104
#> SRR390480 4 0.1444 0.61645 0.012 0.000 0.000 0.948 0.040
#> SRR390481 4 0.1331 0.61657 0.008 0.000 0.000 0.952 0.040
#> SRR390482 4 0.5233 0.45834 0.000 0.000 0.168 0.684 0.148
#> SRR390483 4 0.5010 0.47499 0.000 0.000 0.148 0.708 0.144
#> SRR390484 3 0.4619 0.41291 0.000 0.000 0.720 0.216 0.064
#> SRR390485 3 0.4588 0.41423 0.000 0.000 0.720 0.220 0.060
#> SRR390486 3 0.5417 0.43922 0.008 0.000 0.572 0.372 0.048
#> SRR390487 3 0.5835 0.40522 0.008 0.000 0.528 0.388 0.076
#> SRR390488 3 0.5566 0.39068 0.012 0.000 0.512 0.432 0.044
#> SRR390489 3 0.5566 0.39068 0.012 0.000 0.512 0.432 0.044
#> SRR390492 5 0.5759 0.89672 0.000 0.000 0.108 0.324 0.568
#> SRR390493 5 0.5759 0.89672 0.000 0.000 0.108 0.324 0.568
#> SRR390494 3 0.6784 -0.00085 0.000 0.000 0.368 0.280 0.352
#> SRR390495 5 0.5274 0.94527 0.000 0.000 0.056 0.372 0.572
#> SRR390496 5 0.5411 0.94600 0.004 0.000 0.056 0.368 0.572
#> SRR390497 3 0.4649 0.41341 0.000 0.000 0.716 0.220 0.064
#> SRR390498 3 0.4425 0.19117 0.000 0.024 0.680 0.000 0.296
#> SRR390499 4 0.1369 0.62753 0.008 0.000 0.008 0.956 0.028
#> SRR390500 4 0.2193 0.61310 0.008 0.000 0.028 0.920 0.044
#> SRR390501 3 0.5396 0.34667 0.012 0.000 0.492 0.464 0.032
#> SRR390502 3 0.5396 0.34667 0.012 0.000 0.492 0.464 0.032
#> SRR390503 3 0.5343 0.44437 0.008 0.000 0.580 0.368 0.044
#> SRR390504 3 0.5393 0.45150 0.008 0.000 0.596 0.344 0.052
#> SRR390505 1 0.7746 0.23555 0.384 0.000 0.368 0.096 0.152
#> SRR390506 3 0.7951 -0.05092 0.316 0.000 0.404 0.128 0.152
#> SRR390507 2 0.0162 0.99769 0.000 0.996 0.000 0.000 0.004
#> SRR390508 2 0.0162 0.99769 0.000 0.996 0.000 0.000 0.004
#> SRR390509 2 0.0162 0.99769 0.000 0.996 0.000 0.000 0.004
#> SRR390510 2 0.0162 0.99769 0.000 0.996 0.000 0.000 0.004
#> SRR390512 2 0.0000 0.99868 0.000 1.000 0.000 0.000 0.000
#> SRR390513 2 0.0000 0.99868 0.000 1.000 0.000 0.000 0.000
#> SRR390514 2 0.0000 0.99868 0.000 1.000 0.000 0.000 0.000
#> SRR390515 1 0.7511 0.43175 0.480 0.000 0.276 0.084 0.160
#> SRR390516 3 0.5477 0.44389 0.008 0.000 0.568 0.372 0.052
#> SRR390517 3 0.4425 0.19117 0.000 0.024 0.680 0.000 0.296
#> SRR390519 3 0.5187 0.41597 0.000 0.000 0.656 0.260 0.084
#> SRR390520 3 0.5658 0.35601 0.000 0.000 0.512 0.408 0.080
#> SRR390521 4 0.2378 0.64508 0.016 0.000 0.064 0.908 0.012
#> SRR390522 4 0.2364 0.64517 0.020 0.000 0.064 0.908 0.008
#> SRR390523 4 0.2644 0.64696 0.020 0.000 0.068 0.896 0.016
#> SRR390524 1 0.2074 0.75790 0.896 0.000 0.000 0.000 0.104
#> SRR390525 1 0.2074 0.75790 0.896 0.000 0.000 0.000 0.104
#> SRR390526 1 0.6749 -0.10842 0.440 0.000 0.108 0.416 0.036
#> SRR390527 1 0.6750 -0.12278 0.436 0.000 0.108 0.420 0.036
#> SRR390528 4 0.6611 -0.27088 0.024 0.000 0.376 0.480 0.120
#> SRR390529 1 0.7746 0.23555 0.384 0.000 0.368 0.096 0.152
#> SRR390530 1 0.2358 0.75730 0.888 0.000 0.000 0.008 0.104
#> SRR390531 1 0.2358 0.75730 0.888 0.000 0.000 0.008 0.104
#> SRR390532 4 0.5737 -0.37353 0.000 0.000 0.456 0.460 0.084
#> SRR390533 4 0.4016 0.36711 0.000 0.000 0.272 0.716 0.012
#> SRR390534 4 0.4040 0.35773 0.000 0.000 0.276 0.712 0.012
#> SRR390535 4 0.4980 0.48936 0.156 0.000 0.100 0.732 0.012
#> SRR390536 5 0.5400 0.94614 0.004 0.000 0.056 0.364 0.576
#> SRR390537 5 0.5411 0.94600 0.004 0.000 0.056 0.368 0.572
#> SRR390538 1 0.3737 0.67950 0.816 0.000 0.144 0.020 0.020
#> SRR390539 1 0.0324 0.75526 0.992 0.000 0.000 0.004 0.004
#> SRR390540 1 0.0324 0.75526 0.992 0.000 0.000 0.004 0.004
#> SRR390541 1 0.0324 0.75680 0.992 0.000 0.000 0.004 0.004
#> SRR390542 2 0.0000 0.99868 0.000 1.000 0.000 0.000 0.000
#> SRR390543 2 0.0000 0.99868 0.000 1.000 0.000 0.000 0.000
#> SRR390544 2 0.0000 0.99868 0.000 1.000 0.000 0.000 0.000
#> SRR390545 2 0.0000 0.99868 0.000 1.000 0.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.1852 0.7481 0.928 0.000 0.004 0.024 0.004 0.040
#> SRR390471 1 0.1931 0.7481 0.924 0.000 0.004 0.028 0.004 0.040
#> SRR390472 1 0.7713 0.0452 0.392 0.000 0.212 0.204 0.012 0.180
#> SRR390473 1 0.7713 0.0452 0.392 0.000 0.212 0.204 0.012 0.180
#> SRR390474 3 0.6054 -0.3276 0.000 0.000 0.444 0.324 0.228 0.004
#> SRR390475 1 0.1852 0.7500 0.928 0.000 0.004 0.024 0.004 0.040
#> SRR390476 1 0.1881 0.7496 0.928 0.000 0.008 0.020 0.004 0.040
#> SRR390477 1 0.3557 0.7409 0.812 0.000 0.008 0.136 0.008 0.036
#> SRR390478 1 0.3293 0.7459 0.824 0.000 0.000 0.128 0.008 0.040
#> SRR390480 4 0.5747 0.7858 0.008 0.000 0.176 0.544 0.272 0.000
#> SRR390481 4 0.5719 0.7645 0.004 0.000 0.172 0.524 0.300 0.000
#> SRR390482 3 0.6214 -0.2362 0.000 0.000 0.444 0.320 0.224 0.012
#> SRR390483 3 0.6269 -0.2855 0.000 0.000 0.408 0.288 0.296 0.008
#> SRR390484 3 0.6562 0.0685 0.000 0.000 0.416 0.100 0.088 0.396
#> SRR390485 3 0.6447 0.0825 0.000 0.000 0.424 0.104 0.072 0.400
#> SRR390486 3 0.2461 0.5053 0.000 0.000 0.888 0.004 0.064 0.044
#> SRR390487 3 0.3023 0.5004 0.000 0.000 0.864 0.036 0.064 0.036
#> SRR390488 3 0.1820 0.4828 0.000 0.000 0.924 0.056 0.012 0.008
#> SRR390489 3 0.1820 0.4828 0.000 0.000 0.924 0.056 0.012 0.008
#> SRR390492 5 0.2214 0.7982 0.000 0.000 0.092 0.012 0.892 0.004
#> SRR390493 5 0.2214 0.7982 0.000 0.000 0.092 0.012 0.892 0.004
#> SRR390494 5 0.5864 0.1150 0.000 0.000 0.364 0.156 0.472 0.008
#> SRR390495 5 0.0508 0.8338 0.000 0.000 0.012 0.004 0.984 0.000
#> SRR390496 5 0.0508 0.8338 0.000 0.000 0.012 0.004 0.984 0.000
#> SRR390497 3 0.6559 0.0851 0.000 0.000 0.424 0.100 0.088 0.388
#> SRR390498 6 0.2790 0.6712 0.020 0.028 0.080 0.000 0.000 0.872
#> SRR390499 4 0.5849 0.7659 0.004 0.000 0.204 0.508 0.284 0.000
#> SRR390500 4 0.6096 0.7266 0.008 0.000 0.220 0.460 0.312 0.000
#> SRR390501 3 0.1584 0.4767 0.000 0.000 0.928 0.064 0.008 0.000
#> SRR390502 3 0.1812 0.4725 0.000 0.000 0.912 0.080 0.008 0.000
#> SRR390503 3 0.3229 0.4660 0.000 0.000 0.816 0.000 0.044 0.140
#> SRR390504 3 0.4383 0.4327 0.012 0.000 0.756 0.016 0.056 0.160
#> SRR390505 3 0.7922 -0.3725 0.244 0.000 0.320 0.216 0.012 0.208
#> SRR390506 6 0.7630 0.2117 0.188 0.000 0.332 0.132 0.012 0.336
#> SRR390507 2 0.0363 0.9920 0.000 0.988 0.000 0.000 0.000 0.012
#> SRR390508 2 0.0363 0.9920 0.000 0.988 0.000 0.000 0.000 0.012
#> SRR390509 2 0.0363 0.9920 0.000 0.988 0.000 0.000 0.000 0.012
#> SRR390510 2 0.0363 0.9920 0.000 0.988 0.000 0.000 0.000 0.012
#> SRR390512 2 0.0000 0.9955 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390513 2 0.0000 0.9955 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390514 2 0.0000 0.9955 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390515 1 0.7699 0.0535 0.396 0.000 0.208 0.204 0.012 0.180
#> SRR390516 3 0.3370 0.4677 0.000 0.000 0.812 0.004 0.044 0.140
#> SRR390517 6 0.2790 0.6712 0.020 0.028 0.080 0.000 0.000 0.872
#> SRR390519 3 0.6759 0.2884 0.000 0.000 0.500 0.116 0.132 0.252
#> SRR390520 3 0.4082 0.3883 0.000 0.000 0.764 0.156 0.068 0.012
#> SRR390521 4 0.5624 0.8037 0.008 0.000 0.188 0.576 0.228 0.000
#> SRR390522 4 0.5603 0.8026 0.008 0.000 0.188 0.580 0.224 0.000
#> SRR390523 4 0.5664 0.8037 0.008 0.000 0.188 0.568 0.236 0.000
#> SRR390524 1 0.3251 0.7465 0.828 0.000 0.000 0.124 0.008 0.040
#> SRR390525 1 0.3251 0.7465 0.828 0.000 0.000 0.124 0.008 0.040
#> SRR390526 3 0.7287 -0.0627 0.336 0.000 0.360 0.204 0.004 0.096
#> SRR390527 3 0.7274 -0.0549 0.336 0.000 0.364 0.200 0.004 0.096
#> SRR390528 3 0.6141 0.1992 0.004 0.000 0.568 0.256 0.120 0.052
#> SRR390529 3 0.7871 -0.3625 0.280 0.000 0.320 0.188 0.012 0.200
#> SRR390530 1 0.4445 0.7025 0.744 0.000 0.020 0.176 0.008 0.052
#> SRR390531 1 0.4445 0.7025 0.744 0.000 0.020 0.176 0.008 0.052
#> SRR390532 3 0.4293 0.4013 0.000 0.000 0.736 0.164 0.096 0.004
#> SRR390533 4 0.5332 0.5820 0.004 0.000 0.368 0.548 0.068 0.012
#> SRR390534 4 0.5332 0.5820 0.004 0.000 0.368 0.548 0.068 0.012
#> SRR390535 4 0.6733 0.6373 0.124 0.000 0.236 0.536 0.092 0.012
#> SRR390536 5 0.0603 0.8322 0.000 0.000 0.016 0.004 0.980 0.000
#> SRR390537 5 0.0508 0.8338 0.000 0.000 0.012 0.004 0.984 0.000
#> SRR390538 1 0.3067 0.7019 0.860 0.000 0.064 0.012 0.004 0.060
#> SRR390539 1 0.0653 0.7584 0.980 0.000 0.004 0.012 0.004 0.000
#> SRR390540 1 0.1837 0.7480 0.928 0.000 0.004 0.020 0.004 0.044
#> SRR390541 1 0.0696 0.7593 0.980 0.000 0.004 0.008 0.004 0.004
#> SRR390542 2 0.0000 0.9955 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390543 2 0.0000 0.9955 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390544 2 0.0000 0.9955 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390545 2 0.0000 0.9955 0.000 1.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
MAD:NMF*
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"]
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 15244 rows and 71 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 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:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.941 0.905 0.964 0.4766 0.522 0.522
#> 3 3 0.618 0.676 0.812 0.3320 0.712 0.507
#> 4 4 0.741 0.790 0.879 0.1434 0.845 0.605
#> 5 5 0.797 0.780 0.860 0.0730 0.939 0.785
#> 6 6 0.898 0.858 0.902 0.0538 0.920 0.677
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
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.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.0000 0.96452 1.000 0.000
#> SRR390471 1 0.0000 0.96452 1.000 0.000
#> SRR390472 1 0.0000 0.96452 1.000 0.000
#> SRR390473 1 0.0000 0.96452 1.000 0.000
#> SRR390474 1 0.9977 0.07292 0.528 0.472
#> SRR390475 1 0.0000 0.96452 1.000 0.000
#> SRR390476 1 0.0000 0.96452 1.000 0.000
#> SRR390477 1 0.0000 0.96452 1.000 0.000
#> SRR390478 1 0.0000 0.96452 1.000 0.000
#> SRR390480 1 0.0000 0.96452 1.000 0.000
#> SRR390481 1 0.2948 0.92587 0.948 0.052
#> SRR390482 2 0.9427 0.43839 0.360 0.640
#> SRR390483 2 0.9427 0.43825 0.360 0.640
#> SRR390484 2 0.0376 0.94951 0.004 0.996
#> SRR390485 2 0.1414 0.93656 0.020 0.980
#> SRR390486 1 0.0000 0.96452 1.000 0.000
#> SRR390487 1 0.1414 0.95129 0.980 0.020
#> SRR390488 1 0.0000 0.96452 1.000 0.000
#> SRR390489 1 0.0000 0.96452 1.000 0.000
#> SRR390492 2 0.0000 0.95225 0.000 1.000
#> SRR390493 2 0.0000 0.95225 0.000 1.000
#> SRR390494 2 0.0000 0.95225 0.000 1.000
#> SRR390495 2 0.0000 0.95225 0.000 1.000
#> SRR390496 2 0.0000 0.95225 0.000 1.000
#> SRR390497 2 0.0938 0.94344 0.012 0.988
#> SRR390498 2 0.0000 0.95225 0.000 1.000
#> SRR390499 1 0.3114 0.92227 0.944 0.056
#> SRR390500 1 0.6438 0.79288 0.836 0.164
#> SRR390501 1 0.0000 0.96452 1.000 0.000
#> SRR390502 1 0.0000 0.96452 1.000 0.000
#> SRR390503 1 0.0000 0.96452 1.000 0.000
#> SRR390504 1 0.0000 0.96452 1.000 0.000
#> SRR390505 1 0.0000 0.96452 1.000 0.000
#> SRR390506 1 0.0000 0.96452 1.000 0.000
#> SRR390507 2 0.0000 0.95225 0.000 1.000
#> SRR390508 2 0.0000 0.95225 0.000 1.000
#> SRR390509 2 0.0000 0.95225 0.000 1.000
#> SRR390510 2 0.0000 0.95225 0.000 1.000
#> SRR390512 2 0.0000 0.95225 0.000 1.000
#> SRR390513 2 0.0000 0.95225 0.000 1.000
#> SRR390514 2 0.0000 0.95225 0.000 1.000
#> SRR390515 1 0.0000 0.96452 1.000 0.000
#> SRR390516 1 0.0000 0.96452 1.000 0.000
#> SRR390517 2 0.0000 0.95225 0.000 1.000
#> SRR390519 2 0.0000 0.95225 0.000 1.000
#> SRR390520 1 0.2236 0.93934 0.964 0.036
#> SRR390521 1 0.3274 0.91849 0.940 0.060
#> SRR390522 1 0.3274 0.91849 0.940 0.060
#> SRR390523 1 0.1633 0.94833 0.976 0.024
#> SRR390524 1 0.0000 0.96452 1.000 0.000
#> SRR390525 1 0.0000 0.96452 1.000 0.000
#> SRR390526 1 0.0000 0.96452 1.000 0.000
#> SRR390527 1 0.0000 0.96452 1.000 0.000
#> SRR390528 1 0.9996 0.00994 0.512 0.488
#> SRR390529 1 0.0000 0.96452 1.000 0.000
#> SRR390530 1 0.0000 0.96452 1.000 0.000
#> SRR390531 1 0.0000 0.96452 1.000 0.000
#> SRR390532 2 0.9686 0.34537 0.396 0.604
#> SRR390533 1 0.0000 0.96452 1.000 0.000
#> SRR390534 1 0.0000 0.96452 1.000 0.000
#> SRR390535 1 0.0000 0.96452 1.000 0.000
#> SRR390536 2 0.0000 0.95225 0.000 1.000
#> SRR390537 2 0.0000 0.95225 0.000 1.000
#> SRR390538 1 0.0000 0.96452 1.000 0.000
#> SRR390539 1 0.0000 0.96452 1.000 0.000
#> SRR390540 1 0.0000 0.96452 1.000 0.000
#> SRR390541 1 0.0000 0.96452 1.000 0.000
#> SRR390542 2 0.0000 0.95225 0.000 1.000
#> SRR390543 2 0.0000 0.95225 0.000 1.000
#> SRR390544 2 0.0000 0.95225 0.000 1.000
#> SRR390545 2 0.0000 0.95225 0.000 1.000
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.0000 0.918 1.000 0.000 0.000
#> SRR390471 1 0.0000 0.918 1.000 0.000 0.000
#> SRR390472 1 0.4121 0.788 0.832 0.168 0.000
#> SRR390473 1 0.4002 0.795 0.840 0.160 0.000
#> SRR390474 3 0.7782 0.469 0.256 0.096 0.648
#> SRR390475 1 0.0237 0.916 0.996 0.000 0.004
#> SRR390476 1 0.0000 0.918 1.000 0.000 0.000
#> SRR390477 1 0.0000 0.918 1.000 0.000 0.000
#> SRR390478 1 0.0000 0.918 1.000 0.000 0.000
#> SRR390480 3 0.4235 0.541 0.176 0.000 0.824
#> SRR390481 3 0.2261 0.554 0.068 0.000 0.932
#> SRR390482 3 0.7152 0.562 0.024 0.444 0.532
#> SRR390483 3 0.6275 0.590 0.008 0.348 0.644
#> SRR390484 3 0.6307 0.542 0.000 0.488 0.512
#> SRR390485 3 0.6308 0.539 0.000 0.492 0.508
#> SRR390486 1 0.6483 0.380 0.544 0.452 0.004
#> SRR390487 2 0.8395 -0.309 0.436 0.480 0.084
#> SRR390488 1 0.0237 0.916 0.996 0.004 0.000
#> SRR390489 1 0.0237 0.916 0.996 0.004 0.000
#> SRR390492 3 0.5591 0.590 0.000 0.304 0.696
#> SRR390493 3 0.6225 0.567 0.000 0.432 0.568
#> SRR390494 3 0.2796 0.567 0.000 0.092 0.908
#> SRR390495 3 0.0000 0.511 0.000 0.000 1.000
#> SRR390496 3 0.0000 0.511 0.000 0.000 1.000
#> SRR390497 3 0.6307 0.542 0.000 0.488 0.512
#> SRR390498 2 0.2878 0.351 0.000 0.904 0.096
#> SRR390499 3 0.2448 0.558 0.076 0.000 0.924
#> SRR390500 3 0.2448 0.556 0.076 0.000 0.924
#> SRR390501 1 0.0475 0.915 0.992 0.004 0.004
#> SRR390502 1 0.0661 0.913 0.988 0.004 0.008
#> SRR390503 1 0.6489 0.372 0.540 0.456 0.004
#> SRR390504 1 0.6683 0.300 0.500 0.492 0.008
#> SRR390505 1 0.0000 0.918 1.000 0.000 0.000
#> SRR390506 1 0.1031 0.904 0.976 0.024 0.000
#> SRR390507 2 0.6168 0.724 0.000 0.588 0.412
#> SRR390508 2 0.6168 0.724 0.000 0.588 0.412
#> SRR390509 2 0.6168 0.724 0.000 0.588 0.412
#> SRR390510 2 0.6168 0.724 0.000 0.588 0.412
#> SRR390512 2 0.6302 0.713 0.000 0.520 0.480
#> SRR390513 2 0.6305 0.709 0.000 0.516 0.484
#> SRR390514 2 0.6305 0.709 0.000 0.516 0.484
#> SRR390515 1 0.0000 0.918 1.000 0.000 0.000
#> SRR390516 1 0.4399 0.768 0.812 0.188 0.000
#> SRR390517 2 0.5760 0.643 0.000 0.672 0.328
#> SRR390519 3 0.6305 0.544 0.000 0.484 0.516
#> SRR390520 2 0.9746 -0.328 0.328 0.432 0.240
#> SRR390521 3 0.4750 0.461 0.216 0.000 0.784
#> SRR390522 3 0.5138 0.413 0.252 0.000 0.748
#> SRR390523 3 0.6235 0.256 0.436 0.000 0.564
#> SRR390524 1 0.0000 0.918 1.000 0.000 0.000
#> SRR390525 1 0.0000 0.918 1.000 0.000 0.000
#> SRR390526 1 0.0000 0.918 1.000 0.000 0.000
#> SRR390527 1 0.0000 0.918 1.000 0.000 0.000
#> SRR390528 3 0.4575 0.544 0.184 0.004 0.812
#> SRR390529 1 0.0000 0.918 1.000 0.000 0.000
#> SRR390530 1 0.0000 0.918 1.000 0.000 0.000
#> SRR390531 1 0.0000 0.918 1.000 0.000 0.000
#> SRR390532 3 0.6822 0.545 0.012 0.480 0.508
#> SRR390533 1 0.3816 0.777 0.852 0.000 0.148
#> SRR390534 1 0.3619 0.792 0.864 0.000 0.136
#> SRR390535 1 0.3686 0.789 0.860 0.000 0.140
#> SRR390536 3 0.0000 0.511 0.000 0.000 1.000
#> SRR390537 3 0.0000 0.511 0.000 0.000 1.000
#> SRR390538 1 0.0000 0.918 1.000 0.000 0.000
#> SRR390539 1 0.0000 0.918 1.000 0.000 0.000
#> SRR390540 1 0.0237 0.916 0.996 0.000 0.004
#> SRR390541 1 0.0000 0.918 1.000 0.000 0.000
#> SRR390542 2 0.6274 0.727 0.000 0.544 0.456
#> SRR390543 2 0.6286 0.725 0.000 0.536 0.464
#> SRR390544 2 0.6291 0.723 0.000 0.532 0.468
#> SRR390545 2 0.6286 0.725 0.000 0.536 0.464
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.0000 0.913 1.000 0.000 0.000 0.000
#> SRR390471 1 0.0000 0.913 1.000 0.000 0.000 0.000
#> SRR390472 1 0.2647 0.818 0.880 0.000 0.120 0.000
#> SRR390473 1 0.2011 0.857 0.920 0.000 0.080 0.000
#> SRR390474 4 0.4822 0.696 0.024 0.008 0.212 0.756
#> SRR390475 1 0.0000 0.913 1.000 0.000 0.000 0.000
#> SRR390476 1 0.0000 0.913 1.000 0.000 0.000 0.000
#> SRR390477 1 0.0000 0.913 1.000 0.000 0.000 0.000
#> SRR390478 1 0.0000 0.913 1.000 0.000 0.000 0.000
#> SRR390480 4 0.2924 0.775 0.100 0.016 0.000 0.884
#> SRR390481 4 0.2329 0.786 0.072 0.012 0.000 0.916
#> SRR390482 4 0.4282 0.735 0.036 0.004 0.148 0.812
#> SRR390483 4 0.3681 0.746 0.024 0.004 0.124 0.848
#> SRR390484 3 0.4814 0.582 0.000 0.008 0.676 0.316
#> SRR390485 3 0.4769 0.591 0.000 0.008 0.684 0.308
#> SRR390486 3 0.3198 0.723 0.080 0.000 0.880 0.040
#> SRR390487 3 0.2500 0.739 0.044 0.000 0.916 0.040
#> SRR390488 1 0.5821 0.418 0.592 0.000 0.368 0.040
#> SRR390489 1 0.5807 0.427 0.596 0.000 0.364 0.040
#> SRR390492 4 0.3718 0.717 0.000 0.012 0.168 0.820
#> SRR390493 4 0.3751 0.695 0.000 0.004 0.196 0.800
#> SRR390494 4 0.3196 0.738 0.000 0.008 0.136 0.856
#> SRR390495 4 0.2578 0.769 0.000 0.036 0.052 0.912
#> SRR390496 4 0.2660 0.766 0.000 0.056 0.036 0.908
#> SRR390497 3 0.4677 0.584 0.000 0.004 0.680 0.316
#> SRR390498 2 0.3249 0.823 0.000 0.852 0.140 0.008
#> SRR390499 4 0.2329 0.786 0.072 0.012 0.000 0.916
#> SRR390500 4 0.2450 0.786 0.072 0.016 0.000 0.912
#> SRR390501 1 0.5778 0.442 0.604 0.000 0.356 0.040
#> SRR390502 1 0.6200 0.406 0.580 0.000 0.356 0.064
#> SRR390503 3 0.2363 0.741 0.056 0.000 0.920 0.024
#> SRR390504 3 0.1545 0.741 0.040 0.000 0.952 0.008
#> SRR390505 1 0.0188 0.913 0.996 0.000 0.004 0.000
#> SRR390506 1 0.0592 0.907 0.984 0.000 0.016 0.000
#> SRR390507 2 0.0000 0.978 0.000 1.000 0.000 0.000
#> SRR390508 2 0.0000 0.978 0.000 1.000 0.000 0.000
#> SRR390509 2 0.0000 0.978 0.000 1.000 0.000 0.000
#> SRR390510 2 0.0000 0.978 0.000 1.000 0.000 0.000
#> SRR390512 2 0.0707 0.972 0.000 0.980 0.000 0.020
#> SRR390513 2 0.0817 0.970 0.000 0.976 0.000 0.024
#> SRR390514 2 0.0817 0.970 0.000 0.976 0.000 0.024
#> SRR390515 1 0.0188 0.913 0.996 0.000 0.004 0.000
#> SRR390516 3 0.4831 0.578 0.208 0.000 0.752 0.040
#> SRR390517 2 0.0000 0.978 0.000 1.000 0.000 0.000
#> SRR390519 3 0.4624 0.540 0.000 0.000 0.660 0.340
#> SRR390520 3 0.4655 0.720 0.088 0.000 0.796 0.116
#> SRR390521 4 0.3240 0.780 0.056 0.016 0.036 0.892
#> SRR390522 4 0.3427 0.771 0.104 0.020 0.008 0.868
#> SRR390523 4 0.4265 0.728 0.156 0.016 0.016 0.812
#> SRR390524 1 0.0188 0.913 0.996 0.000 0.004 0.000
#> SRR390525 1 0.0188 0.913 0.996 0.000 0.004 0.000
#> SRR390526 1 0.1118 0.883 0.964 0.000 0.000 0.036
#> SRR390527 1 0.1118 0.883 0.964 0.000 0.000 0.036
#> SRR390528 4 0.4756 0.751 0.148 0.016 0.040 0.796
#> SRR390529 1 0.0336 0.911 0.992 0.000 0.008 0.000
#> SRR390530 1 0.0336 0.911 0.992 0.000 0.008 0.000
#> SRR390531 1 0.0336 0.911 0.992 0.000 0.008 0.000
#> SRR390532 4 0.5003 0.460 0.016 0.000 0.308 0.676
#> SRR390533 4 0.4955 0.527 0.344 0.000 0.008 0.648
#> SRR390534 4 0.4990 0.517 0.352 0.000 0.008 0.640
#> SRR390535 4 0.4898 0.426 0.416 0.000 0.000 0.584
#> SRR390536 4 0.3323 0.761 0.000 0.060 0.064 0.876
#> SRR390537 4 0.3088 0.763 0.000 0.060 0.052 0.888
#> SRR390538 1 0.0000 0.913 1.000 0.000 0.000 0.000
#> SRR390539 1 0.0000 0.913 1.000 0.000 0.000 0.000
#> SRR390540 1 0.0000 0.913 1.000 0.000 0.000 0.000
#> SRR390541 1 0.0000 0.913 1.000 0.000 0.000 0.000
#> SRR390542 2 0.0188 0.978 0.000 0.996 0.000 0.004
#> SRR390543 2 0.0336 0.978 0.000 0.992 0.000 0.008
#> SRR390544 2 0.0469 0.976 0.000 0.988 0.000 0.012
#> SRR390545 2 0.0336 0.978 0.000 0.992 0.000 0.008
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.0290 0.937 0.992 0.008 0.000 0.000 0.000
#> SRR390471 1 0.0162 0.937 0.996 0.004 0.000 0.000 0.000
#> SRR390472 1 0.2536 0.827 0.868 0.000 0.004 0.000 0.128
#> SRR390473 1 0.1892 0.877 0.916 0.000 0.004 0.000 0.080
#> SRR390474 4 0.3946 0.612 0.028 0.000 0.076 0.828 0.068
#> SRR390475 1 0.0290 0.937 0.992 0.008 0.000 0.000 0.000
#> SRR390476 1 0.0290 0.937 0.992 0.008 0.000 0.000 0.000
#> SRR390477 1 0.1043 0.920 0.960 0.040 0.000 0.000 0.000
#> SRR390478 1 0.0794 0.928 0.972 0.028 0.000 0.000 0.000
#> SRR390480 4 0.5511 0.670 0.020 0.376 0.000 0.568 0.036
#> SRR390481 4 0.5299 0.671 0.008 0.376 0.000 0.576 0.040
#> SRR390482 4 0.6569 0.646 0.020 0.376 0.000 0.480 0.124
#> SRR390483 4 0.6453 0.650 0.016 0.376 0.000 0.488 0.120
#> SRR390484 5 0.5834 0.750 0.000 0.000 0.136 0.276 0.588
#> SRR390485 5 0.5851 0.747 0.000 0.000 0.140 0.272 0.588
#> SRR390486 3 0.0609 0.815 0.020 0.000 0.980 0.000 0.000
#> SRR390487 3 0.0671 0.799 0.000 0.004 0.980 0.016 0.000
#> SRR390488 3 0.2806 0.826 0.152 0.000 0.844 0.004 0.000
#> SRR390489 3 0.2690 0.822 0.156 0.000 0.844 0.000 0.000
#> SRR390492 4 0.2612 0.579 0.000 0.000 0.008 0.868 0.124
#> SRR390493 4 0.2997 0.548 0.000 0.000 0.012 0.840 0.148
#> SRR390494 4 0.2280 0.586 0.000 0.000 0.000 0.880 0.120
#> SRR390495 4 0.0404 0.637 0.000 0.000 0.000 0.988 0.012
#> SRR390496 4 0.0579 0.640 0.000 0.000 0.008 0.984 0.008
#> SRR390497 5 0.5834 0.750 0.000 0.000 0.136 0.276 0.588
#> SRR390498 5 0.4687 -0.581 0.000 0.336 0.028 0.000 0.636
#> SRR390499 4 0.5333 0.671 0.012 0.376 0.000 0.576 0.036
#> SRR390500 4 0.5526 0.670 0.028 0.376 0.000 0.568 0.028
#> SRR390501 3 0.3111 0.827 0.144 0.004 0.840 0.012 0.000
#> SRR390502 3 0.3584 0.810 0.076 0.008 0.840 0.076 0.000
#> SRR390503 3 0.0609 0.815 0.020 0.000 0.980 0.000 0.000
#> SRR390504 3 0.4451 0.415 0.004 0.004 0.668 0.008 0.316
#> SRR390505 1 0.0000 0.937 1.000 0.000 0.000 0.000 0.000
#> SRR390506 1 0.0609 0.926 0.980 0.000 0.020 0.000 0.000
#> SRR390507 2 0.4380 0.994 0.000 0.616 0.008 0.000 0.376
#> SRR390508 2 0.4380 0.994 0.000 0.616 0.008 0.000 0.376
#> SRR390509 2 0.4380 0.994 0.000 0.616 0.008 0.000 0.376
#> SRR390510 2 0.4380 0.994 0.000 0.616 0.008 0.000 0.376
#> SRR390512 2 0.4114 0.995 0.000 0.624 0.000 0.000 0.376
#> SRR390513 2 0.4114 0.995 0.000 0.624 0.000 0.000 0.376
#> SRR390514 2 0.4114 0.995 0.000 0.624 0.000 0.000 0.376
#> SRR390515 1 0.0000 0.937 1.000 0.000 0.000 0.000 0.000
#> SRR390516 3 0.2787 0.832 0.136 0.004 0.856 0.004 0.000
#> SRR390517 2 0.4380 0.994 0.000 0.616 0.008 0.000 0.376
#> SRR390519 5 0.5834 0.746 0.000 0.000 0.132 0.284 0.584
#> SRR390520 3 0.5103 0.663 0.052 0.000 0.752 0.112 0.084
#> SRR390521 4 0.2751 0.646 0.044 0.004 0.020 0.900 0.032
#> SRR390522 4 0.2997 0.644 0.072 0.004 0.008 0.880 0.036
#> SRR390523 4 0.3317 0.629 0.112 0.000 0.008 0.848 0.032
#> SRR390524 1 0.0290 0.936 0.992 0.008 0.000 0.000 0.000
#> SRR390525 1 0.0404 0.935 0.988 0.012 0.000 0.000 0.000
#> SRR390526 1 0.4030 0.544 0.648 0.352 0.000 0.000 0.000
#> SRR390527 1 0.4060 0.530 0.640 0.360 0.000 0.000 0.000
#> SRR390528 4 0.6816 0.646 0.060 0.376 0.000 0.480 0.084
#> SRR390529 1 0.0510 0.929 0.984 0.000 0.016 0.000 0.000
#> SRR390530 1 0.0703 0.930 0.976 0.024 0.000 0.000 0.000
#> SRR390531 1 0.1121 0.918 0.956 0.044 0.000 0.000 0.000
#> SRR390532 4 0.6372 0.614 0.000 0.376 0.000 0.456 0.168
#> SRR390533 4 0.5629 0.684 0.084 0.264 0.004 0.640 0.008
#> SRR390534 4 0.5563 0.683 0.088 0.264 0.004 0.640 0.004
#> SRR390535 4 0.6973 0.489 0.240 0.376 0.004 0.376 0.004
#> SRR390536 4 0.1608 0.616 0.000 0.000 0.000 0.928 0.072
#> SRR390537 4 0.0404 0.637 0.000 0.000 0.000 0.988 0.012
#> SRR390538 1 0.0000 0.937 1.000 0.000 0.000 0.000 0.000
#> SRR390539 1 0.0290 0.937 0.992 0.008 0.000 0.000 0.000
#> SRR390540 1 0.0162 0.937 0.996 0.004 0.000 0.000 0.000
#> SRR390541 1 0.0000 0.937 1.000 0.000 0.000 0.000 0.000
#> SRR390542 2 0.4114 0.995 0.000 0.624 0.000 0.000 0.376
#> SRR390543 2 0.4114 0.995 0.000 0.624 0.000 0.000 0.376
#> SRR390544 2 0.4114 0.995 0.000 0.624 0.000 0.000 0.376
#> SRR390545 2 0.4114 0.995 0.000 0.624 0.000 0.000 0.376
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.0622 0.9491 0.980 0.000 0.000 0.008 0.000 0.012
#> SRR390471 1 0.0622 0.9491 0.980 0.000 0.000 0.008 0.000 0.012
#> SRR390472 1 0.0777 0.9483 0.972 0.000 0.000 0.004 0.000 0.024
#> SRR390473 1 0.0858 0.9469 0.968 0.000 0.000 0.004 0.000 0.028
#> SRR390474 5 0.4601 0.7225 0.056 0.000 0.080 0.004 0.760 0.100
#> SRR390475 1 0.0363 0.9496 0.988 0.000 0.000 0.000 0.000 0.012
#> SRR390476 1 0.0725 0.9488 0.976 0.000 0.000 0.012 0.000 0.012
#> SRR390477 1 0.0790 0.9462 0.968 0.000 0.000 0.032 0.000 0.000
#> SRR390478 1 0.0858 0.9471 0.968 0.000 0.000 0.028 0.000 0.004
#> SRR390480 4 0.1556 0.8711 0.000 0.000 0.000 0.920 0.080 0.000
#> SRR390481 4 0.1556 0.8711 0.000 0.000 0.000 0.920 0.080 0.000
#> SRR390482 4 0.1564 0.8675 0.000 0.000 0.000 0.936 0.040 0.024
#> SRR390483 4 0.1461 0.8695 0.000 0.000 0.000 0.940 0.044 0.016
#> SRR390484 6 0.3101 0.9883 0.000 0.000 0.000 0.000 0.244 0.756
#> SRR390485 6 0.3101 0.9883 0.000 0.000 0.000 0.000 0.244 0.756
#> SRR390486 3 0.0146 0.9042 0.004 0.000 0.996 0.000 0.000 0.000
#> SRR390487 3 0.0146 0.8996 0.000 0.004 0.996 0.000 0.000 0.000
#> SRR390488 3 0.0146 0.9042 0.004 0.000 0.996 0.000 0.000 0.000
#> SRR390489 3 0.0146 0.9042 0.004 0.000 0.996 0.000 0.000 0.000
#> SRR390492 5 0.2562 0.6901 0.000 0.000 0.000 0.000 0.828 0.172
#> SRR390493 5 0.2823 0.6424 0.000 0.000 0.000 0.000 0.796 0.204
#> SRR390494 5 0.2219 0.7318 0.000 0.000 0.000 0.000 0.864 0.136
#> SRR390495 5 0.0260 0.8036 0.000 0.000 0.000 0.000 0.992 0.008
#> SRR390496 5 0.0632 0.8007 0.000 0.000 0.000 0.000 0.976 0.024
#> SRR390497 6 0.3101 0.9883 0.000 0.000 0.000 0.000 0.244 0.756
#> SRR390498 2 0.3512 0.6211 0.000 0.720 0.000 0.008 0.000 0.272
#> SRR390499 4 0.1501 0.8719 0.000 0.000 0.000 0.924 0.076 0.000
#> SRR390500 4 0.1531 0.8721 0.000 0.000 0.000 0.928 0.068 0.004
#> SRR390501 3 0.0146 0.9042 0.004 0.000 0.996 0.000 0.000 0.000
#> SRR390502 3 0.0146 0.9042 0.004 0.000 0.996 0.000 0.000 0.000
#> SRR390503 3 0.0146 0.9042 0.004 0.000 0.996 0.000 0.000 0.000
#> SRR390504 3 0.3446 0.5743 0.000 0.000 0.692 0.000 0.000 0.308
#> SRR390505 1 0.2258 0.9202 0.896 0.000 0.000 0.044 0.000 0.060
#> SRR390506 1 0.2571 0.9059 0.876 0.000 0.000 0.064 0.000 0.060
#> SRR390507 2 0.0000 0.9738 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390508 2 0.0000 0.9738 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390509 2 0.0000 0.9738 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390510 2 0.0000 0.9738 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390512 2 0.0146 0.9740 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR390513 2 0.0146 0.9740 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR390514 2 0.0146 0.9740 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR390515 1 0.0909 0.9471 0.968 0.000 0.000 0.020 0.000 0.012
#> SRR390516 3 0.0146 0.9042 0.004 0.000 0.996 0.000 0.000 0.000
#> SRR390517 2 0.0146 0.9718 0.000 0.996 0.000 0.000 0.000 0.004
#> SRR390519 6 0.3244 0.9639 0.000 0.000 0.000 0.000 0.268 0.732
#> SRR390520 3 0.6218 0.0195 0.044 0.000 0.456 0.008 0.088 0.404
#> SRR390521 5 0.3663 0.7230 0.040 0.000 0.000 0.004 0.776 0.180
#> SRR390522 5 0.3663 0.7230 0.040 0.000 0.000 0.004 0.776 0.180
#> SRR390523 5 0.3834 0.7069 0.084 0.000 0.000 0.000 0.772 0.144
#> SRR390524 1 0.0713 0.9474 0.972 0.000 0.000 0.028 0.000 0.000
#> SRR390525 1 0.0713 0.9474 0.972 0.000 0.000 0.028 0.000 0.000
#> SRR390526 4 0.2278 0.7689 0.128 0.000 0.000 0.868 0.000 0.004
#> SRR390527 4 0.2100 0.7849 0.112 0.000 0.000 0.884 0.000 0.004
#> SRR390528 4 0.1297 0.8692 0.000 0.000 0.000 0.948 0.040 0.012
#> SRR390529 1 0.2119 0.9248 0.904 0.000 0.000 0.036 0.000 0.060
#> SRR390530 1 0.1151 0.9436 0.956 0.000 0.000 0.032 0.000 0.012
#> SRR390531 1 0.1151 0.9436 0.956 0.000 0.000 0.032 0.000 0.012
#> SRR390532 4 0.1341 0.8627 0.000 0.000 0.000 0.948 0.028 0.024
#> SRR390533 4 0.4417 0.2766 0.028 0.000 0.000 0.556 0.416 0.000
#> SRR390534 4 0.4410 0.2825 0.028 0.000 0.000 0.560 0.412 0.000
#> SRR390535 4 0.1866 0.8662 0.008 0.000 0.000 0.908 0.084 0.000
#> SRR390536 5 0.0937 0.7964 0.000 0.000 0.000 0.000 0.960 0.040
#> SRR390537 5 0.0547 0.8022 0.000 0.000 0.000 0.000 0.980 0.020
#> SRR390538 1 0.2119 0.9248 0.904 0.000 0.000 0.036 0.000 0.060
#> SRR390539 1 0.2119 0.9248 0.904 0.000 0.000 0.036 0.000 0.060
#> SRR390540 1 0.2119 0.9248 0.904 0.000 0.000 0.036 0.000 0.060
#> SRR390541 1 0.2119 0.9248 0.904 0.000 0.000 0.036 0.000 0.060
#> SRR390542 2 0.0000 0.9738 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390543 2 0.0146 0.9740 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR390544 2 0.0146 0.9740 0.000 0.996 0.000 0.004 0.000 0.000
#> SRR390545 2 0.0146 0.9740 0.000 0.996 0.000 0.004 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
ATC:hclust
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"]
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 15244 rows and 71 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'hclust' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 2.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)

The plots are:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.741 0.910 0.958 0.3878 0.616 0.616
#> 3 3 0.766 0.879 0.947 0.0963 0.974 0.958
#> 4 4 0.587 0.656 0.863 0.3019 0.840 0.731
#> 5 5 0.563 0.770 0.880 0.1264 0.864 0.708
#> 6 6 0.623 0.692 0.795 0.0941 0.988 0.966
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
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.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.0000 0.963 1.000 0.000
#> SRR390471 1 0.0000 0.963 1.000 0.000
#> SRR390472 2 0.0000 0.924 0.000 1.000
#> SRR390473 2 0.0000 0.924 0.000 1.000
#> SRR390474 1 0.0938 0.954 0.988 0.012
#> SRR390475 1 0.0000 0.963 1.000 0.000
#> SRR390476 1 0.0000 0.963 1.000 0.000
#> SRR390477 1 0.0000 0.963 1.000 0.000
#> SRR390478 1 0.0000 0.963 1.000 0.000
#> SRR390480 1 0.0000 0.963 1.000 0.000
#> SRR390481 1 0.0000 0.963 1.000 0.000
#> SRR390482 1 0.3274 0.911 0.940 0.060
#> SRR390483 1 0.3274 0.911 0.940 0.060
#> SRR390484 2 0.0000 0.924 0.000 1.000
#> SRR390485 2 0.0000 0.924 0.000 1.000
#> SRR390486 2 0.7139 0.781 0.196 0.804
#> SRR390487 2 0.7139 0.781 0.196 0.804
#> SRR390488 1 0.0376 0.960 0.996 0.004
#> SRR390489 1 0.0376 0.960 0.996 0.004
#> SRR390492 1 0.7602 0.721 0.780 0.220
#> SRR390493 1 0.7602 0.721 0.780 0.220
#> SRR390494 1 0.0000 0.963 1.000 0.000
#> SRR390495 1 0.0000 0.963 1.000 0.000
#> SRR390496 1 0.0000 0.963 1.000 0.000
#> SRR390497 2 0.0000 0.924 0.000 1.000
#> SRR390498 2 0.5519 0.852 0.128 0.872
#> SRR390499 1 0.0000 0.963 1.000 0.000
#> SRR390500 1 0.0000 0.963 1.000 0.000
#> SRR390501 1 0.0000 0.963 1.000 0.000
#> SRR390502 1 0.0000 0.963 1.000 0.000
#> SRR390503 2 0.0000 0.924 0.000 1.000
#> SRR390504 2 0.0000 0.924 0.000 1.000
#> SRR390505 2 0.1414 0.924 0.020 0.980
#> SRR390506 2 0.1414 0.924 0.020 0.980
#> SRR390507 1 0.8661 0.610 0.712 0.288
#> SRR390508 1 0.8661 0.610 0.712 0.288
#> SRR390509 1 0.8661 0.610 0.712 0.288
#> SRR390510 1 0.8661 0.610 0.712 0.288
#> SRR390512 1 0.0000 0.963 1.000 0.000
#> SRR390513 1 0.0000 0.963 1.000 0.000
#> SRR390514 1 0.0000 0.963 1.000 0.000
#> SRR390515 2 0.4022 0.891 0.080 0.920
#> SRR390516 2 0.1414 0.924 0.020 0.980
#> SRR390517 2 0.5629 0.848 0.132 0.868
#> SRR390519 2 0.0000 0.924 0.000 1.000
#> SRR390520 2 0.9815 0.352 0.420 0.580
#> SRR390521 1 0.0000 0.963 1.000 0.000
#> SRR390522 1 0.0000 0.963 1.000 0.000
#> SRR390523 1 0.0000 0.963 1.000 0.000
#> SRR390524 1 0.0000 0.963 1.000 0.000
#> SRR390525 1 0.0000 0.963 1.000 0.000
#> SRR390526 1 0.0000 0.963 1.000 0.000
#> SRR390527 1 0.0000 0.963 1.000 0.000
#> SRR390528 1 0.0000 0.963 1.000 0.000
#> SRR390529 2 0.1414 0.924 0.020 0.980
#> SRR390530 1 0.0000 0.963 1.000 0.000
#> SRR390531 1 0.0000 0.963 1.000 0.000
#> SRR390532 1 0.0000 0.963 1.000 0.000
#> SRR390533 1 0.0000 0.963 1.000 0.000
#> SRR390534 1 0.0000 0.963 1.000 0.000
#> SRR390535 1 0.0000 0.963 1.000 0.000
#> SRR390536 1 0.0000 0.963 1.000 0.000
#> SRR390537 1 0.0000 0.963 1.000 0.000
#> SRR390538 1 0.0000 0.963 1.000 0.000
#> SRR390539 1 0.0000 0.963 1.000 0.000
#> SRR390540 1 0.0000 0.963 1.000 0.000
#> SRR390541 1 0.0000 0.963 1.000 0.000
#> SRR390542 1 0.0000 0.963 1.000 0.000
#> SRR390543 1 0.0000 0.963 1.000 0.000
#> SRR390544 1 0.0000 0.963 1.000 0.000
#> SRR390545 1 0.0000 0.963 1.000 0.000
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390471 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390472 2 0.4605 0.665 0.000 0.796 0.204
#> SRR390473 2 0.4605 0.665 0.000 0.796 0.204
#> SRR390474 1 0.0892 0.944 0.980 0.020 0.000
#> SRR390475 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390476 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390477 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390478 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390480 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390481 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390482 1 0.2448 0.895 0.924 0.076 0.000
#> SRR390483 1 0.2448 0.895 0.924 0.076 0.000
#> SRR390484 3 0.0237 1.000 0.000 0.004 0.996
#> SRR390485 3 0.0237 1.000 0.000 0.004 0.996
#> SRR390486 2 0.4808 0.662 0.188 0.804 0.008
#> SRR390487 2 0.4808 0.662 0.188 0.804 0.008
#> SRR390488 1 0.0592 0.950 0.988 0.012 0.000
#> SRR390489 1 0.0592 0.950 0.988 0.012 0.000
#> SRR390492 1 0.5098 0.689 0.752 0.248 0.000
#> SRR390493 1 0.5098 0.689 0.752 0.248 0.000
#> SRR390494 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390495 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390496 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390497 3 0.0237 1.000 0.000 0.004 0.996
#> SRR390498 2 0.3112 0.727 0.096 0.900 0.004
#> SRR390499 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390500 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390501 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390502 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390503 2 0.4654 0.660 0.000 0.792 0.208
#> SRR390504 3 0.0237 1.000 0.000 0.004 0.996
#> SRR390505 2 0.0424 0.764 0.000 0.992 0.008
#> SRR390506 2 0.0424 0.764 0.000 0.992 0.008
#> SRR390507 1 0.5902 0.569 0.680 0.316 0.004
#> SRR390508 1 0.5902 0.569 0.680 0.316 0.004
#> SRR390509 1 0.5902 0.569 0.680 0.316 0.004
#> SRR390510 1 0.5902 0.569 0.680 0.316 0.004
#> SRR390512 1 0.0661 0.952 0.988 0.008 0.004
#> SRR390513 1 0.0661 0.952 0.988 0.008 0.004
#> SRR390514 1 0.0661 0.952 0.988 0.008 0.004
#> SRR390515 2 0.2301 0.758 0.060 0.936 0.004
#> SRR390516 2 0.0424 0.764 0.000 0.992 0.008
#> SRR390517 2 0.3539 0.723 0.100 0.888 0.012
#> SRR390519 3 0.0237 1.000 0.000 0.004 0.996
#> SRR390520 2 0.6168 0.372 0.412 0.588 0.000
#> SRR390521 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390522 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390523 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390524 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390525 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390526 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390527 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390528 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390529 2 0.0424 0.764 0.000 0.992 0.008
#> SRR390530 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390531 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390532 1 0.0424 0.953 0.992 0.008 0.000
#> SRR390533 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390534 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390535 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390536 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390537 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390538 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390539 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390540 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390541 1 0.0000 0.957 1.000 0.000 0.000
#> SRR390542 1 0.0661 0.952 0.988 0.008 0.004
#> SRR390543 1 0.0661 0.952 0.988 0.008 0.004
#> SRR390544 1 0.0661 0.952 0.988 0.008 0.004
#> SRR390545 1 0.0661 0.952 0.988 0.008 0.004
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 4 0.0000 0.844 0.000 0.000 0.000 1.000
#> SRR390471 4 0.0000 0.844 0.000 0.000 0.000 1.000
#> SRR390472 1 0.4019 0.701 0.792 0.012 0.196 0.000
#> SRR390473 1 0.4019 0.701 0.792 0.012 0.196 0.000
#> SRR390474 4 0.2530 0.805 0.000 0.112 0.000 0.888
#> SRR390475 4 0.0000 0.844 0.000 0.000 0.000 1.000
#> SRR390476 4 0.0000 0.844 0.000 0.000 0.000 1.000
#> SRR390477 4 0.0000 0.844 0.000 0.000 0.000 1.000
#> SRR390478 4 0.0000 0.844 0.000 0.000 0.000 1.000
#> SRR390480 4 0.1637 0.839 0.000 0.060 0.000 0.940
#> SRR390481 4 0.1637 0.839 0.000 0.060 0.000 0.940
#> SRR390482 2 0.4994 0.178 0.000 0.520 0.000 0.480
#> SRR390483 2 0.4994 0.178 0.000 0.520 0.000 0.480
#> SRR390484 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> SRR390485 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> SRR390486 1 0.4163 0.648 0.792 0.020 0.000 0.188
#> SRR390487 1 0.4163 0.648 0.792 0.020 0.000 0.188
#> SRR390488 4 0.0469 0.837 0.000 0.012 0.000 0.988
#> SRR390489 4 0.0469 0.837 0.000 0.012 0.000 0.988
#> SRR390492 2 0.4454 0.604 0.000 0.692 0.000 0.308
#> SRR390493 2 0.4454 0.604 0.000 0.692 0.000 0.308
#> SRR390494 4 0.3266 0.734 0.000 0.168 0.000 0.832
#> SRR390495 4 0.1637 0.839 0.000 0.060 0.000 0.940
#> SRR390496 4 0.1637 0.839 0.000 0.060 0.000 0.940
#> SRR390497 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> SRR390498 2 0.4933 -0.356 0.432 0.568 0.000 0.000
#> SRR390499 4 0.1637 0.839 0.000 0.060 0.000 0.940
#> SRR390500 4 0.1637 0.839 0.000 0.060 0.000 0.940
#> SRR390501 4 0.0000 0.844 0.000 0.000 0.000 1.000
#> SRR390502 4 0.0000 0.844 0.000 0.000 0.000 1.000
#> SRR390503 1 0.3933 0.699 0.792 0.008 0.200 0.000
#> SRR390504 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> SRR390505 1 0.0000 0.766 1.000 0.000 0.000 0.000
#> SRR390506 1 0.0000 0.766 1.000 0.000 0.000 0.000
#> SRR390507 2 0.3444 0.675 0.000 0.816 0.000 0.184
#> SRR390508 2 0.3444 0.675 0.000 0.816 0.000 0.184
#> SRR390509 2 0.3444 0.675 0.000 0.816 0.000 0.184
#> SRR390510 2 0.3444 0.675 0.000 0.816 0.000 0.184
#> SRR390512 4 0.4999 -0.133 0.000 0.492 0.000 0.508
#> SRR390513 4 0.4999 -0.133 0.000 0.492 0.000 0.508
#> SRR390514 4 0.4999 -0.133 0.000 0.492 0.000 0.508
#> SRR390515 1 0.1637 0.745 0.940 0.000 0.000 0.060
#> SRR390516 1 0.0000 0.766 1.000 0.000 0.000 0.000
#> SRR390517 2 0.5161 -0.325 0.400 0.592 0.008 0.000
#> SRR390519 3 0.0000 1.000 0.000 0.000 1.000 0.000
#> SRR390520 1 0.5947 0.166 0.572 0.044 0.000 0.384
#> SRR390521 4 0.2216 0.817 0.000 0.092 0.000 0.908
#> SRR390522 4 0.2216 0.817 0.000 0.092 0.000 0.908
#> SRR390523 4 0.2216 0.817 0.000 0.092 0.000 0.908
#> SRR390524 4 0.0000 0.844 0.000 0.000 0.000 1.000
#> SRR390525 4 0.0000 0.844 0.000 0.000 0.000 1.000
#> SRR390526 4 0.0000 0.844 0.000 0.000 0.000 1.000
#> SRR390527 4 0.0000 0.844 0.000 0.000 0.000 1.000
#> SRR390528 4 0.3172 0.743 0.000 0.160 0.000 0.840
#> SRR390529 1 0.0336 0.767 0.992 0.008 0.000 0.000
#> SRR390530 4 0.0000 0.844 0.000 0.000 0.000 1.000
#> SRR390531 4 0.0000 0.844 0.000 0.000 0.000 1.000
#> SRR390532 4 0.3266 0.736 0.000 0.168 0.000 0.832
#> SRR390533 4 0.1557 0.840 0.000 0.056 0.000 0.944
#> SRR390534 4 0.1557 0.840 0.000 0.056 0.000 0.944
#> SRR390535 4 0.1557 0.840 0.000 0.056 0.000 0.944
#> SRR390536 4 0.1637 0.839 0.000 0.060 0.000 0.940
#> SRR390537 4 0.1637 0.839 0.000 0.060 0.000 0.940
#> SRR390538 4 0.0000 0.844 0.000 0.000 0.000 1.000
#> SRR390539 4 0.0000 0.844 0.000 0.000 0.000 1.000
#> SRR390540 4 0.0000 0.844 0.000 0.000 0.000 1.000
#> SRR390541 4 0.0000 0.844 0.000 0.000 0.000 1.000
#> SRR390542 4 0.4999 -0.133 0.000 0.492 0.000 0.508
#> SRR390543 4 0.4999 -0.133 0.000 0.492 0.000 0.508
#> SRR390544 4 0.4999 -0.133 0.000 0.492 0.000 0.508
#> SRR390545 4 0.4999 -0.133 0.000 0.492 0.000 0.508
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.0000 0.870 1.000 0.000 0.000 0.000 0.000
#> SRR390471 1 0.0000 0.870 1.000 0.000 0.000 0.000 0.000
#> SRR390472 3 0.3353 0.717 0.000 0.008 0.796 0.000 0.196
#> SRR390473 3 0.3353 0.717 0.000 0.008 0.796 0.000 0.196
#> SRR390474 1 0.3838 0.662 0.716 0.280 0.004 0.000 0.000
#> SRR390475 1 0.0000 0.870 1.000 0.000 0.000 0.000 0.000
#> SRR390476 1 0.0000 0.870 1.000 0.000 0.000 0.000 0.000
#> SRR390477 1 0.0000 0.870 1.000 0.000 0.000 0.000 0.000
#> SRR390478 1 0.0000 0.870 1.000 0.000 0.000 0.000 0.000
#> SRR390480 1 0.2773 0.815 0.836 0.164 0.000 0.000 0.000
#> SRR390481 1 0.2773 0.815 0.836 0.164 0.000 0.000 0.000
#> SRR390482 2 0.3521 0.722 0.232 0.764 0.004 0.000 0.000
#> SRR390483 2 0.3521 0.722 0.232 0.764 0.004 0.000 0.000
#> SRR390484 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR390485 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR390486 3 0.3694 0.642 0.172 0.032 0.796 0.000 0.000
#> SRR390487 3 0.3694 0.642 0.172 0.032 0.796 0.000 0.000
#> SRR390488 1 0.0794 0.850 0.972 0.028 0.000 0.000 0.000
#> SRR390489 1 0.0794 0.850 0.972 0.028 0.000 0.000 0.000
#> SRR390492 2 0.1282 0.596 0.044 0.952 0.004 0.000 0.000
#> SRR390493 2 0.1282 0.596 0.044 0.952 0.004 0.000 0.000
#> SRR390494 1 0.4060 0.472 0.640 0.360 0.000 0.000 0.000
#> SRR390495 1 0.2773 0.815 0.836 0.164 0.000 0.000 0.000
#> SRR390496 1 0.2773 0.815 0.836 0.164 0.000 0.000 0.000
#> SRR390497 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR390498 4 0.0000 0.739 0.000 0.000 0.000 1.000 0.000
#> SRR390499 1 0.2773 0.815 0.836 0.164 0.000 0.000 0.000
#> SRR390500 1 0.2773 0.815 0.836 0.164 0.000 0.000 0.000
#> SRR390501 1 0.0000 0.870 1.000 0.000 0.000 0.000 0.000
#> SRR390502 1 0.0000 0.870 1.000 0.000 0.000 0.000 0.000
#> SRR390503 3 0.3266 0.715 0.000 0.004 0.796 0.000 0.200
#> SRR390504 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR390505 3 0.0162 0.760 0.000 0.000 0.996 0.004 0.000
#> SRR390506 3 0.0162 0.760 0.000 0.000 0.996 0.004 0.000
#> SRR390507 2 0.1851 0.522 0.000 0.912 0.000 0.088 0.000
#> SRR390508 2 0.1851 0.522 0.000 0.912 0.000 0.088 0.000
#> SRR390509 2 0.1851 0.522 0.000 0.912 0.000 0.088 0.000
#> SRR390510 2 0.1851 0.522 0.000 0.912 0.000 0.088 0.000
#> SRR390512 2 0.3774 0.740 0.296 0.704 0.000 0.000 0.000
#> SRR390513 2 0.3774 0.740 0.296 0.704 0.000 0.000 0.000
#> SRR390514 2 0.3774 0.740 0.296 0.704 0.000 0.000 0.000
#> SRR390515 3 0.1571 0.731 0.060 0.000 0.936 0.004 0.000
#> SRR390516 3 0.0162 0.760 0.000 0.000 0.996 0.004 0.000
#> SRR390517 4 0.3671 0.746 0.000 0.236 0.000 0.756 0.008
#> SRR390519 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR390520 3 0.5939 0.364 0.276 0.148 0.576 0.000 0.000
#> SRR390521 1 0.3305 0.730 0.776 0.224 0.000 0.000 0.000
#> SRR390522 1 0.3305 0.730 0.776 0.224 0.000 0.000 0.000
#> SRR390523 1 0.3305 0.730 0.776 0.224 0.000 0.000 0.000
#> SRR390524 1 0.0000 0.870 1.000 0.000 0.000 0.000 0.000
#> SRR390525 1 0.0000 0.870 1.000 0.000 0.000 0.000 0.000
#> SRR390526 1 0.0000 0.870 1.000 0.000 0.000 0.000 0.000
#> SRR390527 1 0.0000 0.870 1.000 0.000 0.000 0.000 0.000
#> SRR390528 1 0.3983 0.513 0.660 0.340 0.000 0.000 0.000
#> SRR390529 3 0.0162 0.761 0.000 0.004 0.996 0.000 0.000
#> SRR390530 1 0.0000 0.870 1.000 0.000 0.000 0.000 0.000
#> SRR390531 1 0.0000 0.870 1.000 0.000 0.000 0.000 0.000
#> SRR390532 1 0.4015 0.497 0.652 0.348 0.000 0.000 0.000
#> SRR390533 1 0.2280 0.836 0.880 0.120 0.000 0.000 0.000
#> SRR390534 1 0.2280 0.836 0.880 0.120 0.000 0.000 0.000
#> SRR390535 1 0.2280 0.836 0.880 0.120 0.000 0.000 0.000
#> SRR390536 1 0.2773 0.815 0.836 0.164 0.000 0.000 0.000
#> SRR390537 1 0.2773 0.815 0.836 0.164 0.000 0.000 0.000
#> SRR390538 1 0.0000 0.870 1.000 0.000 0.000 0.000 0.000
#> SRR390539 1 0.0000 0.870 1.000 0.000 0.000 0.000 0.000
#> SRR390540 1 0.0000 0.870 1.000 0.000 0.000 0.000 0.000
#> SRR390541 1 0.0000 0.870 1.000 0.000 0.000 0.000 0.000
#> SRR390542 2 0.3774 0.740 0.296 0.704 0.000 0.000 0.000
#> SRR390543 2 0.3774 0.740 0.296 0.704 0.000 0.000 0.000
#> SRR390544 2 0.3774 0.740 0.296 0.704 0.000 0.000 0.000
#> SRR390545 2 0.3774 0.740 0.296 0.704 0.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 4 0.0000 0.845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390471 4 0.0000 0.845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390472 3 0.3758 0.520 0.000 0.004 0.764 0.000 0.192 0.040
#> SRR390473 3 0.3758 0.520 0.000 0.004 0.764 0.000 0.192 0.040
#> SRR390474 4 0.6016 0.363 0.000 0.008 0.200 0.476 0.000 0.316
#> SRR390475 4 0.0000 0.845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390476 4 0.0000 0.845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390477 4 0.0000 0.845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390478 4 0.0000 0.845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390480 4 0.3027 0.800 0.000 0.028 0.000 0.824 0.000 0.148
#> SRR390481 4 0.3027 0.800 0.000 0.028 0.000 0.824 0.000 0.148
#> SRR390482 2 0.6261 0.239 0.000 0.404 0.200 0.016 0.000 0.380
#> SRR390483 2 0.6261 0.239 0.000 0.404 0.200 0.016 0.000 0.380
#> SRR390484 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390485 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390486 3 0.0260 0.493 0.000 0.008 0.992 0.000 0.000 0.000
#> SRR390487 3 0.0260 0.493 0.000 0.008 0.992 0.000 0.000 0.000
#> SRR390488 4 0.2980 0.663 0.000 0.008 0.192 0.800 0.000 0.000
#> SRR390489 4 0.2980 0.663 0.000 0.008 0.192 0.800 0.000 0.000
#> SRR390492 2 0.3984 0.294 0.000 0.596 0.008 0.000 0.000 0.396
#> SRR390493 2 0.3984 0.294 0.000 0.596 0.008 0.000 0.000 0.396
#> SRR390494 4 0.4432 0.543 0.000 0.036 0.000 0.600 0.000 0.364
#> SRR390495 4 0.3027 0.800 0.000 0.028 0.000 0.824 0.000 0.148
#> SRR390496 4 0.3027 0.800 0.000 0.028 0.000 0.824 0.000 0.148
#> SRR390497 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390498 1 0.0000 0.662 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390499 4 0.3027 0.800 0.000 0.028 0.000 0.824 0.000 0.148
#> SRR390500 4 0.3027 0.800 0.000 0.028 0.000 0.824 0.000 0.148
#> SRR390501 4 0.0000 0.845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390502 4 0.0000 0.845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390503 3 0.2730 0.525 0.000 0.000 0.808 0.000 0.192 0.000
#> SRR390504 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390505 6 0.3833 0.905 0.000 0.000 0.444 0.000 0.000 0.556
#> SRR390506 6 0.3833 0.905 0.000 0.000 0.444 0.000 0.000 0.556
#> SRR390507 2 0.0458 0.411 0.000 0.984 0.000 0.000 0.000 0.016
#> SRR390508 2 0.0458 0.411 0.000 0.984 0.000 0.000 0.000 0.016
#> SRR390509 2 0.0458 0.411 0.000 0.984 0.000 0.000 0.000 0.016
#> SRR390510 2 0.0458 0.411 0.000 0.984 0.000 0.000 0.000 0.016
#> SRR390512 2 0.4165 0.631 0.000 0.672 0.000 0.292 0.000 0.036
#> SRR390513 2 0.4165 0.631 0.000 0.672 0.000 0.292 0.000 0.036
#> SRR390514 2 0.4165 0.631 0.000 0.672 0.000 0.292 0.000 0.036
#> SRR390515 6 0.4873 0.745 0.000 0.000 0.420 0.060 0.000 0.520
#> SRR390516 6 0.3866 0.868 0.000 0.000 0.484 0.000 0.000 0.516
#> SRR390517 1 0.4113 0.675 0.668 0.308 0.008 0.000 0.000 0.016
#> SRR390519 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390520 3 0.4979 -0.101 0.000 0.004 0.492 0.056 0.000 0.448
#> SRR390521 4 0.3151 0.731 0.000 0.000 0.000 0.748 0.000 0.252
#> SRR390522 4 0.3151 0.731 0.000 0.000 0.000 0.748 0.000 0.252
#> SRR390523 4 0.3151 0.731 0.000 0.000 0.000 0.748 0.000 0.252
#> SRR390524 4 0.0000 0.845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390525 4 0.0000 0.845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390526 4 0.0000 0.845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390527 4 0.0000 0.845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390528 4 0.5945 0.226 0.000 0.004 0.184 0.416 0.000 0.396
#> SRR390529 6 0.3857 0.886 0.000 0.000 0.468 0.000 0.000 0.532
#> SRR390530 4 0.0000 0.845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390531 4 0.0000 0.845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390532 4 0.5980 0.212 0.000 0.004 0.192 0.408 0.000 0.396
#> SRR390533 4 0.2178 0.818 0.000 0.000 0.000 0.868 0.000 0.132
#> SRR390534 4 0.2178 0.818 0.000 0.000 0.000 0.868 0.000 0.132
#> SRR390535 4 0.2178 0.818 0.000 0.000 0.000 0.868 0.000 0.132
#> SRR390536 4 0.3027 0.800 0.000 0.028 0.000 0.824 0.000 0.148
#> SRR390537 4 0.3027 0.800 0.000 0.028 0.000 0.824 0.000 0.148
#> SRR390538 4 0.0000 0.845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390539 4 0.0000 0.845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390540 4 0.0000 0.845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390541 4 0.0000 0.845 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390542 2 0.4165 0.631 0.000 0.672 0.000 0.292 0.000 0.036
#> SRR390543 2 0.4165 0.631 0.000 0.672 0.000 0.292 0.000 0.036
#> SRR390544 2 0.4165 0.631 0.000 0.672 0.000 0.292 0.000 0.036
#> SRR390545 2 0.4165 0.631 0.000 0.672 0.000 0.292 0.000 0.036
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
ATC:kmeans
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"]
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 15244 rows and 71 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:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.498 0.808 0.905 0.4092 0.577 0.577
#> 3 3 0.554 0.781 0.878 0.4471 0.816 0.691
#> 4 4 0.612 0.559 0.754 0.1848 0.876 0.722
#> 5 5 0.592 0.526 0.617 0.0877 0.823 0.516
#> 6 6 0.644 0.536 0.665 0.0550 0.860 0.504
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
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.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.242 0.922 0.960 0.040
#> SRR390471 1 0.242 0.922 0.960 0.040
#> SRR390472 2 0.343 0.850 0.064 0.936
#> SRR390473 2 0.343 0.850 0.064 0.936
#> SRR390474 1 0.714 0.701 0.804 0.196
#> SRR390475 1 0.242 0.922 0.960 0.040
#> SRR390476 1 0.242 0.922 0.960 0.040
#> SRR390477 1 0.242 0.922 0.960 0.040
#> SRR390478 1 0.242 0.922 0.960 0.040
#> SRR390480 1 0.000 0.914 1.000 0.000
#> SRR390481 1 0.000 0.914 1.000 0.000
#> SRR390482 1 0.714 0.701 0.804 0.196
#> SRR390483 1 0.689 0.701 0.816 0.184
#> SRR390484 2 0.343 0.850 0.064 0.936
#> SRR390485 2 0.343 0.850 0.064 0.936
#> SRR390486 2 0.343 0.850 0.064 0.936
#> SRR390487 2 0.343 0.850 0.064 0.936
#> SRR390488 1 0.242 0.922 0.960 0.040
#> SRR390489 1 0.242 0.922 0.960 0.040
#> SRR390492 1 1.000 -0.168 0.504 0.496
#> SRR390493 2 0.998 0.197 0.476 0.524
#> SRR390494 1 0.000 0.914 1.000 0.000
#> SRR390495 1 0.311 0.885 0.944 0.056
#> SRR390496 1 0.311 0.885 0.944 0.056
#> SRR390497 2 0.343 0.850 0.064 0.936
#> SRR390498 2 0.118 0.818 0.016 0.984
#> SRR390499 1 0.000 0.914 1.000 0.000
#> SRR390500 1 0.000 0.914 1.000 0.000
#> SRR390501 1 0.242 0.922 0.960 0.040
#> SRR390502 1 0.242 0.922 0.960 0.040
#> SRR390503 2 0.343 0.850 0.064 0.936
#> SRR390504 2 0.343 0.850 0.064 0.936
#> SRR390505 1 0.738 0.709 0.792 0.208
#> SRR390506 2 0.343 0.850 0.064 0.936
#> SRR390507 2 1.000 0.122 0.496 0.504
#> SRR390508 2 1.000 0.122 0.496 0.504
#> SRR390509 2 1.000 0.122 0.496 0.504
#> SRR390510 2 1.000 0.122 0.496 0.504
#> SRR390512 1 0.343 0.880 0.936 0.064
#> SRR390513 1 0.343 0.880 0.936 0.064
#> SRR390514 1 0.343 0.880 0.936 0.064
#> SRR390515 1 0.738 0.709 0.792 0.208
#> SRR390516 2 0.343 0.850 0.064 0.936
#> SRR390517 2 0.224 0.783 0.036 0.964
#> SRR390519 2 0.343 0.850 0.064 0.936
#> SRR390520 2 0.343 0.850 0.064 0.936
#> SRR390521 1 0.000 0.914 1.000 0.000
#> SRR390522 1 0.000 0.914 1.000 0.000
#> SRR390523 1 0.000 0.914 1.000 0.000
#> SRR390524 1 0.242 0.922 0.960 0.040
#> SRR390525 1 0.242 0.922 0.960 0.040
#> SRR390526 1 0.242 0.922 0.960 0.040
#> SRR390527 1 0.242 0.922 0.960 0.040
#> SRR390528 1 0.242 0.922 0.960 0.040
#> SRR390529 2 0.343 0.850 0.064 0.936
#> SRR390530 1 0.242 0.922 0.960 0.040
#> SRR390531 1 0.242 0.922 0.960 0.040
#> SRR390532 1 0.722 0.700 0.800 0.200
#> SRR390533 1 0.242 0.922 0.960 0.040
#> SRR390534 1 0.242 0.922 0.960 0.040
#> SRR390535 1 0.242 0.922 0.960 0.040
#> SRR390536 1 0.311 0.885 0.944 0.056
#> SRR390537 1 0.311 0.885 0.944 0.056
#> SRR390538 1 0.242 0.922 0.960 0.040
#> SRR390539 1 0.242 0.922 0.960 0.040
#> SRR390540 1 0.242 0.922 0.960 0.040
#> SRR390541 1 0.242 0.922 0.960 0.040
#> SRR390542 1 0.343 0.880 0.936 0.064
#> SRR390543 1 0.343 0.880 0.936 0.064
#> SRR390544 1 0.343 0.880 0.936 0.064
#> SRR390545 1 0.343 0.880 0.936 0.064
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390471 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390472 3 0.1964 0.898 0.000 0.056 0.944
#> SRR390473 3 0.1964 0.898 0.000 0.056 0.944
#> SRR390474 1 0.7784 0.365 0.556 0.388 0.056
#> SRR390475 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390476 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390477 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390478 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390480 1 0.3340 0.799 0.880 0.120 0.000
#> SRR390481 1 0.3340 0.799 0.880 0.120 0.000
#> SRR390482 1 0.7860 0.296 0.528 0.416 0.056
#> SRR390483 1 0.7860 0.296 0.528 0.416 0.056
#> SRR390484 3 0.1529 0.887 0.000 0.040 0.960
#> SRR390485 3 0.1529 0.887 0.000 0.040 0.960
#> SRR390486 3 0.4277 0.873 0.016 0.132 0.852
#> SRR390487 3 0.4277 0.873 0.016 0.132 0.852
#> SRR390488 1 0.4121 0.769 0.876 0.084 0.040
#> SRR390489 1 0.4121 0.769 0.876 0.084 0.040
#> SRR390492 2 0.5304 0.761 0.068 0.824 0.108
#> SRR390493 2 0.5047 0.729 0.036 0.824 0.140
#> SRR390494 1 0.6062 0.463 0.616 0.384 0.000
#> SRR390495 1 0.6095 0.383 0.608 0.392 0.000
#> SRR390496 1 0.5431 0.600 0.716 0.284 0.000
#> SRR390497 3 0.1529 0.887 0.000 0.040 0.960
#> SRR390498 3 0.3816 0.878 0.000 0.148 0.852
#> SRR390499 1 0.3340 0.799 0.880 0.120 0.000
#> SRR390500 1 0.3340 0.799 0.880 0.120 0.000
#> SRR390501 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390502 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390503 3 0.0424 0.894 0.000 0.008 0.992
#> SRR390504 3 0.1411 0.887 0.000 0.036 0.964
#> SRR390505 1 0.4035 0.773 0.880 0.080 0.040
#> SRR390506 3 0.0592 0.893 0.000 0.012 0.988
#> SRR390507 2 0.2926 0.819 0.036 0.924 0.040
#> SRR390508 2 0.2926 0.819 0.036 0.924 0.040
#> SRR390509 2 0.2926 0.819 0.036 0.924 0.040
#> SRR390510 2 0.2926 0.819 0.036 0.924 0.040
#> SRR390512 2 0.4291 0.859 0.180 0.820 0.000
#> SRR390513 2 0.4291 0.859 0.180 0.820 0.000
#> SRR390514 2 0.4291 0.859 0.180 0.820 0.000
#> SRR390515 1 0.4676 0.742 0.848 0.112 0.040
#> SRR390516 3 0.4411 0.872 0.016 0.140 0.844
#> SRR390517 3 0.4346 0.852 0.000 0.184 0.816
#> SRR390519 3 0.1529 0.887 0.000 0.040 0.960
#> SRR390520 3 0.4411 0.872 0.016 0.140 0.844
#> SRR390521 1 0.3340 0.799 0.880 0.120 0.000
#> SRR390522 1 0.3340 0.799 0.880 0.120 0.000
#> SRR390523 1 0.3340 0.799 0.880 0.120 0.000
#> SRR390524 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390525 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390526 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390527 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390528 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390529 3 0.8543 0.537 0.268 0.140 0.592
#> SRR390530 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390531 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390532 1 0.8093 0.282 0.516 0.416 0.068
#> SRR390533 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390534 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390535 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390536 1 0.6111 0.372 0.604 0.396 0.000
#> SRR390537 1 0.6095 0.383 0.608 0.392 0.000
#> SRR390538 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390539 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390540 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390541 1 0.0000 0.855 1.000 0.000 0.000
#> SRR390542 2 0.4235 0.863 0.176 0.824 0.000
#> SRR390543 2 0.4235 0.863 0.176 0.824 0.000
#> SRR390544 2 0.4235 0.863 0.176 0.824 0.000
#> SRR390545 2 0.4235 0.863 0.176 0.824 0.000
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.0000 0.6966 1.000 0.000 0.000 0.000
#> SRR390471 1 0.0336 0.6953 0.992 0.000 0.000 0.008
#> SRR390472 3 0.4522 0.6237 0.000 0.000 0.680 0.320
#> SRR390473 3 0.4522 0.6237 0.000 0.000 0.680 0.320
#> SRR390474 4 0.3351 0.6059 0.068 0.036 0.012 0.884
#> SRR390475 1 0.0188 0.6971 0.996 0.000 0.000 0.004
#> SRR390476 1 0.0188 0.6971 0.996 0.000 0.000 0.004
#> SRR390477 1 0.1661 0.6840 0.944 0.004 0.000 0.052
#> SRR390478 1 0.1661 0.6840 0.944 0.004 0.000 0.052
#> SRR390480 1 0.7399 0.4523 0.512 0.208 0.000 0.280
#> SRR390481 1 0.7425 0.4489 0.508 0.212 0.000 0.280
#> SRR390482 4 0.3351 0.6059 0.068 0.036 0.012 0.884
#> SRR390483 4 0.3351 0.6059 0.068 0.036 0.012 0.884
#> SRR390484 3 0.0000 0.7464 0.000 0.000 1.000 0.000
#> SRR390485 3 0.0000 0.7464 0.000 0.000 1.000 0.000
#> SRR390486 4 0.5003 0.2211 0.016 0.000 0.308 0.676
#> SRR390487 4 0.4980 0.2312 0.016 0.000 0.304 0.680
#> SRR390488 1 0.4981 -0.0225 0.536 0.000 0.000 0.464
#> SRR390489 1 0.4981 -0.0225 0.536 0.000 0.000 0.464
#> SRR390492 4 0.3508 0.5389 0.004 0.136 0.012 0.848
#> SRR390493 4 0.3573 0.5373 0.004 0.132 0.016 0.848
#> SRR390494 4 0.7580 -0.1041 0.296 0.228 0.000 0.476
#> SRR390495 1 0.7706 0.3894 0.452 0.268 0.000 0.280
#> SRR390496 1 0.7690 0.3943 0.456 0.264 0.000 0.280
#> SRR390497 3 0.0000 0.7464 0.000 0.000 1.000 0.000
#> SRR390498 3 0.6273 0.3322 0.000 0.056 0.488 0.456
#> SRR390499 1 0.7425 0.4489 0.508 0.212 0.000 0.280
#> SRR390500 1 0.7425 0.4489 0.508 0.212 0.000 0.280
#> SRR390501 1 0.1022 0.6940 0.968 0.000 0.000 0.032
#> SRR390502 1 0.1022 0.6940 0.968 0.000 0.000 0.032
#> SRR390503 3 0.3873 0.6957 0.000 0.000 0.772 0.228
#> SRR390504 3 0.0000 0.7464 0.000 0.000 1.000 0.000
#> SRR390505 1 0.5112 0.1446 0.608 0.008 0.000 0.384
#> SRR390506 3 0.4122 0.6912 0.000 0.004 0.760 0.236
#> SRR390507 2 0.4767 0.6758 0.000 0.724 0.020 0.256
#> SRR390508 2 0.4767 0.6758 0.000 0.724 0.020 0.256
#> SRR390509 2 0.4767 0.6758 0.000 0.724 0.020 0.256
#> SRR390510 2 0.4767 0.6758 0.000 0.724 0.020 0.256
#> SRR390512 2 0.1118 0.8414 0.036 0.964 0.000 0.000
#> SRR390513 2 0.1118 0.8414 0.036 0.964 0.000 0.000
#> SRR390514 2 0.1118 0.8414 0.036 0.964 0.000 0.000
#> SRR390515 1 0.5172 0.0933 0.588 0.008 0.000 0.404
#> SRR390516 4 0.6282 0.0102 0.052 0.004 0.392 0.552
#> SRR390517 3 0.6889 0.3620 0.000 0.108 0.496 0.396
#> SRR390519 3 0.0000 0.7464 0.000 0.000 1.000 0.000
#> SRR390520 4 0.5324 0.1651 0.016 0.004 0.336 0.644
#> SRR390521 1 0.7425 0.4489 0.508 0.212 0.000 0.280
#> SRR390522 1 0.7425 0.4489 0.508 0.212 0.000 0.280
#> SRR390523 1 0.6992 0.4837 0.564 0.156 0.000 0.280
#> SRR390524 1 0.1661 0.6840 0.944 0.004 0.000 0.052
#> SRR390525 1 0.1661 0.6840 0.944 0.004 0.000 0.052
#> SRR390526 1 0.1661 0.6840 0.944 0.004 0.000 0.052
#> SRR390527 1 0.1661 0.6840 0.944 0.004 0.000 0.052
#> SRR390528 1 0.4897 0.5613 0.660 0.008 0.000 0.332
#> SRR390529 4 0.5929 0.1883 0.448 0.004 0.028 0.520
#> SRR390530 1 0.1661 0.6840 0.944 0.004 0.000 0.052
#> SRR390531 1 0.1661 0.6840 0.944 0.004 0.000 0.052
#> SRR390532 4 0.2945 0.6017 0.052 0.032 0.012 0.904
#> SRR390533 1 0.3528 0.6370 0.808 0.000 0.000 0.192
#> SRR390534 1 0.3528 0.6370 0.808 0.000 0.000 0.192
#> SRR390535 1 0.3219 0.6493 0.836 0.000 0.000 0.164
#> SRR390536 1 0.7706 0.3894 0.452 0.268 0.000 0.280
#> SRR390537 1 0.7706 0.3894 0.452 0.268 0.000 0.280
#> SRR390538 1 0.0000 0.6966 1.000 0.000 0.000 0.000
#> SRR390539 1 0.0000 0.6966 1.000 0.000 0.000 0.000
#> SRR390540 1 0.0188 0.6971 0.996 0.000 0.000 0.004
#> SRR390541 1 0.0000 0.6966 1.000 0.000 0.000 0.000
#> SRR390542 2 0.1118 0.8414 0.036 0.964 0.000 0.000
#> SRR390543 2 0.1118 0.8414 0.036 0.964 0.000 0.000
#> SRR390544 2 0.1118 0.8414 0.036 0.964 0.000 0.000
#> SRR390545 2 0.1118 0.8414 0.036 0.964 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.5306 0.6267 0.612 0.000 0.000 0.316 0.072
#> SRR390471 1 0.5179 0.6415 0.640 0.000 0.000 0.288 0.072
#> SRR390472 3 0.0162 0.4796 0.000 0.004 0.996 0.000 0.000
#> SRR390473 3 0.0162 0.4796 0.000 0.004 0.996 0.000 0.000
#> SRR390474 5 0.9586 0.8996 0.128 0.124 0.180 0.256 0.312
#> SRR390475 1 0.5396 0.6078 0.588 0.000 0.000 0.340 0.072
#> SRR390476 1 0.5396 0.6078 0.588 0.000 0.000 0.340 0.072
#> SRR390477 1 0.3109 0.6628 0.800 0.000 0.000 0.200 0.000
#> SRR390478 1 0.3109 0.6628 0.800 0.000 0.000 0.200 0.000
#> SRR390480 4 0.2077 0.7361 0.084 0.008 0.000 0.908 0.000
#> SRR390481 4 0.2077 0.7361 0.084 0.008 0.000 0.908 0.000
#> SRR390482 5 0.9632 0.9137 0.132 0.132 0.172 0.264 0.300
#> SRR390483 5 0.9614 0.9131 0.128 0.132 0.172 0.268 0.300
#> SRR390484 3 0.4451 0.4872 0.000 0.004 0.504 0.000 0.492
#> SRR390485 3 0.4451 0.4872 0.000 0.004 0.504 0.000 0.492
#> SRR390486 3 0.6930 -0.1293 0.092 0.032 0.540 0.024 0.312
#> SRR390487 3 0.7005 -0.1388 0.092 0.032 0.536 0.028 0.312
#> SRR390488 1 0.7874 -0.1616 0.364 0.004 0.332 0.060 0.240
#> SRR390489 1 0.7874 -0.1616 0.364 0.004 0.332 0.060 0.240
#> SRR390492 5 0.9655 0.8426 0.112 0.212 0.148 0.224 0.304
#> SRR390493 5 0.9655 0.8426 0.112 0.212 0.148 0.224 0.304
#> SRR390494 4 0.5407 0.1646 0.092 0.012 0.012 0.712 0.172
#> SRR390495 4 0.1872 0.6730 0.000 0.052 0.000 0.928 0.020
#> SRR390496 4 0.1872 0.6730 0.000 0.052 0.000 0.928 0.020
#> SRR390497 3 0.4451 0.4872 0.000 0.004 0.504 0.000 0.492
#> SRR390498 3 0.7836 0.1509 0.096 0.220 0.444 0.000 0.240
#> SRR390499 4 0.2077 0.7361 0.084 0.008 0.000 0.908 0.000
#> SRR390500 4 0.2237 0.7356 0.084 0.008 0.000 0.904 0.004
#> SRR390501 1 0.5774 0.5432 0.544 0.004 0.000 0.368 0.084
#> SRR390502 1 0.5783 0.5359 0.540 0.004 0.000 0.372 0.084
#> SRR390503 3 0.1740 0.5004 0.012 0.000 0.932 0.000 0.056
#> SRR390504 3 0.4451 0.4872 0.000 0.004 0.504 0.000 0.492
#> SRR390505 1 0.5233 0.0955 0.636 0.000 0.288 0.000 0.076
#> SRR390506 3 0.3239 0.4935 0.068 0.000 0.852 0.000 0.080
#> SRR390507 2 0.2886 0.6479 0.016 0.864 0.000 0.004 0.116
#> SRR390508 2 0.2886 0.6479 0.016 0.864 0.000 0.004 0.116
#> SRR390509 2 0.2886 0.6479 0.016 0.864 0.000 0.004 0.116
#> SRR390510 2 0.2886 0.6479 0.016 0.864 0.000 0.004 0.116
#> SRR390512 2 0.3480 0.8192 0.000 0.752 0.000 0.248 0.000
#> SRR390513 2 0.3480 0.8192 0.000 0.752 0.000 0.248 0.000
#> SRR390514 2 0.3480 0.8192 0.000 0.752 0.000 0.248 0.000
#> SRR390515 1 0.5615 -0.0225 0.584 0.000 0.320 0.000 0.096
#> SRR390516 3 0.6437 0.1084 0.132 0.004 0.564 0.016 0.284
#> SRR390517 3 0.7748 0.0698 0.068 0.352 0.368 0.000 0.212
#> SRR390519 3 0.4451 0.4872 0.000 0.004 0.504 0.000 0.492
#> SRR390520 3 0.6117 0.0425 0.084 0.008 0.572 0.012 0.324
#> SRR390521 4 0.2511 0.7274 0.088 0.004 0.000 0.892 0.016
#> SRR390522 4 0.2511 0.7274 0.088 0.004 0.000 0.892 0.016
#> SRR390523 4 0.3169 0.6734 0.140 0.004 0.000 0.840 0.016
#> SRR390524 1 0.3109 0.6628 0.800 0.000 0.000 0.200 0.000
#> SRR390525 1 0.3109 0.6628 0.800 0.000 0.000 0.200 0.000
#> SRR390526 1 0.3109 0.6628 0.800 0.000 0.000 0.200 0.000
#> SRR390527 1 0.3109 0.6628 0.800 0.000 0.000 0.200 0.000
#> SRR390528 4 0.4817 0.2788 0.404 0.000 0.000 0.572 0.024
#> SRR390529 3 0.6640 0.0545 0.368 0.000 0.436 0.004 0.192
#> SRR390530 1 0.3109 0.6628 0.800 0.000 0.000 0.200 0.000
#> SRR390531 1 0.3109 0.6628 0.800 0.000 0.000 0.200 0.000
#> SRR390532 5 0.9634 0.9093 0.132 0.128 0.180 0.260 0.300
#> SRR390533 4 0.5834 0.0467 0.364 0.000 0.000 0.532 0.104
#> SRR390534 4 0.5834 0.0467 0.364 0.000 0.000 0.532 0.104
#> SRR390535 4 0.5237 -0.2960 0.468 0.000 0.000 0.488 0.044
#> SRR390536 4 0.1872 0.6730 0.000 0.052 0.000 0.928 0.020
#> SRR390537 4 0.1872 0.6730 0.000 0.052 0.000 0.928 0.020
#> SRR390538 1 0.5182 0.6383 0.632 0.000 0.000 0.300 0.068
#> SRR390539 1 0.5284 0.6256 0.608 0.000 0.000 0.324 0.068
#> SRR390540 1 0.5396 0.6078 0.588 0.000 0.000 0.340 0.072
#> SRR390541 1 0.5284 0.6256 0.608 0.000 0.000 0.324 0.068
#> SRR390542 2 0.3366 0.8261 0.000 0.768 0.000 0.232 0.000
#> SRR390543 2 0.3366 0.8261 0.000 0.768 0.000 0.232 0.000
#> SRR390544 2 0.3366 0.8261 0.000 0.768 0.000 0.232 0.000
#> SRR390545 2 0.3366 0.8261 0.000 0.768 0.000 0.232 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.0146 0.6925 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR390471 1 0.0458 0.6932 0.984 0.000 0.000 0.000 0.000 0.016
#> SRR390472 3 0.5566 0.2098 0.000 0.000 0.556 0.012 0.312 0.120
#> SRR390473 3 0.5566 0.2098 0.000 0.000 0.556 0.012 0.312 0.120
#> SRR390474 3 0.6416 0.4056 0.016 0.080 0.556 0.268 0.000 0.080
#> SRR390475 1 0.0146 0.6956 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR390476 1 0.0146 0.6956 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR390477 1 0.3795 0.5455 0.632 0.000 0.000 0.004 0.000 0.364
#> SRR390478 1 0.3795 0.5455 0.632 0.000 0.000 0.004 0.000 0.364
#> SRR390480 4 0.3753 0.7936 0.292 0.000 0.008 0.696 0.000 0.004
#> SRR390481 4 0.3753 0.7936 0.292 0.000 0.008 0.696 0.000 0.004
#> SRR390482 3 0.6544 0.4119 0.004 0.128 0.516 0.280 0.000 0.072
#> SRR390483 3 0.6544 0.4119 0.004 0.128 0.516 0.280 0.000 0.072
#> SRR390484 5 0.0000 1.0000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390485 5 0.0000 1.0000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390486 3 0.1749 0.3623 0.000 0.004 0.932 0.016 0.044 0.004
#> SRR390487 3 0.1749 0.3623 0.000 0.004 0.932 0.016 0.044 0.004
#> SRR390488 3 0.5705 -0.0894 0.256 0.000 0.596 0.036 0.000 0.112
#> SRR390489 3 0.5705 -0.0894 0.256 0.000 0.596 0.036 0.000 0.112
#> SRR390492 3 0.6933 0.3578 0.000 0.280 0.428 0.220 0.000 0.072
#> SRR390493 3 0.6933 0.3578 0.000 0.280 0.428 0.220 0.000 0.072
#> SRR390494 4 0.5669 0.5794 0.104 0.008 0.148 0.668 0.000 0.072
#> SRR390495 4 0.3746 0.7295 0.128 0.008 0.004 0.800 0.000 0.060
#> SRR390496 4 0.3746 0.7295 0.128 0.008 0.004 0.800 0.000 0.060
#> SRR390497 5 0.0000 1.0000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390498 2 0.8194 -0.2124 0.000 0.376 0.248 0.068 0.128 0.180
#> SRR390499 4 0.3753 0.7936 0.292 0.000 0.008 0.696 0.000 0.004
#> SRR390500 4 0.3753 0.7936 0.292 0.000 0.008 0.696 0.000 0.004
#> SRR390501 1 0.2704 0.6359 0.884 0.000 0.048 0.036 0.000 0.032
#> SRR390502 1 0.2704 0.6359 0.884 0.000 0.048 0.036 0.000 0.032
#> SRR390503 3 0.5570 0.1984 0.000 0.000 0.536 0.016 0.348 0.100
#> SRR390504 5 0.0000 1.0000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390505 6 0.6129 0.9329 0.180 0.004 0.288 0.016 0.000 0.512
#> SRR390506 3 0.6662 0.0392 0.000 0.004 0.424 0.028 0.284 0.260
#> SRR390507 2 0.0692 0.5864 0.000 0.976 0.020 0.000 0.004 0.000
#> SRR390508 2 0.0692 0.5864 0.000 0.976 0.020 0.000 0.004 0.000
#> SRR390509 2 0.0692 0.5864 0.000 0.976 0.020 0.000 0.004 0.000
#> SRR390510 2 0.0692 0.5864 0.000 0.976 0.020 0.000 0.004 0.000
#> SRR390512 2 0.5904 0.6977 0.000 0.552 0.020 0.256 0.000 0.172
#> SRR390513 2 0.5904 0.6977 0.000 0.552 0.020 0.256 0.000 0.172
#> SRR390514 2 0.5904 0.6977 0.000 0.552 0.020 0.256 0.000 0.172
#> SRR390515 6 0.5956 0.9312 0.144 0.004 0.308 0.016 0.000 0.528
#> SRR390516 3 0.5098 0.1226 0.012 0.004 0.672 0.024 0.044 0.244
#> SRR390517 2 0.7467 -0.0138 0.000 0.504 0.196 0.056 0.136 0.108
#> SRR390519 5 0.0000 1.0000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390520 3 0.4697 0.2158 0.004 0.004 0.708 0.028 0.036 0.220
#> SRR390521 4 0.4454 0.7727 0.308 0.000 0.020 0.652 0.000 0.020
#> SRR390522 4 0.4454 0.7727 0.308 0.000 0.020 0.652 0.000 0.020
#> SRR390523 4 0.4561 0.7355 0.336 0.000 0.020 0.624 0.000 0.020
#> SRR390524 1 0.3795 0.5455 0.632 0.000 0.000 0.004 0.000 0.364
#> SRR390525 1 0.3795 0.5455 0.632 0.000 0.000 0.004 0.000 0.364
#> SRR390526 1 0.3807 0.5434 0.628 0.000 0.000 0.004 0.000 0.368
#> SRR390527 1 0.3807 0.5434 0.628 0.000 0.000 0.004 0.000 0.368
#> SRR390528 4 0.6173 0.2955 0.220 0.000 0.012 0.460 0.000 0.308
#> SRR390529 3 0.5649 -0.2519 0.100 0.004 0.572 0.020 0.000 0.304
#> SRR390530 1 0.3795 0.5455 0.632 0.000 0.000 0.004 0.000 0.364
#> SRR390531 1 0.3795 0.5455 0.632 0.000 0.000 0.004 0.000 0.364
#> SRR390532 3 0.6512 0.4127 0.004 0.124 0.520 0.280 0.000 0.072
#> SRR390533 1 0.5406 -0.0574 0.588 0.000 0.032 0.312 0.000 0.068
#> SRR390534 1 0.5406 -0.0574 0.588 0.000 0.032 0.312 0.000 0.068
#> SRR390535 1 0.4476 0.1869 0.668 0.000 0.008 0.280 0.000 0.044
#> SRR390536 4 0.3746 0.7295 0.128 0.008 0.004 0.800 0.000 0.060
#> SRR390537 4 0.3746 0.7295 0.128 0.008 0.004 0.800 0.000 0.060
#> SRR390538 1 0.0777 0.6940 0.972 0.000 0.004 0.000 0.000 0.024
#> SRR390539 1 0.0748 0.6966 0.976 0.000 0.004 0.004 0.000 0.016
#> SRR390540 1 0.0551 0.6966 0.984 0.000 0.004 0.004 0.000 0.008
#> SRR390541 1 0.0748 0.6966 0.976 0.000 0.004 0.004 0.000 0.016
#> SRR390542 2 0.5818 0.7003 0.000 0.560 0.016 0.248 0.000 0.176
#> SRR390543 2 0.5818 0.7003 0.000 0.560 0.016 0.248 0.000 0.176
#> SRR390544 2 0.5818 0.7003 0.000 0.560 0.016 0.248 0.000 0.176
#> SRR390545 2 0.5818 0.7003 0.000 0.560 0.016 0.248 0.000 0.176
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.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
ATC:skmeans**
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"]
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 15244 rows and 71 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:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or k-1.
The detailed explanations of these statistics can be found in the cola
vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)

The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.998 0.999 0.4951 0.505 0.505
#> 3 3 0.951 0.947 0.973 0.3379 0.773 0.575
#> 4 4 0.715 0.785 0.874 0.1183 0.799 0.501
#> 5 5 0.738 0.750 0.813 0.0618 0.915 0.705
#> 6 6 0.749 0.644 0.780 0.0476 0.928 0.699
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
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.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.000 1.000 1.000 0.000
#> SRR390471 1 0.000 1.000 1.000 0.000
#> SRR390472 2 0.000 0.998 0.000 1.000
#> SRR390473 2 0.000 0.998 0.000 1.000
#> SRR390474 2 0.000 0.998 0.000 1.000
#> SRR390475 1 0.000 1.000 1.000 0.000
#> SRR390476 1 0.000 1.000 1.000 0.000
#> SRR390477 1 0.000 1.000 1.000 0.000
#> SRR390478 1 0.000 1.000 1.000 0.000
#> SRR390480 1 0.000 1.000 1.000 0.000
#> SRR390481 1 0.000 1.000 1.000 0.000
#> SRR390482 2 0.000 0.998 0.000 1.000
#> SRR390483 2 0.000 0.998 0.000 1.000
#> SRR390484 2 0.000 0.998 0.000 1.000
#> SRR390485 2 0.000 0.998 0.000 1.000
#> SRR390486 2 0.000 0.998 0.000 1.000
#> SRR390487 2 0.000 0.998 0.000 1.000
#> SRR390488 2 0.163 0.977 0.024 0.976
#> SRR390489 2 0.163 0.977 0.024 0.976
#> SRR390492 2 0.000 0.998 0.000 1.000
#> SRR390493 2 0.000 0.998 0.000 1.000
#> SRR390494 1 0.000 1.000 1.000 0.000
#> SRR390495 1 0.000 1.000 1.000 0.000
#> SRR390496 1 0.000 1.000 1.000 0.000
#> SRR390497 2 0.000 0.998 0.000 1.000
#> SRR390498 2 0.000 0.998 0.000 1.000
#> SRR390499 1 0.000 1.000 1.000 0.000
#> SRR390500 1 0.000 1.000 1.000 0.000
#> SRR390501 1 0.000 1.000 1.000 0.000
#> SRR390502 1 0.000 1.000 1.000 0.000
#> SRR390503 2 0.000 0.998 0.000 1.000
#> SRR390504 2 0.000 0.998 0.000 1.000
#> SRR390505 2 0.163 0.977 0.024 0.976
#> SRR390506 2 0.000 0.998 0.000 1.000
#> SRR390507 2 0.000 0.998 0.000 1.000
#> SRR390508 2 0.000 0.998 0.000 1.000
#> SRR390509 2 0.000 0.998 0.000 1.000
#> SRR390510 2 0.000 0.998 0.000 1.000
#> SRR390512 1 0.000 1.000 1.000 0.000
#> SRR390513 1 0.000 1.000 1.000 0.000
#> SRR390514 1 0.000 1.000 1.000 0.000
#> SRR390515 2 0.000 0.998 0.000 1.000
#> SRR390516 2 0.000 0.998 0.000 1.000
#> SRR390517 2 0.000 0.998 0.000 1.000
#> SRR390519 2 0.000 0.998 0.000 1.000
#> SRR390520 2 0.000 0.998 0.000 1.000
#> SRR390521 1 0.000 1.000 1.000 0.000
#> SRR390522 1 0.000 1.000 1.000 0.000
#> SRR390523 1 0.000 1.000 1.000 0.000
#> SRR390524 1 0.000 1.000 1.000 0.000
#> SRR390525 1 0.000 1.000 1.000 0.000
#> SRR390526 1 0.000 1.000 1.000 0.000
#> SRR390527 1 0.000 1.000 1.000 0.000
#> SRR390528 1 0.000 1.000 1.000 0.000
#> SRR390529 2 0.000 0.998 0.000 1.000
#> SRR390530 1 0.000 1.000 1.000 0.000
#> SRR390531 1 0.000 1.000 1.000 0.000
#> SRR390532 2 0.000 0.998 0.000 1.000
#> SRR390533 1 0.000 1.000 1.000 0.000
#> SRR390534 1 0.000 1.000 1.000 0.000
#> SRR390535 1 0.000 1.000 1.000 0.000
#> SRR390536 1 0.000 1.000 1.000 0.000
#> SRR390537 1 0.000 1.000 1.000 0.000
#> SRR390538 1 0.000 1.000 1.000 0.000
#> SRR390539 1 0.000 1.000 1.000 0.000
#> SRR390540 1 0.000 1.000 1.000 0.000
#> SRR390541 1 0.000 1.000 1.000 0.000
#> SRR390542 1 0.000 1.000 1.000 0.000
#> SRR390543 1 0.000 1.000 1.000 0.000
#> SRR390544 1 0.000 1.000 1.000 0.000
#> SRR390545 1 0.000 1.000 1.000 0.000
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390471 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390472 3 0.0000 0.968 0.000 0.000 1.000
#> SRR390473 3 0.0000 0.968 0.000 0.000 1.000
#> SRR390474 3 0.0000 0.968 0.000 0.000 1.000
#> SRR390475 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390476 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390477 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390478 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390480 1 0.2356 0.937 0.928 0.072 0.000
#> SRR390481 1 0.2356 0.937 0.928 0.072 0.000
#> SRR390482 3 0.1031 0.954 0.000 0.024 0.976
#> SRR390483 3 0.1031 0.954 0.000 0.024 0.976
#> SRR390484 3 0.0000 0.968 0.000 0.000 1.000
#> SRR390485 3 0.0000 0.968 0.000 0.000 1.000
#> SRR390486 3 0.0000 0.968 0.000 0.000 1.000
#> SRR390487 3 0.0000 0.968 0.000 0.000 1.000
#> SRR390488 3 0.4062 0.821 0.164 0.000 0.836
#> SRR390489 3 0.4062 0.821 0.164 0.000 0.836
#> SRR390492 2 0.4654 0.746 0.000 0.792 0.208
#> SRR390493 2 0.5948 0.472 0.000 0.640 0.360
#> SRR390494 2 0.0237 0.953 0.004 0.996 0.000
#> SRR390495 2 0.1163 0.942 0.028 0.972 0.000
#> SRR390496 2 0.1753 0.925 0.048 0.952 0.000
#> SRR390497 3 0.0000 0.968 0.000 0.000 1.000
#> SRR390498 3 0.0000 0.968 0.000 0.000 1.000
#> SRR390499 1 0.2356 0.937 0.928 0.072 0.000
#> SRR390500 1 0.2356 0.937 0.928 0.072 0.000
#> SRR390501 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390502 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390503 3 0.0000 0.968 0.000 0.000 1.000
#> SRR390504 3 0.0000 0.968 0.000 0.000 1.000
#> SRR390505 3 0.4178 0.810 0.172 0.000 0.828
#> SRR390506 3 0.0000 0.968 0.000 0.000 1.000
#> SRR390507 2 0.0592 0.951 0.000 0.988 0.012
#> SRR390508 2 0.0592 0.951 0.000 0.988 0.012
#> SRR390509 2 0.0592 0.951 0.000 0.988 0.012
#> SRR390510 2 0.0592 0.951 0.000 0.988 0.012
#> SRR390512 2 0.0000 0.954 0.000 1.000 0.000
#> SRR390513 2 0.0000 0.954 0.000 1.000 0.000
#> SRR390514 2 0.0000 0.954 0.000 1.000 0.000
#> SRR390515 3 0.2356 0.911 0.072 0.000 0.928
#> SRR390516 3 0.0000 0.968 0.000 0.000 1.000
#> SRR390517 3 0.0747 0.959 0.000 0.016 0.984
#> SRR390519 3 0.0000 0.968 0.000 0.000 1.000
#> SRR390520 3 0.0000 0.968 0.000 0.000 1.000
#> SRR390521 1 0.2356 0.937 0.928 0.072 0.000
#> SRR390522 1 0.2356 0.937 0.928 0.072 0.000
#> SRR390523 1 0.2356 0.937 0.928 0.072 0.000
#> SRR390524 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390525 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390526 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390527 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390528 1 0.0237 0.979 0.996 0.004 0.000
#> SRR390529 3 0.0237 0.966 0.004 0.000 0.996
#> SRR390530 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390531 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390532 3 0.0592 0.962 0.000 0.012 0.988
#> SRR390533 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390534 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390535 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390536 2 0.1163 0.942 0.028 0.972 0.000
#> SRR390537 2 0.1163 0.942 0.028 0.972 0.000
#> SRR390538 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390539 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390540 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390541 1 0.0000 0.981 1.000 0.000 0.000
#> SRR390542 2 0.0000 0.954 0.000 1.000 0.000
#> SRR390543 2 0.0000 0.954 0.000 1.000 0.000
#> SRR390544 2 0.0000 0.954 0.000 1.000 0.000
#> SRR390545 2 0.0000 0.954 0.000 1.000 0.000
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.0817 0.8514 0.976 0.000 0.000 0.024
#> SRR390471 1 0.0817 0.8514 0.976 0.000 0.000 0.024
#> SRR390472 3 0.0000 0.8716 0.000 0.000 1.000 0.000
#> SRR390473 3 0.0000 0.8716 0.000 0.000 1.000 0.000
#> SRR390474 3 0.6016 0.7095 0.000 0.208 0.680 0.112
#> SRR390475 1 0.0921 0.8499 0.972 0.000 0.000 0.028
#> SRR390476 1 0.0921 0.8499 0.972 0.000 0.000 0.028
#> SRR390477 1 0.0000 0.8506 1.000 0.000 0.000 0.000
#> SRR390478 1 0.0000 0.8506 1.000 0.000 0.000 0.000
#> SRR390480 4 0.2530 0.9080 0.112 0.000 0.000 0.888
#> SRR390481 4 0.2530 0.9080 0.112 0.000 0.000 0.888
#> SRR390482 3 0.6514 0.6740 0.000 0.212 0.636 0.152
#> SRR390483 3 0.6514 0.6740 0.000 0.212 0.636 0.152
#> SRR390484 3 0.0000 0.8716 0.000 0.000 1.000 0.000
#> SRR390485 3 0.0000 0.8716 0.000 0.000 1.000 0.000
#> SRR390486 3 0.0000 0.8716 0.000 0.000 1.000 0.000
#> SRR390487 3 0.0000 0.8716 0.000 0.000 1.000 0.000
#> SRR390488 1 0.5734 0.4241 0.592 0.008 0.380 0.020
#> SRR390489 1 0.5734 0.4241 0.592 0.008 0.380 0.020
#> SRR390492 3 0.6285 0.6531 0.000 0.284 0.624 0.092
#> SRR390493 3 0.6238 0.6623 0.000 0.276 0.632 0.092
#> SRR390494 4 0.0817 0.8568 0.000 0.024 0.000 0.976
#> SRR390495 4 0.0817 0.8568 0.000 0.024 0.000 0.976
#> SRR390496 4 0.0817 0.8568 0.000 0.024 0.000 0.976
#> SRR390497 3 0.0000 0.8716 0.000 0.000 1.000 0.000
#> SRR390498 3 0.2281 0.8191 0.000 0.096 0.904 0.000
#> SRR390499 4 0.2530 0.9080 0.112 0.000 0.000 0.888
#> SRR390500 4 0.2530 0.9080 0.112 0.000 0.000 0.888
#> SRR390501 1 0.1022 0.8500 0.968 0.000 0.000 0.032
#> SRR390502 1 0.1022 0.8500 0.968 0.000 0.000 0.032
#> SRR390503 3 0.0000 0.8716 0.000 0.000 1.000 0.000
#> SRR390504 3 0.0000 0.8716 0.000 0.000 1.000 0.000
#> SRR390505 1 0.4536 0.6736 0.772 0.008 0.204 0.016
#> SRR390506 3 0.0927 0.8611 0.000 0.008 0.976 0.016
#> SRR390507 2 0.0336 0.8263 0.000 0.992 0.008 0.000
#> SRR390508 2 0.0336 0.8263 0.000 0.992 0.008 0.000
#> SRR390509 2 0.0336 0.8263 0.000 0.992 0.008 0.000
#> SRR390510 2 0.0336 0.8263 0.000 0.992 0.008 0.000
#> SRR390512 2 0.3764 0.8931 0.000 0.784 0.000 0.216
#> SRR390513 2 0.3764 0.8931 0.000 0.784 0.000 0.216
#> SRR390514 2 0.3764 0.8931 0.000 0.784 0.000 0.216
#> SRR390515 1 0.4886 0.6267 0.732 0.008 0.244 0.016
#> SRR390516 3 0.0927 0.8611 0.000 0.008 0.976 0.016
#> SRR390517 3 0.4746 0.6102 0.000 0.368 0.632 0.000
#> SRR390519 3 0.0000 0.8716 0.000 0.000 1.000 0.000
#> SRR390520 3 0.0336 0.8682 0.000 0.008 0.992 0.000
#> SRR390521 4 0.2530 0.9080 0.112 0.000 0.000 0.888
#> SRR390522 4 0.2530 0.9080 0.112 0.000 0.000 0.888
#> SRR390523 4 0.2530 0.9080 0.112 0.000 0.000 0.888
#> SRR390524 1 0.0000 0.8506 1.000 0.000 0.000 0.000
#> SRR390525 1 0.0000 0.8506 1.000 0.000 0.000 0.000
#> SRR390526 1 0.0000 0.8506 1.000 0.000 0.000 0.000
#> SRR390527 1 0.0000 0.8506 1.000 0.000 0.000 0.000
#> SRR390528 4 0.4356 0.6805 0.292 0.000 0.000 0.708
#> SRR390529 3 0.1843 0.8406 0.028 0.008 0.948 0.016
#> SRR390530 1 0.0000 0.8506 1.000 0.000 0.000 0.000
#> SRR390531 1 0.0000 0.8506 1.000 0.000 0.000 0.000
#> SRR390532 3 0.6353 0.6880 0.000 0.208 0.652 0.140
#> SRR390533 1 0.5000 -0.0907 0.504 0.000 0.000 0.496
#> SRR390534 1 0.5000 -0.0907 0.504 0.000 0.000 0.496
#> SRR390535 1 0.5000 -0.0907 0.504 0.000 0.000 0.496
#> SRR390536 4 0.0817 0.8568 0.000 0.024 0.000 0.976
#> SRR390537 4 0.0817 0.8568 0.000 0.024 0.000 0.976
#> SRR390538 1 0.0817 0.8514 0.976 0.000 0.000 0.024
#> SRR390539 1 0.0817 0.8514 0.976 0.000 0.000 0.024
#> SRR390540 1 0.0921 0.8499 0.972 0.000 0.000 0.028
#> SRR390541 1 0.0817 0.8514 0.976 0.000 0.000 0.024
#> SRR390542 2 0.3764 0.8931 0.000 0.784 0.000 0.216
#> SRR390543 2 0.3764 0.8931 0.000 0.784 0.000 0.216
#> SRR390544 2 0.3764 0.8931 0.000 0.784 0.000 0.216
#> SRR390545 2 0.3764 0.8931 0.000 0.784 0.000 0.216
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.2020 0.788 0.900 0.000 0.000 0.100 0.000
#> SRR390471 1 0.2020 0.788 0.900 0.000 0.000 0.100 0.000
#> SRR390472 3 0.0000 0.782 0.000 0.000 1.000 0.000 0.000
#> SRR390473 3 0.0000 0.782 0.000 0.000 1.000 0.000 0.000
#> SRR390474 5 0.5491 0.926 0.000 0.012 0.312 0.060 0.616
#> SRR390475 1 0.2074 0.787 0.896 0.000 0.000 0.104 0.000
#> SRR390476 1 0.2074 0.787 0.896 0.000 0.000 0.104 0.000
#> SRR390477 1 0.2852 0.762 0.828 0.000 0.000 0.000 0.172
#> SRR390478 1 0.2852 0.762 0.828 0.000 0.000 0.000 0.172
#> SRR390480 4 0.1041 0.876 0.032 0.000 0.000 0.964 0.004
#> SRR390481 4 0.1041 0.876 0.032 0.000 0.000 0.964 0.004
#> SRR390482 5 0.5455 0.964 0.000 0.012 0.280 0.068 0.640
#> SRR390483 5 0.5455 0.964 0.000 0.012 0.280 0.068 0.640
#> SRR390484 3 0.0162 0.781 0.000 0.000 0.996 0.000 0.004
#> SRR390485 3 0.0162 0.781 0.000 0.000 0.996 0.000 0.004
#> SRR390486 3 0.1205 0.768 0.000 0.000 0.956 0.004 0.040
#> SRR390487 3 0.1205 0.768 0.000 0.000 0.956 0.004 0.040
#> SRR390488 3 0.7762 0.311 0.320 0.040 0.460 0.036 0.144
#> SRR390489 3 0.7762 0.311 0.320 0.040 0.460 0.036 0.144
#> SRR390492 5 0.5065 0.951 0.000 0.016 0.284 0.036 0.664
#> SRR390493 5 0.5065 0.951 0.000 0.016 0.284 0.036 0.664
#> SRR390494 4 0.3601 0.827 0.000 0.128 0.000 0.820 0.052
#> SRR390495 4 0.3317 0.838 0.000 0.116 0.000 0.840 0.044
#> SRR390496 4 0.3317 0.838 0.000 0.116 0.000 0.840 0.044
#> SRR390497 3 0.0162 0.781 0.000 0.000 0.996 0.000 0.004
#> SRR390498 3 0.2390 0.686 0.000 0.084 0.896 0.000 0.020
#> SRR390499 4 0.1041 0.876 0.032 0.000 0.000 0.964 0.004
#> SRR390500 4 0.1041 0.876 0.032 0.000 0.000 0.964 0.004
#> SRR390501 1 0.3506 0.756 0.832 0.000 0.000 0.104 0.064
#> SRR390502 1 0.3506 0.756 0.832 0.000 0.000 0.104 0.064
#> SRR390503 3 0.0000 0.782 0.000 0.000 1.000 0.000 0.000
#> SRR390504 3 0.0000 0.782 0.000 0.000 1.000 0.000 0.000
#> SRR390505 1 0.7441 0.371 0.496 0.024 0.200 0.024 0.256
#> SRR390506 3 0.3077 0.723 0.000 0.024 0.872 0.020 0.084
#> SRR390507 2 0.3123 0.809 0.000 0.812 0.004 0.000 0.184
#> SRR390508 2 0.3123 0.809 0.000 0.812 0.004 0.000 0.184
#> SRR390509 2 0.3123 0.809 0.000 0.812 0.004 0.000 0.184
#> SRR390510 2 0.3123 0.809 0.000 0.812 0.004 0.000 0.184
#> SRR390512 2 0.1341 0.904 0.000 0.944 0.000 0.056 0.000
#> SRR390513 2 0.1341 0.904 0.000 0.944 0.000 0.056 0.000
#> SRR390514 2 0.1341 0.904 0.000 0.944 0.000 0.056 0.000
#> SRR390515 3 0.7764 0.137 0.292 0.024 0.412 0.024 0.248
#> SRR390516 3 0.3692 0.698 0.000 0.024 0.828 0.024 0.124
#> SRR390517 3 0.5440 0.105 0.000 0.300 0.612 0.000 0.088
#> SRR390519 3 0.0162 0.781 0.000 0.000 0.996 0.000 0.004
#> SRR390520 3 0.0510 0.780 0.000 0.000 0.984 0.000 0.016
#> SRR390521 4 0.1469 0.871 0.036 0.000 0.000 0.948 0.016
#> SRR390522 4 0.1469 0.871 0.036 0.000 0.000 0.948 0.016
#> SRR390523 4 0.1469 0.871 0.036 0.000 0.000 0.948 0.016
#> SRR390524 1 0.2852 0.762 0.828 0.000 0.000 0.000 0.172
#> SRR390525 1 0.2852 0.762 0.828 0.000 0.000 0.000 0.172
#> SRR390526 1 0.2852 0.762 0.828 0.000 0.000 0.000 0.172
#> SRR390527 1 0.2852 0.762 0.828 0.000 0.000 0.000 0.172
#> SRR390528 4 0.6141 0.406 0.244 0.000 0.000 0.560 0.196
#> SRR390529 3 0.3669 0.713 0.020 0.024 0.852 0.020 0.084
#> SRR390530 1 0.2852 0.762 0.828 0.000 0.000 0.000 0.172
#> SRR390531 1 0.2852 0.762 0.828 0.000 0.000 0.000 0.172
#> SRR390532 5 0.5419 0.964 0.000 0.012 0.284 0.064 0.640
#> SRR390533 1 0.5719 0.215 0.500 0.016 0.000 0.436 0.048
#> SRR390534 1 0.5719 0.215 0.500 0.016 0.000 0.436 0.048
#> SRR390535 1 0.5995 0.299 0.468 0.000 0.000 0.420 0.112
#> SRR390536 4 0.3317 0.838 0.000 0.116 0.000 0.840 0.044
#> SRR390537 4 0.3317 0.838 0.000 0.116 0.000 0.840 0.044
#> SRR390538 1 0.1908 0.789 0.908 0.000 0.000 0.092 0.000
#> SRR390539 1 0.1965 0.789 0.904 0.000 0.000 0.096 0.000
#> SRR390540 1 0.2074 0.787 0.896 0.000 0.000 0.104 0.000
#> SRR390541 1 0.1965 0.789 0.904 0.000 0.000 0.096 0.000
#> SRR390542 2 0.1341 0.904 0.000 0.944 0.000 0.056 0.000
#> SRR390543 2 0.1341 0.904 0.000 0.944 0.000 0.056 0.000
#> SRR390544 2 0.1341 0.904 0.000 0.944 0.000 0.056 0.000
#> SRR390545 2 0.1341 0.904 0.000 0.944 0.000 0.056 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.5508 0.09136 0.472 0.000 0.000 0.112 0.004 0.412
#> SRR390471 1 0.5448 0.08351 0.472 0.000 0.000 0.104 0.004 0.420
#> SRR390472 3 0.0405 0.87094 0.000 0.000 0.988 0.000 0.008 0.004
#> SRR390473 3 0.0405 0.87094 0.000 0.000 0.988 0.000 0.008 0.004
#> SRR390474 5 0.5025 0.89750 0.000 0.016 0.172 0.072 0.712 0.028
#> SRR390475 1 0.5621 0.09585 0.468 0.000 0.000 0.128 0.004 0.400
#> SRR390476 1 0.5621 0.09585 0.468 0.000 0.000 0.128 0.004 0.400
#> SRR390477 1 0.0000 0.52122 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390478 1 0.0000 0.52122 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390480 4 0.0858 0.83732 0.004 0.000 0.000 0.968 0.028 0.000
#> SRR390481 4 0.0858 0.83732 0.004 0.000 0.000 0.968 0.028 0.000
#> SRR390482 5 0.3780 0.93112 0.000 0.000 0.148 0.052 0.788 0.012
#> SRR390483 5 0.3802 0.92961 0.000 0.000 0.144 0.056 0.788 0.012
#> SRR390484 3 0.0260 0.86971 0.000 0.000 0.992 0.000 0.008 0.000
#> SRR390485 3 0.0260 0.86971 0.000 0.000 0.992 0.000 0.008 0.000
#> SRR390486 3 0.3445 0.73229 0.000 0.000 0.796 0.000 0.048 0.156
#> SRR390487 3 0.3624 0.72003 0.000 0.000 0.784 0.000 0.060 0.156
#> SRR390488 6 0.3386 0.49655 0.020 0.000 0.068 0.000 0.076 0.836
#> SRR390489 6 0.3386 0.49655 0.020 0.000 0.068 0.000 0.076 0.836
#> SRR390492 5 0.3862 0.91370 0.000 0.016 0.148 0.036 0.792 0.008
#> SRR390493 5 0.3865 0.91618 0.000 0.016 0.156 0.032 0.788 0.008
#> SRR390494 4 0.4789 0.77965 0.000 0.148 0.000 0.728 0.056 0.068
#> SRR390495 4 0.4121 0.80125 0.000 0.156 0.000 0.768 0.048 0.028
#> SRR390496 4 0.4121 0.80125 0.000 0.156 0.000 0.768 0.048 0.028
#> SRR390497 3 0.0260 0.86971 0.000 0.000 0.992 0.000 0.008 0.000
#> SRR390498 3 0.1003 0.86611 0.000 0.004 0.964 0.000 0.028 0.004
#> SRR390499 4 0.0858 0.83732 0.004 0.000 0.000 0.968 0.028 0.000
#> SRR390500 4 0.0858 0.83732 0.004 0.000 0.000 0.968 0.028 0.000
#> SRR390501 6 0.5374 0.48934 0.240 0.000 0.000 0.100 0.028 0.632
#> SRR390502 6 0.5352 0.49510 0.236 0.000 0.000 0.100 0.028 0.636
#> SRR390503 3 0.0146 0.87092 0.000 0.000 0.996 0.000 0.000 0.004
#> SRR390504 3 0.0000 0.87092 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390505 1 0.6223 0.17101 0.580 0.000 0.112 0.000 0.096 0.212
#> SRR390506 3 0.4220 0.70089 0.000 0.000 0.732 0.000 0.096 0.172
#> SRR390507 2 0.2838 0.80430 0.000 0.808 0.000 0.000 0.188 0.004
#> SRR390508 2 0.2838 0.80430 0.000 0.808 0.000 0.000 0.188 0.004
#> SRR390509 2 0.2838 0.80430 0.000 0.808 0.000 0.000 0.188 0.004
#> SRR390510 2 0.2838 0.80430 0.000 0.808 0.000 0.000 0.188 0.004
#> SRR390512 2 0.0458 0.90244 0.000 0.984 0.000 0.016 0.000 0.000
#> SRR390513 2 0.0458 0.90244 0.000 0.984 0.000 0.016 0.000 0.000
#> SRR390514 2 0.0458 0.90244 0.000 0.984 0.000 0.016 0.000 0.000
#> SRR390515 1 0.6928 0.06703 0.468 0.000 0.244 0.000 0.096 0.192
#> SRR390516 3 0.5138 0.59015 0.000 0.000 0.600 0.000 0.124 0.276
#> SRR390517 3 0.2886 0.75010 0.000 0.072 0.860 0.000 0.064 0.004
#> SRR390519 3 0.0260 0.86971 0.000 0.000 0.992 0.000 0.008 0.000
#> SRR390520 3 0.1657 0.84702 0.000 0.000 0.928 0.000 0.056 0.016
#> SRR390521 4 0.1401 0.82324 0.004 0.000 0.000 0.948 0.020 0.028
#> SRR390522 4 0.1401 0.82324 0.004 0.000 0.000 0.948 0.020 0.028
#> SRR390523 4 0.1401 0.82324 0.004 0.000 0.000 0.948 0.020 0.028
#> SRR390524 1 0.0000 0.52122 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390525 1 0.0000 0.52122 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390526 1 0.0000 0.52122 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390527 1 0.0000 0.52122 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390528 1 0.5465 -0.09841 0.508 0.000 0.000 0.396 0.080 0.016
#> SRR390529 3 0.4431 0.67686 0.000 0.000 0.704 0.000 0.096 0.200
#> SRR390530 1 0.0000 0.52122 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390531 1 0.0000 0.52122 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390532 5 0.3663 0.92558 0.000 0.000 0.156 0.040 0.792 0.012
#> SRR390533 6 0.5964 0.48726 0.152 0.000 0.000 0.288 0.024 0.536
#> SRR390534 6 0.5964 0.48726 0.152 0.000 0.000 0.288 0.024 0.536
#> SRR390535 1 0.6254 0.00229 0.484 0.000 0.000 0.296 0.024 0.196
#> SRR390536 4 0.4121 0.80125 0.000 0.156 0.000 0.768 0.048 0.028
#> SRR390537 4 0.4121 0.80125 0.000 0.156 0.000 0.768 0.048 0.028
#> SRR390538 1 0.5383 0.08997 0.472 0.000 0.000 0.112 0.000 0.416
#> SRR390539 1 0.5466 0.10081 0.472 0.000 0.000 0.124 0.000 0.404
#> SRR390540 1 0.5495 0.09572 0.468 0.000 0.000 0.128 0.000 0.404
#> SRR390541 1 0.5466 0.10081 0.472 0.000 0.000 0.124 0.000 0.404
#> SRR390542 2 0.0458 0.90244 0.000 0.984 0.000 0.016 0.000 0.000
#> SRR390543 2 0.0458 0.90244 0.000 0.984 0.000 0.016 0.000 0.000
#> SRR390544 2 0.0458 0.90244 0.000 0.984 0.000 0.016 0.000 0.000
#> SRR390545 2 0.0458 0.90244 0.000 0.984 0.000 0.016 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.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
ATC:pam**
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"]
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 15244 rows and 71 columns.
#> Top rows (1000, 2000, 3000, 4000, 5000) are extracted by 'ATC' method.
#> Subgroups are detected by 'pam' method.
#> Performed in total 1250 partitions by row resampling.
#> Best k for subgroups seems to be 6.
#>
#> Following methods can be applied to this 'ConsensusPartition' object:
#> [1] "cola_report" "collect_classes" "collect_plots"
#> [4] "collect_stats" "colnames" "compare_signatures"
#> [7] "consensus_heatmap" "dimension_reduction" "functional_enrichment"
#> [10] "get_anno_col" "get_anno" "get_classes"
#> [13] "get_consensus" "get_matrix" "get_membership"
#> [16] "get_param" "get_signatures" "get_stats"
#> [19] "is_best_k" "is_stable_k" "membership_heatmap"
#> [22] "ncol" "nrow" "plot_ecdf"
#> [25] "rownames" "select_partition_number" "show"
#> [28] "suggest_best_k" "test_to_known_factors"
collect_plots()
function collects all the plots made from res
for all k
(number of partitions)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)

The plots are:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.385 0.757 0.877 0.4119 0.577 0.577
#> 3 3 0.943 0.936 0.968 0.4993 0.703 0.527
#> 4 4 0.717 0.871 0.886 0.1856 0.823 0.563
#> 5 5 0.905 0.892 0.957 0.0616 0.970 0.880
#> 6 6 0.991 0.915 0.965 0.0325 0.928 0.707
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
suggest_best_k(res)
#> [1] 6
#> attr(,"optional")
#> [1] 3 5
There is also optional best \(k\) = 3 5 that is worth to check.
Following shows the table of the partitions (You need to click the show/hide
code output link to see it). The membership matrix (columns with name p*
)
is inferred by
clue::cl_consensus()
function with the SE
method. Basically the value in the membership matrix
represents the probability to belong to a certain group. The finall class
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.000 0.873 1.000 0.000
#> SRR390471 1 0.000 0.873 1.000 0.000
#> SRR390472 1 0.971 0.433 0.600 0.400
#> SRR390473 1 0.971 0.433 0.600 0.400
#> SRR390474 1 0.855 0.620 0.720 0.280
#> SRR390475 1 0.000 0.873 1.000 0.000
#> SRR390476 1 0.000 0.873 1.000 0.000
#> SRR390477 1 0.000 0.873 1.000 0.000
#> SRR390478 1 0.000 0.873 1.000 0.000
#> SRR390480 1 0.000 0.873 1.000 0.000
#> SRR390481 1 0.000 0.873 1.000 0.000
#> SRR390482 1 0.855 0.620 0.720 0.280
#> SRR390483 1 0.855 0.620 0.720 0.280
#> SRR390484 2 0.000 0.735 0.000 1.000
#> SRR390485 2 0.753 0.620 0.216 0.784
#> SRR390486 1 0.855 0.620 0.720 0.280
#> SRR390487 1 0.855 0.620 0.720 0.280
#> SRR390488 1 0.855 0.620 0.720 0.280
#> SRR390489 1 0.855 0.620 0.720 0.280
#> SRR390492 2 0.529 0.768 0.120 0.880
#> SRR390493 2 0.529 0.768 0.120 0.880
#> SRR390494 1 0.000 0.873 1.000 0.000
#> SRR390495 1 0.000 0.873 1.000 0.000
#> SRR390496 1 0.000 0.873 1.000 0.000
#> SRR390497 2 0.000 0.735 0.000 1.000
#> SRR390498 2 0.000 0.735 0.000 1.000
#> SRR390499 1 0.000 0.873 1.000 0.000
#> SRR390500 1 0.000 0.873 1.000 0.000
#> SRR390501 1 0.000 0.873 1.000 0.000
#> SRR390502 1 0.000 0.873 1.000 0.000
#> SRR390503 2 0.767 0.608 0.224 0.776
#> SRR390504 2 0.753 0.620 0.216 0.784
#> SRR390505 1 0.000 0.873 1.000 0.000
#> SRR390506 1 0.971 0.433 0.600 0.400
#> SRR390507 2 0.529 0.768 0.120 0.880
#> SRR390508 2 0.529 0.768 0.120 0.880
#> SRR390509 2 0.529 0.768 0.120 0.880
#> SRR390510 2 0.529 0.768 0.120 0.880
#> SRR390512 2 0.971 0.607 0.400 0.600
#> SRR390513 2 0.971 0.607 0.400 0.600
#> SRR390514 2 0.971 0.607 0.400 0.600
#> SRR390515 1 0.000 0.873 1.000 0.000
#> SRR390516 1 0.855 0.620 0.720 0.280
#> SRR390517 2 0.000 0.735 0.000 1.000
#> SRR390519 2 0.680 0.660 0.180 0.820
#> SRR390520 1 0.855 0.620 0.720 0.280
#> SRR390521 1 0.000 0.873 1.000 0.000
#> SRR390522 1 0.000 0.873 1.000 0.000
#> SRR390523 1 0.000 0.873 1.000 0.000
#> SRR390524 1 0.000 0.873 1.000 0.000
#> SRR390525 1 0.000 0.873 1.000 0.000
#> SRR390526 1 0.000 0.873 1.000 0.000
#> SRR390527 1 0.000 0.873 1.000 0.000
#> SRR390528 1 0.000 0.873 1.000 0.000
#> SRR390529 1 0.855 0.620 0.720 0.280
#> SRR390530 1 0.000 0.873 1.000 0.000
#> SRR390531 1 0.000 0.873 1.000 0.000
#> SRR390532 1 0.855 0.620 0.720 0.280
#> SRR390533 1 0.000 0.873 1.000 0.000
#> SRR390534 1 0.000 0.873 1.000 0.000
#> SRR390535 1 0.000 0.873 1.000 0.000
#> SRR390536 1 0.443 0.759 0.908 0.092
#> SRR390537 1 0.000 0.873 1.000 0.000
#> SRR390538 1 0.000 0.873 1.000 0.000
#> SRR390539 1 0.000 0.873 1.000 0.000
#> SRR390540 1 0.000 0.873 1.000 0.000
#> SRR390541 1 0.000 0.873 1.000 0.000
#> SRR390542 2 0.971 0.607 0.400 0.600
#> SRR390543 2 0.971 0.607 0.400 0.600
#> SRR390544 2 0.971 0.607 0.400 0.600
#> SRR390545 2 0.971 0.607 0.400 0.600
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390471 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390472 3 0.1163 0.952 0.028 0.000 0.972
#> SRR390473 3 0.1163 0.952 0.028 0.000 0.972
#> SRR390474 3 0.2448 0.929 0.076 0.000 0.924
#> SRR390475 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390476 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390477 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390478 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390480 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390481 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390482 3 0.2448 0.929 0.076 0.000 0.924
#> SRR390483 3 0.2448 0.929 0.076 0.000 0.924
#> SRR390484 3 0.0000 0.945 0.000 0.000 1.000
#> SRR390485 3 0.0000 0.945 0.000 0.000 1.000
#> SRR390486 3 0.1163 0.952 0.028 0.000 0.972
#> SRR390487 3 0.1163 0.952 0.028 0.000 0.972
#> SRR390488 3 0.2448 0.929 0.076 0.000 0.924
#> SRR390489 3 0.2448 0.929 0.076 0.000 0.924
#> SRR390492 3 0.2448 0.913 0.000 0.076 0.924
#> SRR390493 3 0.1860 0.929 0.000 0.052 0.948
#> SRR390494 1 0.0424 0.969 0.992 0.008 0.000
#> SRR390495 1 0.4555 0.765 0.800 0.200 0.000
#> SRR390496 1 0.3192 0.870 0.888 0.112 0.000
#> SRR390497 3 0.0000 0.945 0.000 0.000 1.000
#> SRR390498 3 0.1289 0.938 0.000 0.032 0.968
#> SRR390499 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390500 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390501 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390502 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390503 3 0.0000 0.945 0.000 0.000 1.000
#> SRR390504 3 0.0000 0.945 0.000 0.000 1.000
#> SRR390505 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390506 3 0.0000 0.945 0.000 0.000 1.000
#> SRR390507 2 0.0000 0.962 0.000 1.000 0.000
#> SRR390508 2 0.0000 0.962 0.000 1.000 0.000
#> SRR390509 2 0.0000 0.962 0.000 1.000 0.000
#> SRR390510 2 0.0000 0.962 0.000 1.000 0.000
#> SRR390512 2 0.0000 0.962 0.000 1.000 0.000
#> SRR390513 2 0.0000 0.962 0.000 1.000 0.000
#> SRR390514 2 0.0000 0.962 0.000 1.000 0.000
#> SRR390515 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390516 3 0.1163 0.952 0.028 0.000 0.972
#> SRR390517 2 0.6126 0.318 0.000 0.600 0.400
#> SRR390519 3 0.0000 0.945 0.000 0.000 1.000
#> SRR390520 3 0.1163 0.952 0.028 0.000 0.972
#> SRR390521 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390522 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390523 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390524 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390525 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390526 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390527 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390528 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390529 3 0.4555 0.742 0.200 0.000 0.800
#> SRR390530 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390531 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390532 3 0.2448 0.929 0.076 0.000 0.924
#> SRR390533 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390534 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390535 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390536 1 0.5859 0.515 0.656 0.344 0.000
#> SRR390537 1 0.4555 0.765 0.800 0.200 0.000
#> SRR390538 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390539 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390540 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390541 1 0.0000 0.975 1.000 0.000 0.000
#> SRR390542 2 0.0000 0.962 0.000 1.000 0.000
#> SRR390543 2 0.0000 0.962 0.000 1.000 0.000
#> SRR390544 2 0.0000 0.962 0.000 1.000 0.000
#> SRR390545 2 0.0000 0.962 0.000 1.000 0.000
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.3726 0.972 0.788 0.000 0.000 0.212
#> SRR390471 1 0.3726 0.972 0.788 0.000 0.000 0.212
#> SRR390472 3 0.1022 0.873 0.032 0.000 0.968 0.000
#> SRR390473 3 0.1022 0.873 0.032 0.000 0.968 0.000
#> SRR390474 3 0.3123 0.785 0.000 0.000 0.844 0.156
#> SRR390475 4 0.1022 0.876 0.032 0.000 0.000 0.968
#> SRR390476 1 0.4933 0.623 0.568 0.000 0.000 0.432
#> SRR390477 1 0.3726 0.972 0.788 0.000 0.000 0.212
#> SRR390478 1 0.3726 0.972 0.788 0.000 0.000 0.212
#> SRR390480 4 0.0000 0.887 0.000 0.000 0.000 1.000
#> SRR390481 4 0.0000 0.887 0.000 0.000 0.000 1.000
#> SRR390482 4 0.3726 0.719 0.000 0.000 0.212 0.788
#> SRR390483 4 0.3726 0.719 0.000 0.000 0.212 0.788
#> SRR390484 3 0.3726 0.798 0.212 0.000 0.788 0.000
#> SRR390485 3 0.3726 0.798 0.212 0.000 0.788 0.000
#> SRR390486 3 0.1474 0.871 0.052 0.000 0.948 0.000
#> SRR390487 3 0.1706 0.871 0.036 0.000 0.948 0.016
#> SRR390488 3 0.3024 0.821 0.148 0.000 0.852 0.000
#> SRR390489 3 0.3024 0.821 0.148 0.000 0.852 0.000
#> SRR390492 3 0.3324 0.799 0.000 0.012 0.852 0.136
#> SRR390493 3 0.1724 0.862 0.000 0.020 0.948 0.032
#> SRR390494 4 0.0336 0.885 0.000 0.008 0.000 0.992
#> SRR390495 4 0.3610 0.739 0.000 0.200 0.000 0.800
#> SRR390496 4 0.2530 0.828 0.000 0.112 0.000 0.888
#> SRR390497 3 0.3726 0.798 0.212 0.000 0.788 0.000
#> SRR390498 3 0.1557 0.855 0.000 0.056 0.944 0.000
#> SRR390499 4 0.0000 0.887 0.000 0.000 0.000 1.000
#> SRR390500 4 0.0000 0.887 0.000 0.000 0.000 1.000
#> SRR390501 1 0.4164 0.918 0.736 0.000 0.000 0.264
#> SRR390502 4 0.1557 0.852 0.056 0.000 0.000 0.944
#> SRR390503 3 0.0000 0.867 0.000 0.000 1.000 0.000
#> SRR390504 3 0.3726 0.798 0.212 0.000 0.788 0.000
#> SRR390505 1 0.3726 0.972 0.788 0.000 0.000 0.212
#> SRR390506 3 0.1940 0.854 0.076 0.000 0.924 0.000
#> SRR390507 2 0.0000 0.964 0.000 1.000 0.000 0.000
#> SRR390508 2 0.0000 0.964 0.000 1.000 0.000 0.000
#> SRR390509 2 0.0000 0.964 0.000 1.000 0.000 0.000
#> SRR390510 2 0.0000 0.964 0.000 1.000 0.000 0.000
#> SRR390512 2 0.0000 0.964 0.000 1.000 0.000 0.000
#> SRR390513 2 0.0000 0.964 0.000 1.000 0.000 0.000
#> SRR390514 2 0.0000 0.964 0.000 1.000 0.000 0.000
#> SRR390515 1 0.3726 0.972 0.788 0.000 0.000 0.212
#> SRR390516 3 0.1474 0.871 0.052 0.000 0.948 0.000
#> SRR390517 2 0.4790 0.382 0.000 0.620 0.380 0.000
#> SRR390519 3 0.3726 0.798 0.212 0.000 0.788 0.000
#> SRR390520 3 0.1474 0.871 0.052 0.000 0.948 0.000
#> SRR390521 4 0.1022 0.876 0.032 0.000 0.000 0.968
#> SRR390522 4 0.1022 0.876 0.032 0.000 0.000 0.968
#> SRR390523 4 0.0000 0.887 0.000 0.000 0.000 1.000
#> SRR390524 1 0.3726 0.972 0.788 0.000 0.000 0.212
#> SRR390525 1 0.3726 0.972 0.788 0.000 0.000 0.212
#> SRR390526 1 0.4008 0.940 0.756 0.000 0.000 0.244
#> SRR390527 1 0.4008 0.940 0.756 0.000 0.000 0.244
#> SRR390528 4 0.0000 0.887 0.000 0.000 0.000 1.000
#> SRR390529 3 0.5110 0.480 0.352 0.000 0.636 0.012
#> SRR390530 1 0.3726 0.972 0.788 0.000 0.000 0.212
#> SRR390531 1 0.3726 0.972 0.788 0.000 0.000 0.212
#> SRR390532 4 0.3726 0.719 0.000 0.000 0.212 0.788
#> SRR390533 4 0.1022 0.876 0.032 0.000 0.000 0.968
#> SRR390534 4 0.1022 0.876 0.032 0.000 0.000 0.968
#> SRR390535 4 0.0000 0.887 0.000 0.000 0.000 1.000
#> SRR390536 4 0.3610 0.739 0.000 0.200 0.000 0.800
#> SRR390537 4 0.3610 0.739 0.000 0.200 0.000 0.800
#> SRR390538 1 0.3726 0.972 0.788 0.000 0.000 0.212
#> SRR390539 1 0.3726 0.972 0.788 0.000 0.000 0.212
#> SRR390540 4 0.1022 0.876 0.032 0.000 0.000 0.968
#> SRR390541 1 0.3726 0.972 0.788 0.000 0.000 0.212
#> SRR390542 2 0.0000 0.964 0.000 1.000 0.000 0.000
#> SRR390543 2 0.0000 0.964 0.000 1.000 0.000 0.000
#> SRR390544 2 0.0000 0.964 0.000 1.000 0.000 0.000
#> SRR390545 2 0.0000 0.964 0.000 1.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.0000 0.949 1.000 0.000 0.000 0.000 0.000
#> SRR390471 1 0.0000 0.949 1.000 0.000 0.000 0.000 0.000
#> SRR390472 3 0.0000 0.879 0.000 0.000 1.000 0.000 0.000
#> SRR390473 3 0.0000 0.879 0.000 0.000 1.000 0.000 0.000
#> SRR390474 3 0.3707 0.631 0.000 0.000 0.716 0.284 0.000
#> SRR390475 4 0.0000 0.959 0.000 0.000 0.000 1.000 0.000
#> SRR390476 1 0.4030 0.453 0.648 0.000 0.000 0.352 0.000
#> SRR390477 1 0.0000 0.949 1.000 0.000 0.000 0.000 0.000
#> SRR390478 1 0.0000 0.949 1.000 0.000 0.000 0.000 0.000
#> SRR390480 4 0.0000 0.959 0.000 0.000 0.000 1.000 0.000
#> SRR390481 4 0.0000 0.959 0.000 0.000 0.000 1.000 0.000
#> SRR390482 4 0.2424 0.834 0.000 0.000 0.132 0.868 0.000
#> SRR390483 4 0.2074 0.866 0.000 0.000 0.104 0.896 0.000
#> SRR390484 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR390485 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR390486 3 0.0000 0.879 0.000 0.000 1.000 0.000 0.000
#> SRR390487 3 0.0000 0.879 0.000 0.000 1.000 0.000 0.000
#> SRR390488 3 0.0000 0.879 0.000 0.000 1.000 0.000 0.000
#> SRR390489 3 0.0000 0.879 0.000 0.000 1.000 0.000 0.000
#> SRR390492 3 0.3707 0.631 0.000 0.000 0.716 0.284 0.000
#> SRR390493 3 0.3707 0.631 0.000 0.000 0.716 0.284 0.000
#> SRR390494 4 0.0000 0.959 0.000 0.000 0.000 1.000 0.000
#> SRR390495 4 0.0000 0.959 0.000 0.000 0.000 1.000 0.000
#> SRR390496 4 0.0000 0.959 0.000 0.000 0.000 1.000 0.000
#> SRR390497 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR390498 3 0.3707 0.567 0.000 0.284 0.716 0.000 0.000
#> SRR390499 4 0.0000 0.959 0.000 0.000 0.000 1.000 0.000
#> SRR390500 4 0.0000 0.959 0.000 0.000 0.000 1.000 0.000
#> SRR390501 1 0.4360 0.574 0.692 0.000 0.284 0.024 0.000
#> SRR390502 4 0.4988 0.504 0.060 0.000 0.284 0.656 0.000
#> SRR390503 3 0.0000 0.879 0.000 0.000 1.000 0.000 0.000
#> SRR390504 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR390505 1 0.0000 0.949 1.000 0.000 0.000 0.000 0.000
#> SRR390506 3 0.1124 0.850 0.004 0.000 0.960 0.000 0.036
#> SRR390507 2 0.0000 0.953 0.000 1.000 0.000 0.000 0.000
#> SRR390508 2 0.0000 0.953 0.000 1.000 0.000 0.000 0.000
#> SRR390509 2 0.0000 0.953 0.000 1.000 0.000 0.000 0.000
#> SRR390510 2 0.0000 0.953 0.000 1.000 0.000 0.000 0.000
#> SRR390512 2 0.0000 0.953 0.000 1.000 0.000 0.000 0.000
#> SRR390513 2 0.0000 0.953 0.000 1.000 0.000 0.000 0.000
#> SRR390514 2 0.0000 0.953 0.000 1.000 0.000 0.000 0.000
#> SRR390515 1 0.0000 0.949 1.000 0.000 0.000 0.000 0.000
#> SRR390516 3 0.0000 0.879 0.000 0.000 1.000 0.000 0.000
#> SRR390517 2 0.4182 0.262 0.000 0.600 0.400 0.000 0.000
#> SRR390519 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000
#> SRR390520 3 0.0000 0.879 0.000 0.000 1.000 0.000 0.000
#> SRR390521 4 0.0000 0.959 0.000 0.000 0.000 1.000 0.000
#> SRR390522 4 0.0000 0.959 0.000 0.000 0.000 1.000 0.000
#> SRR390523 4 0.0000 0.959 0.000 0.000 0.000 1.000 0.000
#> SRR390524 1 0.0000 0.949 1.000 0.000 0.000 0.000 0.000
#> SRR390525 1 0.0000 0.949 1.000 0.000 0.000 0.000 0.000
#> SRR390526 1 0.0000 0.949 1.000 0.000 0.000 0.000 0.000
#> SRR390527 1 0.0000 0.949 1.000 0.000 0.000 0.000 0.000
#> SRR390528 4 0.0000 0.959 0.000 0.000 0.000 1.000 0.000
#> SRR390529 3 0.1671 0.812 0.076 0.000 0.924 0.000 0.000
#> SRR390530 1 0.0000 0.949 1.000 0.000 0.000 0.000 0.000
#> SRR390531 1 0.0000 0.949 1.000 0.000 0.000 0.000 0.000
#> SRR390532 4 0.2605 0.813 0.000 0.000 0.148 0.852 0.000
#> SRR390533 4 0.0000 0.959 0.000 0.000 0.000 1.000 0.000
#> SRR390534 4 0.0000 0.959 0.000 0.000 0.000 1.000 0.000
#> SRR390535 4 0.0290 0.953 0.008 0.000 0.000 0.992 0.000
#> SRR390536 4 0.0162 0.957 0.000 0.004 0.000 0.996 0.000
#> SRR390537 4 0.0000 0.959 0.000 0.000 0.000 1.000 0.000
#> SRR390538 1 0.0000 0.949 1.000 0.000 0.000 0.000 0.000
#> SRR390539 1 0.0000 0.949 1.000 0.000 0.000 0.000 0.000
#> SRR390540 4 0.0000 0.959 0.000 0.000 0.000 1.000 0.000
#> SRR390541 1 0.0000 0.949 1.000 0.000 0.000 0.000 0.000
#> SRR390542 2 0.0000 0.953 0.000 1.000 0.000 0.000 0.000
#> SRR390543 2 0.0000 0.953 0.000 1.000 0.000 0.000 0.000
#> SRR390544 2 0.0000 0.953 0.000 1.000 0.000 0.000 0.000
#> SRR390545 2 0.0000 0.953 0.000 1.000 0.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390471 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390472 3 0.0000 0.912 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390473 3 0.0000 0.912 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390474 4 0.3765 0.318 0.000 0.000 0.404 0.596 0.000 0.000
#> SRR390475 4 0.0000 0.964 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390476 1 0.3634 0.436 0.644 0.000 0.000 0.356 0.000 0.000
#> SRR390477 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390478 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390480 4 0.0000 0.964 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390481 4 0.0000 0.964 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390482 4 0.0790 0.944 0.000 0.000 0.032 0.968 0.000 0.000
#> SRR390483 4 0.0458 0.956 0.000 0.000 0.016 0.984 0.000 0.000
#> SRR390484 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390485 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390486 3 0.0000 0.912 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390487 3 0.0000 0.912 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390488 3 0.0000 0.912 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390489 3 0.0000 0.912 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390492 6 0.0363 0.897 0.000 0.000 0.012 0.000 0.000 0.988
#> SRR390493 6 0.0865 0.885 0.000 0.000 0.036 0.000 0.000 0.964
#> SRR390494 4 0.1498 0.931 0.000 0.000 0.028 0.940 0.000 0.032
#> SRR390495 4 0.0790 0.951 0.000 0.000 0.000 0.968 0.000 0.032
#> SRR390496 4 0.0790 0.951 0.000 0.000 0.000 0.968 0.000 0.032
#> SRR390497 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390498 6 0.4344 0.465 0.000 0.032 0.356 0.000 0.000 0.612
#> SRR390499 4 0.0000 0.964 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390500 4 0.0000 0.964 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390501 3 0.3756 0.331 0.400 0.000 0.600 0.000 0.000 0.000
#> SRR390502 3 0.4700 0.401 0.060 0.000 0.600 0.340 0.000 0.000
#> SRR390503 3 0.0000 0.912 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390504 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390505 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390506 3 0.0260 0.906 0.000 0.000 0.992 0.000 0.008 0.000
#> SRR390507 6 0.0790 0.919 0.000 0.032 0.000 0.000 0.000 0.968
#> SRR390508 6 0.0790 0.919 0.000 0.032 0.000 0.000 0.000 0.968
#> SRR390509 6 0.0790 0.919 0.000 0.032 0.000 0.000 0.000 0.968
#> SRR390510 6 0.0790 0.919 0.000 0.032 0.000 0.000 0.000 0.968
#> SRR390512 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390513 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390514 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390515 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390516 3 0.0000 0.912 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390517 6 0.0790 0.919 0.000 0.032 0.000 0.000 0.000 0.968
#> SRR390519 5 0.0000 1.000 0.000 0.000 0.000 0.000 1.000 0.000
#> SRR390520 3 0.0000 0.912 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390521 4 0.0000 0.964 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390522 4 0.0000 0.964 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390523 4 0.0000 0.964 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390524 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390525 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390526 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390527 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390528 4 0.0000 0.964 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390529 3 0.0000 0.912 0.000 0.000 1.000 0.000 0.000 0.000
#> SRR390530 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390531 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390532 4 0.1075 0.929 0.000 0.000 0.048 0.952 0.000 0.000
#> SRR390533 4 0.0000 0.964 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390534 4 0.0000 0.964 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390535 4 0.0260 0.960 0.008 0.000 0.000 0.992 0.000 0.000
#> SRR390536 4 0.0935 0.949 0.000 0.004 0.000 0.964 0.000 0.032
#> SRR390537 4 0.0790 0.951 0.000 0.000 0.000 0.968 0.000 0.032
#> SRR390538 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390539 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390540 4 0.0000 0.964 0.000 0.000 0.000 1.000 0.000 0.000
#> SRR390541 1 0.0000 0.968 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390542 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390543 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390544 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390545 2 0.0000 1.000 0.000 1.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
ATC:mclust
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"]
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 15244 rows and 71 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 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:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or k-1.
The detailed explanations of these statistics can be found in the cola
vignette.
Generally speaking, lower PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)

The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 0.546 0.914 0.927 0.3384 0.697 0.697
#> 3 3 0.351 0.684 0.795 0.7581 0.687 0.551
#> 4 4 0.640 0.479 0.778 0.2172 0.795 0.525
#> 5 5 0.621 0.530 0.731 0.0790 0.788 0.392
#> 6 6 0.659 0.581 0.751 0.0399 0.919 0.666
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
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.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.0000 0.902 1.000 0.000
#> SRR390471 1 0.0000 0.902 1.000 0.000
#> SRR390472 1 0.6712 0.892 0.824 0.176
#> SRR390473 1 0.6712 0.892 0.824 0.176
#> SRR390474 1 0.6712 0.892 0.824 0.176
#> SRR390475 1 0.0000 0.902 1.000 0.000
#> SRR390476 1 0.0000 0.902 1.000 0.000
#> SRR390477 1 0.0000 0.902 1.000 0.000
#> SRR390478 1 0.0000 0.902 1.000 0.000
#> SRR390480 1 0.0000 0.902 1.000 0.000
#> SRR390481 1 0.0000 0.902 1.000 0.000
#> SRR390482 1 0.6712 0.892 0.824 0.176
#> SRR390483 1 0.6712 0.892 0.824 0.176
#> SRR390484 1 0.6887 0.888 0.816 0.184
#> SRR390485 1 0.6887 0.888 0.816 0.184
#> SRR390486 1 0.6712 0.892 0.824 0.176
#> SRR390487 1 0.6712 0.892 0.824 0.176
#> SRR390488 1 0.6623 0.893 0.828 0.172
#> SRR390489 1 0.6623 0.893 0.828 0.172
#> SRR390492 1 0.6887 0.888 0.816 0.184
#> SRR390493 1 0.6887 0.888 0.816 0.184
#> SRR390494 1 0.6712 0.892 0.824 0.176
#> SRR390495 1 0.4431 0.901 0.908 0.092
#> SRR390496 1 0.4298 0.901 0.912 0.088
#> SRR390497 1 0.6887 0.888 0.816 0.184
#> SRR390498 2 0.0000 0.989 0.000 1.000
#> SRR390499 1 0.0000 0.902 1.000 0.000
#> SRR390500 1 0.0000 0.902 1.000 0.000
#> SRR390501 1 0.0000 0.902 1.000 0.000
#> SRR390502 1 0.0000 0.902 1.000 0.000
#> SRR390503 1 0.6887 0.888 0.816 0.184
#> SRR390504 1 0.6887 0.888 0.816 0.184
#> SRR390505 1 0.6801 0.890 0.820 0.180
#> SRR390506 1 0.6887 0.888 0.816 0.184
#> SRR390507 2 0.0000 0.989 0.000 1.000
#> SRR390508 2 0.0000 0.989 0.000 1.000
#> SRR390509 2 0.0000 0.989 0.000 1.000
#> SRR390510 2 0.0000 0.989 0.000 1.000
#> SRR390512 2 0.1184 0.991 0.016 0.984
#> SRR390513 2 0.1184 0.991 0.016 0.984
#> SRR390514 2 0.1184 0.991 0.016 0.984
#> SRR390515 1 0.6623 0.893 0.828 0.172
#> SRR390516 1 0.6712 0.892 0.824 0.176
#> SRR390517 2 0.0000 0.989 0.000 1.000
#> SRR390519 1 0.6887 0.888 0.816 0.184
#> SRR390520 1 0.6712 0.892 0.824 0.176
#> SRR390521 1 0.0000 0.902 1.000 0.000
#> SRR390522 1 0.0000 0.902 1.000 0.000
#> SRR390523 1 0.0000 0.902 1.000 0.000
#> SRR390524 1 0.0000 0.902 1.000 0.000
#> SRR390525 1 0.0000 0.902 1.000 0.000
#> SRR390526 1 0.0000 0.902 1.000 0.000
#> SRR390527 1 0.0000 0.902 1.000 0.000
#> SRR390528 1 0.6887 0.888 0.816 0.184
#> SRR390529 1 0.6712 0.892 0.824 0.176
#> SRR390530 1 0.0000 0.902 1.000 0.000
#> SRR390531 1 0.0000 0.902 1.000 0.000
#> SRR390532 1 0.6887 0.888 0.816 0.184
#> SRR390533 1 0.0672 0.902 0.992 0.008
#> SRR390534 1 0.0938 0.902 0.988 0.012
#> SRR390535 1 0.0000 0.902 1.000 0.000
#> SRR390536 1 0.6148 0.895 0.848 0.152
#> SRR390537 1 0.4431 0.901 0.908 0.092
#> SRR390538 1 0.0000 0.902 1.000 0.000
#> SRR390539 1 0.0000 0.902 1.000 0.000
#> SRR390540 1 0.0000 0.902 1.000 0.000
#> SRR390541 1 0.0000 0.902 1.000 0.000
#> SRR390542 2 0.1184 0.991 0.016 0.984
#> SRR390543 2 0.1184 0.991 0.016 0.984
#> SRR390544 2 0.1184 0.991 0.016 0.984
#> SRR390545 2 0.1184 0.991 0.016 0.984
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 3 0.6215 0.2580 0.428 0.000 0.572
#> SRR390471 3 0.5216 0.5598 0.260 0.000 0.740
#> SRR390472 3 0.6031 0.7138 0.096 0.116 0.788
#> SRR390473 3 0.6031 0.7138 0.096 0.116 0.788
#> SRR390474 3 0.7333 0.7156 0.180 0.116 0.704
#> SRR390475 1 0.6307 -0.1159 0.512 0.000 0.488
#> SRR390476 1 0.5948 0.3595 0.640 0.000 0.360
#> SRR390477 1 0.0424 0.7694 0.992 0.000 0.008
#> SRR390478 1 0.0424 0.7694 0.992 0.000 0.008
#> SRR390480 3 0.6244 0.3414 0.440 0.000 0.560
#> SRR390481 3 0.5706 0.6100 0.320 0.000 0.680
#> SRR390482 3 0.6949 0.6997 0.156 0.112 0.732
#> SRR390483 3 0.7016 0.7033 0.156 0.116 0.728
#> SRR390484 3 0.3682 0.6863 0.008 0.116 0.876
#> SRR390485 3 0.3682 0.6863 0.008 0.116 0.876
#> SRR390486 3 0.5793 0.7192 0.084 0.116 0.800
#> SRR390487 3 0.5793 0.7192 0.084 0.116 0.800
#> SRR390488 3 0.4830 0.7237 0.084 0.068 0.848
#> SRR390489 3 0.5650 0.7215 0.084 0.108 0.808
#> SRR390492 3 0.6910 0.7003 0.144 0.120 0.736
#> SRR390493 3 0.6910 0.7003 0.144 0.120 0.736
#> SRR390494 3 0.4002 0.6886 0.160 0.000 0.840
#> SRR390495 3 0.5201 0.6282 0.236 0.004 0.760
#> SRR390496 3 0.5201 0.6282 0.236 0.004 0.760
#> SRR390497 3 0.3682 0.6863 0.008 0.116 0.876
#> SRR390498 2 0.2584 0.9335 0.008 0.928 0.064
#> SRR390499 3 0.5706 0.6100 0.320 0.000 0.680
#> SRR390500 3 0.5650 0.6146 0.312 0.000 0.688
#> SRR390501 1 0.6192 -0.1036 0.580 0.000 0.420
#> SRR390502 3 0.6045 0.4821 0.380 0.000 0.620
#> SRR390503 3 0.5793 0.7192 0.084 0.116 0.800
#> SRR390504 3 0.5538 0.7111 0.072 0.116 0.812
#> SRR390505 1 0.5625 0.6623 0.808 0.116 0.076
#> SRR390506 1 0.5625 0.6623 0.808 0.116 0.076
#> SRR390507 2 0.0592 0.9812 0.000 0.988 0.012
#> SRR390508 2 0.0592 0.9812 0.000 0.988 0.012
#> SRR390509 2 0.0592 0.9812 0.000 0.988 0.012
#> SRR390510 2 0.0592 0.9812 0.000 0.988 0.012
#> SRR390512 2 0.0000 0.9829 0.000 1.000 0.000
#> SRR390513 2 0.0000 0.9829 0.000 1.000 0.000
#> SRR390514 2 0.0000 0.9829 0.000 1.000 0.000
#> SRR390515 1 0.5625 0.6623 0.808 0.116 0.076
#> SRR390516 3 0.5793 0.7192 0.084 0.116 0.800
#> SRR390517 2 0.2584 0.9335 0.008 0.928 0.064
#> SRR390519 3 0.3267 0.6915 0.000 0.116 0.884
#> SRR390520 3 0.5793 0.7192 0.084 0.116 0.800
#> SRR390521 3 0.5591 0.6278 0.304 0.000 0.696
#> SRR390522 3 0.5591 0.6278 0.304 0.000 0.696
#> SRR390523 3 0.5591 0.6278 0.304 0.000 0.696
#> SRR390524 1 0.0424 0.7694 0.992 0.000 0.008
#> SRR390525 1 0.0424 0.7694 0.992 0.000 0.008
#> SRR390526 1 0.0424 0.7694 0.992 0.000 0.008
#> SRR390527 1 0.0424 0.7694 0.992 0.000 0.008
#> SRR390528 1 0.6843 0.6149 0.740 0.116 0.144
#> SRR390529 1 0.8765 0.2112 0.504 0.116 0.380
#> SRR390530 1 0.2356 0.7436 0.928 0.000 0.072
#> SRR390531 1 0.0424 0.7694 0.992 0.000 0.008
#> SRR390532 3 0.7232 0.6879 0.172 0.116 0.712
#> SRR390533 3 0.4002 0.6848 0.160 0.000 0.840
#> SRR390534 3 0.4121 0.6851 0.168 0.000 0.832
#> SRR390535 1 0.6295 -0.0672 0.528 0.000 0.472
#> SRR390536 3 0.5201 0.6282 0.236 0.004 0.760
#> SRR390537 3 0.5201 0.6282 0.236 0.004 0.760
#> SRR390538 1 0.3551 0.6885 0.868 0.000 0.132
#> SRR390539 1 0.0424 0.7694 0.992 0.000 0.008
#> SRR390540 1 0.5098 0.5890 0.752 0.000 0.248
#> SRR390541 1 0.0424 0.7694 0.992 0.000 0.008
#> SRR390542 2 0.0000 0.9829 0.000 1.000 0.000
#> SRR390543 2 0.0000 0.9829 0.000 1.000 0.000
#> SRR390544 2 0.0000 0.9829 0.000 1.000 0.000
#> SRR390545 2 0.0000 0.9829 0.000 1.000 0.000
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 4 0.6819 0.2815 0.208 0.000 0.188 0.604
#> SRR390471 4 0.4875 0.5363 0.068 0.000 0.160 0.772
#> SRR390472 3 0.7912 0.5205 0.336 0.000 0.356 0.308
#> SRR390473 3 0.7916 0.5048 0.324 0.000 0.356 0.320
#> SRR390474 4 0.7846 -0.3873 0.300 0.000 0.296 0.404
#> SRR390475 4 0.7171 0.1726 0.232 0.000 0.212 0.556
#> SRR390476 4 0.7357 0.0927 0.260 0.000 0.216 0.524
#> SRR390477 1 0.4925 0.7303 0.572 0.000 0.428 0.000
#> SRR390478 1 0.4925 0.7303 0.572 0.000 0.428 0.000
#> SRR390480 4 0.0657 0.6311 0.012 0.000 0.004 0.984
#> SRR390481 4 0.0376 0.6322 0.004 0.000 0.004 0.992
#> SRR390482 4 0.4814 0.2870 0.316 0.000 0.008 0.676
#> SRR390483 4 0.7657 -0.2446 0.280 0.000 0.256 0.464
#> SRR390484 3 0.5959 0.6958 0.388 0.000 0.568 0.044
#> SRR390485 3 0.5959 0.6958 0.388 0.000 0.568 0.044
#> SRR390486 3 0.7921 0.4872 0.320 0.000 0.348 0.332
#> SRR390487 3 0.7917 0.4707 0.312 0.000 0.348 0.340
#> SRR390488 4 0.7715 -0.3121 0.240 0.000 0.324 0.436
#> SRR390489 4 0.7732 -0.3226 0.244 0.000 0.324 0.432
#> SRR390492 4 0.7658 -0.2661 0.308 0.000 0.236 0.456
#> SRR390493 4 0.7658 -0.2661 0.308 0.000 0.236 0.456
#> SRR390494 4 0.5375 0.4111 0.116 0.000 0.140 0.744
#> SRR390495 4 0.0376 0.6315 0.004 0.000 0.004 0.992
#> SRR390496 4 0.0376 0.6315 0.004 0.000 0.004 0.992
#> SRR390497 3 0.5959 0.6958 0.388 0.000 0.568 0.044
#> SRR390498 2 0.5636 0.3059 0.424 0.552 0.024 0.000
#> SRR390499 4 0.0376 0.6322 0.004 0.000 0.004 0.992
#> SRR390500 4 0.0376 0.6322 0.004 0.000 0.004 0.992
#> SRR390501 4 0.6693 0.1334 0.088 0.000 0.424 0.488
#> SRR390502 4 0.5389 0.4528 0.032 0.000 0.308 0.660
#> SRR390503 3 0.6443 0.6923 0.376 0.000 0.548 0.076
#> SRR390504 3 0.5959 0.6958 0.388 0.000 0.568 0.044
#> SRR390505 1 0.0000 0.3590 1.000 0.000 0.000 0.000
#> SRR390506 1 0.0469 0.3426 0.988 0.000 0.012 0.000
#> SRR390507 2 0.0188 0.9175 0.004 0.996 0.000 0.000
#> SRR390508 2 0.0188 0.9175 0.004 0.996 0.000 0.000
#> SRR390509 2 0.0188 0.9175 0.004 0.996 0.000 0.000
#> SRR390510 2 0.0188 0.9175 0.004 0.996 0.000 0.000
#> SRR390512 2 0.0000 0.9183 0.000 1.000 0.000 0.000
#> SRR390513 2 0.0000 0.9183 0.000 1.000 0.000 0.000
#> SRR390514 2 0.0000 0.9183 0.000 1.000 0.000 0.000
#> SRR390515 1 0.0000 0.3590 1.000 0.000 0.000 0.000
#> SRR390516 1 0.7872 -0.7193 0.376 0.000 0.344 0.280
#> SRR390517 2 0.5636 0.3059 0.424 0.552 0.024 0.000
#> SRR390519 3 0.6337 0.6954 0.380 0.000 0.552 0.068
#> SRR390520 1 0.7910 -0.7170 0.352 0.000 0.344 0.304
#> SRR390521 4 0.0188 0.6313 0.004 0.000 0.000 0.996
#> SRR390522 4 0.0188 0.6313 0.004 0.000 0.000 0.996
#> SRR390523 4 0.0188 0.6313 0.004 0.000 0.000 0.996
#> SRR390524 1 0.4925 0.7303 0.572 0.000 0.428 0.000
#> SRR390525 1 0.4925 0.7303 0.572 0.000 0.428 0.000
#> SRR390526 1 0.4925 0.7303 0.572 0.000 0.428 0.000
#> SRR390527 1 0.4925 0.7303 0.572 0.000 0.428 0.000
#> SRR390528 1 0.1890 0.3849 0.936 0.000 0.056 0.008
#> SRR390529 1 0.3760 0.1383 0.836 0.000 0.028 0.136
#> SRR390530 1 0.4925 0.7303 0.572 0.000 0.428 0.000
#> SRR390531 1 0.4925 0.7303 0.572 0.000 0.428 0.000
#> SRR390532 4 0.5125 0.1704 0.388 0.000 0.008 0.604
#> SRR390533 4 0.3831 0.4768 0.004 0.000 0.204 0.792
#> SRR390534 4 0.3710 0.4911 0.004 0.000 0.192 0.804
#> SRR390535 3 0.7595 -0.4143 0.200 0.000 0.428 0.372
#> SRR390536 4 0.0524 0.6305 0.008 0.000 0.004 0.988
#> SRR390537 4 0.0376 0.6315 0.004 0.000 0.004 0.992
#> SRR390538 1 0.5756 0.7013 0.568 0.000 0.400 0.032
#> SRR390539 1 0.4925 0.7303 0.572 0.000 0.428 0.000
#> SRR390540 1 0.5345 0.7219 0.560 0.000 0.428 0.012
#> SRR390541 1 0.4925 0.7303 0.572 0.000 0.428 0.000
#> SRR390542 2 0.0000 0.9183 0.000 1.000 0.000 0.000
#> SRR390543 2 0.0000 0.9183 0.000 1.000 0.000 0.000
#> SRR390544 2 0.0000 0.9183 0.000 1.000 0.000 0.000
#> SRR390545 2 0.0000 0.9183 0.000 1.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 4 0.8429 -0.16873 0.284 0.000 0.248 0.312 0.156
#> SRR390471 4 0.8403 -0.08429 0.240 0.000 0.292 0.316 0.152
#> SRR390472 3 0.0955 0.48363 0.000 0.000 0.968 0.028 0.004
#> SRR390473 3 0.0955 0.48363 0.000 0.000 0.968 0.028 0.004
#> SRR390474 3 0.4366 0.54900 0.000 0.000 0.664 0.320 0.016
#> SRR390475 1 0.7200 0.31019 0.484 0.000 0.148 0.312 0.056
#> SRR390476 1 0.7078 0.35622 0.504 0.000 0.120 0.312 0.064
#> SRR390477 1 0.0290 0.72971 0.992 0.000 0.000 0.000 0.008
#> SRR390478 1 0.0703 0.72895 0.976 0.000 0.000 0.000 0.024
#> SRR390480 4 0.4162 0.59251 0.176 0.000 0.056 0.768 0.000
#> SRR390481 4 0.2754 0.68947 0.080 0.000 0.040 0.880 0.000
#> SRR390482 3 0.7809 0.38965 0.100 0.000 0.400 0.340 0.160
#> SRR390483 3 0.5945 0.48545 0.020 0.000 0.552 0.360 0.068
#> SRR390484 5 0.4746 0.42395 0.000 0.000 0.480 0.016 0.504
#> SRR390485 5 0.4307 0.43984 0.000 0.000 0.496 0.000 0.504
#> SRR390486 3 0.2280 0.56680 0.000 0.000 0.880 0.120 0.000
#> SRR390487 3 0.2891 0.59401 0.000 0.000 0.824 0.176 0.000
#> SRR390488 3 0.5375 0.26955 0.004 0.000 0.500 0.452 0.044
#> SRR390489 3 0.5453 0.34100 0.008 0.000 0.528 0.420 0.044
#> SRR390492 3 0.6703 0.51640 0.068 0.000 0.560 0.284 0.088
#> SRR390493 3 0.6703 0.51640 0.068 0.000 0.560 0.284 0.088
#> SRR390494 3 0.6264 0.40700 0.024 0.000 0.484 0.412 0.080
#> SRR390495 4 0.1549 0.71758 0.016 0.000 0.040 0.944 0.000
#> SRR390496 4 0.0963 0.71457 0.000 0.000 0.036 0.964 0.000
#> SRR390497 5 0.4827 0.41635 0.000 0.000 0.476 0.020 0.504
#> SRR390498 5 0.4210 -0.00767 0.000 0.412 0.000 0.000 0.588
#> SRR390499 4 0.1750 0.71731 0.028 0.000 0.036 0.936 0.000
#> SRR390500 4 0.2426 0.69661 0.064 0.000 0.036 0.900 0.000
#> SRR390501 1 0.6655 0.60421 0.624 0.000 0.136 0.140 0.100
#> SRR390502 1 0.7369 0.01846 0.400 0.000 0.188 0.368 0.044
#> SRR390503 3 0.5260 0.23549 0.000 0.000 0.648 0.088 0.264
#> SRR390504 5 0.4307 0.43984 0.000 0.000 0.496 0.000 0.504
#> SRR390505 1 0.6581 0.12915 0.456 0.000 0.228 0.000 0.316
#> SRR390506 5 0.5979 -0.02587 0.360 0.000 0.120 0.000 0.520
#> SRR390507 2 0.1732 0.94253 0.000 0.920 0.000 0.000 0.080
#> SRR390508 2 0.1732 0.94253 0.000 0.920 0.000 0.000 0.080
#> SRR390509 2 0.1732 0.94253 0.000 0.920 0.000 0.000 0.080
#> SRR390510 2 0.1732 0.94253 0.000 0.920 0.000 0.000 0.080
#> SRR390512 2 0.0000 0.96785 0.000 1.000 0.000 0.000 0.000
#> SRR390513 2 0.0000 0.96785 0.000 1.000 0.000 0.000 0.000
#> SRR390514 2 0.0000 0.96785 0.000 1.000 0.000 0.000 0.000
#> SRR390515 1 0.6764 0.02239 0.400 0.000 0.292 0.000 0.308
#> SRR390516 3 0.5574 0.52381 0.012 0.000 0.676 0.164 0.148
#> SRR390517 5 0.4210 -0.00767 0.000 0.412 0.000 0.000 0.588
#> SRR390519 3 0.5334 -0.30500 0.000 0.000 0.512 0.052 0.436
#> SRR390520 3 0.3849 0.53182 0.000 0.000 0.808 0.112 0.080
#> SRR390521 4 0.2069 0.71095 0.012 0.000 0.076 0.912 0.000
#> SRR390522 4 0.2110 0.71428 0.016 0.000 0.072 0.912 0.000
#> SRR390523 4 0.1956 0.70773 0.008 0.000 0.076 0.916 0.000
#> SRR390524 1 0.1121 0.71862 0.956 0.000 0.000 0.000 0.044
#> SRR390525 1 0.0404 0.72898 0.988 0.000 0.000 0.000 0.012
#> SRR390526 1 0.1608 0.71732 0.928 0.000 0.000 0.000 0.072
#> SRR390527 1 0.1704 0.71930 0.928 0.000 0.004 0.000 0.068
#> SRR390528 1 0.6728 0.22178 0.476 0.000 0.212 0.008 0.304
#> SRR390529 3 0.7575 -0.02669 0.188 0.000 0.424 0.064 0.324
#> SRR390530 1 0.1331 0.72743 0.952 0.000 0.008 0.000 0.040
#> SRR390531 1 0.1341 0.72127 0.944 0.000 0.000 0.000 0.056
#> SRR390532 4 0.8133 -0.40162 0.100 0.000 0.304 0.336 0.260
#> SRR390533 4 0.3757 0.49354 0.000 0.000 0.208 0.772 0.020
#> SRR390534 4 0.3757 0.49354 0.000 0.000 0.208 0.772 0.020
#> SRR390535 1 0.4996 0.66838 0.760 0.000 0.048 0.092 0.100
#> SRR390536 4 0.1121 0.71169 0.000 0.000 0.044 0.956 0.000
#> SRR390537 4 0.0963 0.71457 0.000 0.000 0.036 0.964 0.000
#> SRR390538 1 0.6812 0.54444 0.596 0.000 0.176 0.076 0.152
#> SRR390539 1 0.1646 0.72606 0.944 0.000 0.004 0.032 0.020
#> SRR390540 1 0.3724 0.69868 0.844 0.000 0.036 0.068 0.052
#> SRR390541 1 0.0510 0.73038 0.984 0.000 0.000 0.000 0.016
#> SRR390542 2 0.0000 0.96785 0.000 1.000 0.000 0.000 0.000
#> SRR390543 2 0.0000 0.96785 0.000 1.000 0.000 0.000 0.000
#> SRR390544 2 0.0000 0.96785 0.000 1.000 0.000 0.000 0.000
#> SRR390545 2 0.0000 0.96785 0.000 1.000 0.000 0.000 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 4 0.8052 0.3412 0.156 0.000 0.112 0.448 0.112 0.172
#> SRR390471 4 0.8276 0.3217 0.136 0.000 0.212 0.404 0.112 0.136
#> SRR390472 3 0.4952 0.4180 0.000 0.000 0.620 0.012 0.304 0.064
#> SRR390473 3 0.4720 0.4360 0.000 0.000 0.640 0.012 0.300 0.048
#> SRR390474 3 0.4282 0.6172 0.000 0.000 0.656 0.304 0.040 0.000
#> SRR390475 4 0.7575 0.2751 0.268 0.000 0.084 0.448 0.052 0.148
#> SRR390476 4 0.7430 0.2519 0.292 0.000 0.068 0.444 0.048 0.148
#> SRR390477 1 0.0000 0.7318 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390478 1 0.0146 0.7308 0.996 0.000 0.000 0.000 0.004 0.000
#> SRR390480 4 0.1531 0.7114 0.068 0.000 0.004 0.928 0.000 0.000
#> SRR390481 4 0.1010 0.7135 0.036 0.000 0.004 0.960 0.000 0.000
#> SRR390482 3 0.6906 0.1031 0.036 0.000 0.396 0.360 0.016 0.192
#> SRR390483 3 0.3584 0.5894 0.004 0.000 0.688 0.308 0.000 0.000
#> SRR390484 5 0.1204 0.8982 0.000 0.000 0.056 0.000 0.944 0.000
#> SRR390485 5 0.1204 0.8982 0.000 0.000 0.056 0.000 0.944 0.000
#> SRR390486 3 0.3481 0.5808 0.000 0.000 0.792 0.048 0.160 0.000
#> SRR390487 3 0.4174 0.5973 0.000 0.000 0.736 0.092 0.172 0.000
#> SRR390488 3 0.4468 0.5908 0.000 0.000 0.720 0.184 0.088 0.008
#> SRR390489 3 0.4468 0.5908 0.000 0.000 0.720 0.184 0.088 0.008
#> SRR390492 3 0.4628 0.5797 0.012 0.000 0.704 0.216 0.004 0.064
#> SRR390493 3 0.4708 0.5796 0.012 0.000 0.704 0.212 0.008 0.064
#> SRR390494 3 0.4558 0.5410 0.008 0.000 0.612 0.348 0.032 0.000
#> SRR390495 4 0.1167 0.7004 0.008 0.000 0.012 0.960 0.000 0.020
#> SRR390496 4 0.1138 0.6967 0.004 0.000 0.012 0.960 0.000 0.024
#> SRR390497 5 0.1204 0.8982 0.000 0.000 0.056 0.000 0.944 0.000
#> SRR390498 6 0.4197 0.3534 0.000 0.284 0.004 0.000 0.032 0.680
#> SRR390499 4 0.0937 0.7138 0.040 0.000 0.000 0.960 0.000 0.000
#> SRR390500 4 0.0935 0.7128 0.032 0.000 0.004 0.964 0.000 0.000
#> SRR390501 1 0.7518 0.4131 0.516 0.000 0.092 0.144 0.088 0.160
#> SRR390502 4 0.6368 0.5221 0.204 0.000 0.120 0.596 0.052 0.028
#> SRR390503 3 0.6379 0.2332 0.000 0.000 0.460 0.040 0.344 0.156
#> SRR390504 5 0.1267 0.8958 0.000 0.000 0.060 0.000 0.940 0.000
#> SRR390505 1 0.6409 -0.0154 0.488 0.000 0.040 0.004 0.148 0.320
#> SRR390506 6 0.6236 0.1971 0.312 0.000 0.028 0.004 0.152 0.504
#> SRR390507 2 0.2969 0.7996 0.000 0.776 0.000 0.000 0.000 0.224
#> SRR390508 2 0.2969 0.7996 0.000 0.776 0.000 0.000 0.000 0.224
#> SRR390509 2 0.2969 0.7996 0.000 0.776 0.000 0.000 0.000 0.224
#> SRR390510 2 0.2969 0.7996 0.000 0.776 0.000 0.000 0.000 0.224
#> SRR390512 2 0.0000 0.8957 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390513 2 0.0000 0.8957 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390514 2 0.0000 0.8957 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390515 1 0.7428 -0.2017 0.404 0.000 0.164 0.004 0.160 0.268
#> SRR390516 3 0.5720 0.4797 0.000 0.000 0.636 0.056 0.144 0.164
#> SRR390517 6 0.4197 0.3534 0.000 0.284 0.004 0.000 0.032 0.680
#> SRR390519 5 0.5520 0.5186 0.000 0.000 0.168 0.036 0.644 0.152
#> SRR390520 3 0.5667 0.4847 0.000 0.000 0.640 0.052 0.160 0.148
#> SRR390521 4 0.3065 0.6710 0.100 0.000 0.052 0.844 0.000 0.004
#> SRR390522 4 0.2800 0.6813 0.100 0.000 0.036 0.860 0.000 0.004
#> SRR390523 4 0.1956 0.6716 0.008 0.000 0.080 0.908 0.000 0.004
#> SRR390524 1 0.0146 0.7318 0.996 0.000 0.000 0.000 0.000 0.004
#> SRR390525 1 0.0000 0.7318 1.000 0.000 0.000 0.000 0.000 0.000
#> SRR390526 1 0.1235 0.7292 0.960 0.000 0.008 0.008 0.016 0.008
#> SRR390527 1 0.1337 0.7290 0.956 0.000 0.008 0.008 0.016 0.012
#> SRR390528 1 0.6146 0.3291 0.608 0.000 0.120 0.016 0.052 0.204
#> SRR390529 6 0.8311 0.1135 0.096 0.000 0.236 0.116 0.176 0.376
#> SRR390530 1 0.1317 0.7297 0.956 0.000 0.004 0.008 0.016 0.016
#> SRR390531 1 0.0976 0.7300 0.968 0.000 0.008 0.008 0.016 0.000
#> SRR390532 4 0.7376 -0.0958 0.036 0.000 0.296 0.360 0.036 0.272
#> SRR390533 3 0.4113 0.5343 0.000 0.000 0.668 0.308 0.016 0.008
#> SRR390534 3 0.4130 0.5367 0.000 0.000 0.664 0.312 0.016 0.008
#> SRR390535 1 0.6417 0.1950 0.508 0.000 0.024 0.308 0.020 0.140
#> SRR390536 4 0.1237 0.6969 0.004 0.000 0.020 0.956 0.000 0.020
#> SRR390537 4 0.1065 0.7015 0.008 0.000 0.008 0.964 0.000 0.020
#> SRR390538 1 0.6935 0.4660 0.564 0.000 0.100 0.044 0.108 0.184
#> SRR390539 1 0.2487 0.6953 0.892 0.000 0.068 0.004 0.028 0.008
#> SRR390540 1 0.6722 0.4124 0.560 0.000 0.068 0.188 0.024 0.160
#> SRR390541 1 0.0964 0.7268 0.968 0.000 0.012 0.004 0.016 0.000
#> SRR390542 2 0.0000 0.8957 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390543 2 0.0000 0.8957 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390544 2 0.0000 0.8957 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390545 2 0.0000 0.8957 0.000 1.000 0.000 0.000 0.000 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
ATC:NMF**
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"]
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 15244 rows and 71 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:
- The first row: a plot of the ECDF (empirical cumulative distribution
function) curves of the consensus matrix for each
k
and the heatmap of
predicted classes for each k
.
- The second row: heatmaps of the consensus matrix for each
k
.
- The third row: heatmaps of the membership matrix for each
k
.
- The fouth row: heatmaps of the signatures for each
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:
- ECDF curves of the consensus matrix for each
k
;
- 1-PAC. The PAC
score
measures the proportion of the ambiguous subgrouping.
- Mean silhouette score.
- Concordance. The mean probability of fiting the consensus class ids in all
partitions.
- Area increased. Denote \(A_k\) as the area under the ECDF curve for current
k
, the area increased is defined as \(A_k - A_{k-1}\).
- Rand index. The percent of pairs of samples that are both in a same cluster
or both are not in a same cluster in the partition of k and k-1.
- Jaccard index. The ratio of pairs of samples are both in a same cluster in
the partition of k and k-1 and the pairs of samples are both in a same
cluster in the partition k or 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.856 0.901 0.959 0.4375 0.556 0.556
#> 3 3 0.971 0.924 0.965 0.4595 0.707 0.514
#> 4 4 0.866 0.847 0.921 0.1563 0.775 0.464
#> 5 5 0.749 0.665 0.810 0.0719 0.912 0.685
#> 6 6 0.751 0.618 0.772 0.0376 0.953 0.785
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
- All \(k\) with Jaccard index larger than 0.95 are removed because increasing
\(k\) does not provide enough extra information. If all \(k\) are removed, it is
marked as no subgroup is detected.
- For all \(k\) with 1-PAC score larger than 0.9, the maximal \(k\) is taken as
the best \(k\), and other \(k\) are marked as optional \(k\).
- If it does not fit the second rule. The \(k\) with the maximal vote of the
highest 1-PAC score, highest mean silhouette, and highest concordance is
taken as the best \(k\).
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.
show/hide code output
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> SRR390470 1 0.0000 0.9711 1.000 0.000
#> SRR390471 1 0.0000 0.9711 1.000 0.000
#> SRR390472 2 0.0000 0.9180 0.000 1.000
#> SRR390473 2 0.0000 0.9180 0.000 1.000
#> SRR390474 1 0.4022 0.8931 0.920 0.080
#> SRR390475 1 0.0000 0.9711 1.000 0.000
#> SRR390476 1 0.0000 0.9711 1.000 0.000
#> SRR390477 1 0.0000 0.9711 1.000 0.000
#> SRR390478 1 0.0000 0.9711 1.000 0.000
#> SRR390480 1 0.0000 0.9711 1.000 0.000
#> SRR390481 1 0.0000 0.9711 1.000 0.000
#> SRR390482 1 0.1414 0.9556 0.980 0.020
#> SRR390483 1 0.1633 0.9521 0.976 0.024
#> SRR390484 2 0.0000 0.9180 0.000 1.000
#> SRR390485 2 0.0000 0.9180 0.000 1.000
#> SRR390486 2 0.0000 0.9180 0.000 1.000
#> SRR390487 2 0.0000 0.9180 0.000 1.000
#> SRR390488 1 0.0000 0.9711 1.000 0.000
#> SRR390489 1 0.1184 0.9593 0.984 0.016
#> SRR390492 2 0.0376 0.9158 0.004 0.996
#> SRR390493 2 0.0000 0.9180 0.000 1.000
#> SRR390494 1 0.0000 0.9711 1.000 0.000
#> SRR390495 1 0.0000 0.9711 1.000 0.000
#> SRR390496 1 0.0000 0.9711 1.000 0.000
#> SRR390497 2 0.0000 0.9180 0.000 1.000
#> SRR390498 2 0.0000 0.9180 0.000 1.000
#> SRR390499 1 0.0000 0.9711 1.000 0.000
#> SRR390500 1 0.0000 0.9711 1.000 0.000
#> SRR390501 1 0.0000 0.9711 1.000 0.000
#> SRR390502 1 0.0000 0.9711 1.000 0.000
#> SRR390503 2 0.0000 0.9180 0.000 1.000
#> SRR390504 2 0.0000 0.9180 0.000 1.000
#> SRR390505 1 0.9323 0.4288 0.652 0.348
#> SRR390506 2 0.0000 0.9180 0.000 1.000
#> SRR390507 2 0.8081 0.6967 0.248 0.752
#> SRR390508 2 0.7376 0.7517 0.208 0.792
#> SRR390509 2 0.7299 0.7564 0.204 0.796
#> SRR390510 2 0.7056 0.7694 0.192 0.808
#> SRR390512 1 0.0000 0.9711 1.000 0.000
#> SRR390513 1 0.0000 0.9711 1.000 0.000
#> SRR390514 1 0.0000 0.9711 1.000 0.000
#> SRR390515 1 0.9775 0.2352 0.588 0.412
#> SRR390516 2 0.0000 0.9180 0.000 1.000
#> SRR390517 2 0.0000 0.9180 0.000 1.000
#> SRR390519 2 0.0000 0.9180 0.000 1.000
#> SRR390520 2 0.0000 0.9180 0.000 1.000
#> SRR390521 1 0.0000 0.9711 1.000 0.000
#> SRR390522 1 0.0000 0.9711 1.000 0.000
#> SRR390523 1 0.0000 0.9711 1.000 0.000
#> SRR390524 1 0.0000 0.9711 1.000 0.000
#> SRR390525 1 0.0000 0.9711 1.000 0.000
#> SRR390526 1 0.0000 0.9711 1.000 0.000
#> SRR390527 1 0.0000 0.9711 1.000 0.000
#> SRR390528 1 0.0000 0.9711 1.000 0.000
#> SRR390529 2 0.9358 0.4740 0.352 0.648
#> SRR390530 1 0.0000 0.9711 1.000 0.000
#> SRR390531 1 0.0000 0.9711 1.000 0.000
#> SRR390532 2 1.0000 0.0538 0.500 0.500
#> SRR390533 1 0.0000 0.9711 1.000 0.000
#> SRR390534 1 0.0000 0.9711 1.000 0.000
#> SRR390535 1 0.0000 0.9711 1.000 0.000
#> SRR390536 1 0.0000 0.9711 1.000 0.000
#> SRR390537 1 0.0000 0.9711 1.000 0.000
#> SRR390538 1 0.0000 0.9711 1.000 0.000
#> SRR390539 1 0.0000 0.9711 1.000 0.000
#> SRR390540 1 0.0000 0.9711 1.000 0.000
#> SRR390541 1 0.0000 0.9711 1.000 0.000
#> SRR390542 1 0.6623 0.7693 0.828 0.172
#> SRR390543 1 0.4022 0.8937 0.920 0.080
#> SRR390544 1 0.2043 0.9443 0.968 0.032
#> SRR390545 1 0.2603 0.9327 0.956 0.044
show/hide code output
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> SRR390470 1 0.0237 0.980 0.996 0.000 0.004
#> SRR390471 1 0.0747 0.976 0.984 0.000 0.016
#> SRR390472 3 0.0237 0.903 0.004 0.000 0.996
#> SRR390473 3 0.0237 0.903 0.004 0.000 0.996
#> SRR390474 1 0.6057 0.425 0.656 0.004 0.340
#> SRR390475 1 0.0237 0.980 0.996 0.004 0.000
#> SRR390476 1 0.0000 0.980 1.000 0.000 0.000
#> SRR390477 1 0.0747 0.976 0.984 0.000 0.016
#> SRR390478 1 0.0592 0.977 0.988 0.000 0.012
#> SRR390480 1 0.0237 0.980 0.996 0.004 0.000
#> SRR390481 1 0.0237 0.980 0.996 0.004 0.000
#> SRR390482 3 0.6148 0.494 0.356 0.004 0.640
#> SRR390483 3 0.6603 0.535 0.332 0.020 0.648
#> SRR390484 3 0.0747 0.899 0.000 0.016 0.984
#> SRR390485 3 0.0747 0.899 0.000 0.016 0.984
#> SRR390486 3 0.0237 0.903 0.004 0.000 0.996
#> SRR390487 3 0.0000 0.903 0.000 0.000 1.000
#> SRR390488 1 0.0747 0.976 0.984 0.000 0.016
#> SRR390489 1 0.0892 0.973 0.980 0.000 0.020
#> SRR390492 2 0.0237 0.972 0.000 0.996 0.004
#> SRR390493 2 0.0237 0.972 0.000 0.996 0.004
#> SRR390494 2 0.2165 0.918 0.064 0.936 0.000
#> SRR390495 2 0.0747 0.971 0.016 0.984 0.000
#> SRR390496 2 0.1031 0.964 0.024 0.976 0.000
#> SRR390497 3 0.0747 0.899 0.000 0.016 0.984
#> SRR390498 3 0.1753 0.879 0.000 0.048 0.952
#> SRR390499 1 0.0237 0.980 0.996 0.004 0.000
#> SRR390500 1 0.0237 0.980 0.996 0.004 0.000
#> SRR390501 1 0.0237 0.980 0.996 0.004 0.000
#> SRR390502 1 0.0237 0.980 0.996 0.004 0.000
#> SRR390503 3 0.0000 0.903 0.000 0.000 1.000
#> SRR390504 3 0.0424 0.901 0.000 0.008 0.992
#> SRR390505 1 0.0892 0.973 0.980 0.000 0.020
#> SRR390506 3 0.0237 0.903 0.004 0.000 0.996
#> SRR390507 2 0.0237 0.972 0.000 0.996 0.004
#> SRR390508 2 0.0237 0.972 0.000 0.996 0.004
#> SRR390509 2 0.0237 0.972 0.000 0.996 0.004
#> SRR390510 2 0.0237 0.972 0.000 0.996 0.004
#> SRR390512 2 0.0747 0.971 0.016 0.984 0.000
#> SRR390513 2 0.0747 0.971 0.016 0.984 0.000
#> SRR390514 2 0.0747 0.971 0.016 0.984 0.000
#> SRR390515 1 0.0892 0.973 0.980 0.000 0.020
#> SRR390516 3 0.0237 0.903 0.004 0.000 0.996
#> SRR390517 2 0.4842 0.697 0.000 0.776 0.224
#> SRR390519 3 0.0747 0.899 0.000 0.016 0.984
#> SRR390520 3 0.0237 0.903 0.004 0.000 0.996
#> SRR390521 1 0.0237 0.980 0.996 0.004 0.000
#> SRR390522 1 0.0237 0.980 0.996 0.004 0.000
#> SRR390523 1 0.0237 0.980 0.996 0.004 0.000
#> SRR390524 1 0.0747 0.976 0.984 0.000 0.016
#> SRR390525 1 0.0747 0.976 0.984 0.000 0.016
#> SRR390526 1 0.0237 0.980 0.996 0.000 0.004
#> SRR390527 1 0.0000 0.980 1.000 0.000 0.000
#> SRR390528 1 0.0237 0.980 0.996 0.004 0.000
#> SRR390529 3 0.6026 0.430 0.376 0.000 0.624
#> SRR390530 1 0.0747 0.976 0.984 0.000 0.016
#> SRR390531 1 0.0747 0.976 0.984 0.000 0.016
#> SRR390532 3 0.4682 0.715 0.004 0.192 0.804
#> SRR390533 1 0.0237 0.980 0.996 0.000 0.004
#> SRR390534 1 0.0237 0.980 0.996 0.000 0.004
#> SRR390535 1 0.0237 0.980 0.996 0.004 0.000
#> SRR390536 2 0.0747 0.971 0.016 0.984 0.000
#> SRR390537 2 0.0747 0.971 0.016 0.984 0.000
#> SRR390538 1 0.0237 0.980 0.996 0.000 0.004
#> SRR390539 1 0.0237 0.980 0.996 0.004 0.000
#> SRR390540 1 0.0237 0.980 0.996 0.004 0.000
#> SRR390541 1 0.0237 0.980 0.996 0.004 0.000
#> SRR390542 2 0.0000 0.973 0.000 1.000 0.000
#> SRR390543 2 0.0000 0.973 0.000 1.000 0.000
#> SRR390544 2 0.0237 0.973 0.004 0.996 0.000
#> SRR390545 2 0.0000 0.973 0.000 1.000 0.000
show/hide code output
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> SRR390470 1 0.0817 0.9236 0.976 0.000 0.000 0.024
#> SRR390471 1 0.0469 0.9160 0.988 0.000 0.000 0.012
#> SRR390472 3 0.0188 0.9440 0.000 0.000 0.996 0.004
#> SRR390473 3 0.0188 0.9440 0.000 0.000 0.996 0.004
#> SRR390474 4 0.5774 0.1901 0.028 0.000 0.464 0.508
#> SRR390475 1 0.1118 0.9200 0.964 0.000 0.000 0.036
#> SRR390476 1 0.1022 0.9216 0.968 0.000 0.000 0.032
#> SRR390477 1 0.0336 0.9177 0.992 0.000 0.000 0.008
#> SRR390478 1 0.0817 0.9236 0.976 0.000 0.000 0.024
#> SRR390480 4 0.1474 0.8773 0.052 0.000 0.000 0.948
#> SRR390481 4 0.1474 0.8773 0.052 0.000 0.000 0.948
#> SRR390482 4 0.4098 0.7370 0.012 0.000 0.204 0.784
#> SRR390483 4 0.3271 0.8050 0.012 0.000 0.132 0.856
#> SRR390484 3 0.0000 0.9458 0.000 0.000 1.000 0.000
#> SRR390485 3 0.0000 0.9458 0.000 0.000 1.000 0.000
#> SRR390486 3 0.0000 0.9458 0.000 0.000 1.000 0.000
#> SRR390487 3 0.0000 0.9458 0.000 0.000 1.000 0.000
#> SRR390488 1 0.1398 0.9025 0.956 0.000 0.004 0.040
#> SRR390489 1 0.1854 0.8950 0.940 0.000 0.012 0.048
#> SRR390492 4 0.4245 0.7299 0.000 0.020 0.196 0.784
#> SRR390493 3 0.5290 -0.1084 0.000 0.008 0.516 0.476
#> SRR390494 4 0.1771 0.8689 0.012 0.036 0.004 0.948
#> SRR390495 4 0.1743 0.8568 0.004 0.056 0.000 0.940
#> SRR390496 4 0.1706 0.8694 0.016 0.036 0.000 0.948
#> SRR390497 3 0.0000 0.9458 0.000 0.000 1.000 0.000
#> SRR390498 2 0.2654 0.8721 0.000 0.888 0.108 0.004
#> SRR390499 4 0.1474 0.8773 0.052 0.000 0.000 0.948
#> SRR390500 4 0.1474 0.8773 0.052 0.000 0.000 0.948
#> SRR390501 1 0.4356 0.6245 0.708 0.000 0.000 0.292
#> SRR390502 4 0.4996 -0.0273 0.484 0.000 0.000 0.516
#> SRR390503 3 0.0000 0.9458 0.000 0.000 1.000 0.000
#> SRR390504 3 0.0000 0.9458 0.000 0.000 1.000 0.000
#> SRR390505 1 0.1576 0.8897 0.948 0.000 0.004 0.048
#> SRR390506 3 0.2300 0.8931 0.028 0.000 0.924 0.048
#> SRR390507 2 0.0000 0.9561 0.000 1.000 0.000 0.000
#> SRR390508 2 0.0000 0.9561 0.000 1.000 0.000 0.000
#> SRR390509 2 0.0000 0.9561 0.000 1.000 0.000 0.000
#> SRR390510 2 0.0000 0.9561 0.000 1.000 0.000 0.000
#> SRR390512 2 0.2281 0.9098 0.000 0.904 0.000 0.096
#> SRR390513 2 0.2281 0.9098 0.000 0.904 0.000 0.096
#> SRR390514 2 0.2281 0.9098 0.000 0.904 0.000 0.096
#> SRR390515 1 0.1576 0.8897 0.948 0.000 0.004 0.048
#> SRR390516 3 0.2197 0.8966 0.024 0.000 0.928 0.048
#> SRR390517 2 0.2197 0.8992 0.000 0.916 0.080 0.004
#> SRR390519 3 0.0000 0.9458 0.000 0.000 1.000 0.000
#> SRR390520 3 0.0000 0.9458 0.000 0.000 1.000 0.000
#> SRR390521 4 0.1474 0.8773 0.052 0.000 0.000 0.948
#> SRR390522 4 0.1474 0.8773 0.052 0.000 0.000 0.948
#> SRR390523 4 0.1716 0.8710 0.064 0.000 0.000 0.936
#> SRR390524 1 0.0336 0.9203 0.992 0.000 0.000 0.008
#> SRR390525 1 0.0469 0.9215 0.988 0.000 0.000 0.012
#> SRR390526 1 0.0817 0.9236 0.976 0.000 0.000 0.024
#> SRR390527 1 0.0817 0.9236 0.976 0.000 0.000 0.024
#> SRR390528 4 0.1637 0.8735 0.060 0.000 0.000 0.940
#> SRR390529 1 0.2494 0.8691 0.916 0.000 0.036 0.048
#> SRR390530 1 0.0817 0.9236 0.976 0.000 0.000 0.024
#> SRR390531 1 0.0817 0.9236 0.976 0.000 0.000 0.024
#> SRR390532 4 0.4008 0.6832 0.000 0.000 0.244 0.756
#> SRR390533 1 0.3907 0.7234 0.768 0.000 0.000 0.232
#> SRR390534 1 0.3907 0.7236 0.768 0.000 0.000 0.232
#> SRR390535 1 0.4941 0.2587 0.564 0.000 0.000 0.436
#> SRR390536 4 0.1824 0.8535 0.004 0.060 0.000 0.936
#> SRR390537 4 0.1677 0.8674 0.012 0.040 0.000 0.948
#> SRR390538 1 0.0817 0.9236 0.976 0.000 0.000 0.024
#> SRR390539 1 0.1302 0.9161 0.956 0.000 0.000 0.044
#> SRR390540 1 0.2149 0.8854 0.912 0.000 0.000 0.088
#> SRR390541 1 0.1022 0.9216 0.968 0.000 0.000 0.032
#> SRR390542 2 0.0000 0.9561 0.000 1.000 0.000 0.000
#> SRR390543 2 0.0336 0.9561 0.000 0.992 0.000 0.008
#> SRR390544 2 0.0469 0.9550 0.000 0.988 0.000 0.012
#> SRR390545 2 0.0336 0.9561 0.000 0.992 0.000 0.008
show/hide code output
cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#> class entropy silhouette p1 p2 p3 p4 p5
#> SRR390470 1 0.1485 0.88213 0.948 0.000 0.032 0.020 0.000
#> SRR390471 1 0.1557 0.87795 0.940 0.000 0.052 0.008 0.000
#> SRR390472 5 0.0771 0.77066 0.004 0.000 0.020 0.000 0.976
#> SRR390473 5 0.0671 0.77049 0.004 0.000 0.016 0.000 0.980
#> SRR390474 4 0.5747 0.20634 0.000 0.000 0.088 0.504 0.408
#> SRR390475 1 0.1106 0.88934 0.964 0.000 0.012 0.024 0.000
#> SRR390476 1 0.0898 0.89021 0.972 0.000 0.008 0.020 0.000
#> SRR390477 1 0.0693 0.88874 0.980 0.000 0.008 0.012 0.000
#> SRR390478 1 0.0566 0.88918 0.984 0.000 0.004 0.012 0.000
#> SRR390480 4 0.0671 0.67984 0.016 0.000 0.004 0.980 0.000
#> SRR390481 4 0.0566 0.68092 0.012 0.000 0.004 0.984 0.000
#> SRR390482 4 0.5852 0.21386 0.000 0.000 0.104 0.524 0.372
#> SRR390483 4 0.5205 0.48195 0.000 0.000 0.104 0.672 0.224
#> SRR390484 5 0.0000 0.76826 0.000 0.000 0.000 0.000 1.000
#> SRR390485 5 0.0404 0.77083 0.000 0.000 0.012 0.000 0.988
#> SRR390486 3 0.4273 0.21620 0.000 0.000 0.552 0.000 0.448
#> SRR390487 3 0.4367 0.24368 0.000 0.000 0.580 0.004 0.416
#> SRR390488 3 0.5491 0.47065 0.244 0.000 0.664 0.020 0.072
#> SRR390489 3 0.5330 0.46787 0.248 0.000 0.668 0.012 0.072
#> SRR390492 4 0.6655 0.45833 0.000 0.012 0.184 0.504 0.300
#> SRR390493 5 0.6052 0.23705 0.000 0.008 0.152 0.240 0.600
#> SRR390494 4 0.3583 0.69182 0.000 0.004 0.192 0.792 0.012
#> SRR390495 4 0.3527 0.69313 0.000 0.016 0.192 0.792 0.000
#> SRR390496 4 0.3492 0.69412 0.000 0.016 0.188 0.796 0.000
#> SRR390497 5 0.0000 0.76826 0.000 0.000 0.000 0.000 1.000
#> SRR390498 2 0.4275 0.60365 0.000 0.696 0.020 0.000 0.284
#> SRR390499 4 0.0579 0.67828 0.008 0.000 0.008 0.984 0.000
#> SRR390500 4 0.0992 0.67282 0.008 0.000 0.024 0.968 0.000
#> SRR390501 3 0.6370 0.04255 0.176 0.000 0.480 0.344 0.000
#> SRR390502 3 0.6050 0.04475 0.128 0.000 0.512 0.360 0.000
#> SRR390503 3 0.4306 -0.00157 0.000 0.000 0.508 0.000 0.492
#> SRR390504 5 0.2773 0.66276 0.000 0.000 0.164 0.000 0.836
#> SRR390505 1 0.3876 0.52818 0.684 0.000 0.316 0.000 0.000
#> SRR390506 5 0.4768 0.31050 0.024 0.000 0.384 0.000 0.592
#> SRR390507 2 0.0000 0.93430 0.000 1.000 0.000 0.000 0.000
#> SRR390508 2 0.0000 0.93430 0.000 1.000 0.000 0.000 0.000
#> SRR390509 2 0.0000 0.93430 0.000 1.000 0.000 0.000 0.000
#> SRR390510 2 0.0000 0.93430 0.000 1.000 0.000 0.000 0.000
#> SRR390512 2 0.1671 0.90140 0.000 0.924 0.000 0.076 0.000
#> SRR390513 2 0.1671 0.90140 0.000 0.924 0.000 0.076 0.000
#> SRR390514 2 0.1671 0.90140 0.000 0.924 0.000 0.076 0.000
#> SRR390515 1 0.2516 0.80539 0.860 0.000 0.140 0.000 0.000
#> SRR390516 3 0.4142 0.32293 0.004 0.000 0.684 0.004 0.308
#> SRR390517 2 0.3060 0.82220 0.000 0.848 0.024 0.000 0.128
#> SRR390519 5 0.1341 0.75666 0.000 0.000 0.056 0.000 0.944
#> SRR390520 5 0.4524 0.40876 0.000 0.000 0.336 0.020 0.644
#> SRR390521 4 0.3209 0.69639 0.008 0.000 0.180 0.812 0.000
#> SRR390522 4 0.3209 0.69639 0.008 0.000 0.180 0.812 0.000
#> SRR390523 4 0.3280 0.69576 0.012 0.000 0.176 0.812 0.000
#> SRR390524 1 0.0324 0.88851 0.992 0.000 0.004 0.004 0.000
#> SRR390525 1 0.0324 0.88851 0.992 0.000 0.004 0.004 0.000
#> SRR390526 1 0.3687 0.77215 0.792 0.000 0.028 0.180 0.000
#> SRR390527 1 0.3602 0.77174 0.796 0.000 0.024 0.180 0.000
#> SRR390528 4 0.4269 0.55728 0.116 0.000 0.108 0.776 0.000
#> SRR390529 1 0.3146 0.79801 0.856 0.000 0.092 0.000 0.052
#> SRR390530 1 0.2189 0.85550 0.904 0.000 0.012 0.084 0.000
#> SRR390531 1 0.2563 0.82982 0.872 0.000 0.008 0.120 0.000
#> SRR390532 4 0.5717 0.31859 0.000 0.000 0.104 0.572 0.324
#> SRR390533 4 0.5934 0.18524 0.396 0.000 0.108 0.496 0.000
#> SRR390534 4 0.5906 0.17446 0.404 0.000 0.104 0.492 0.000
#> SRR390535 1 0.3809 0.70975 0.736 0.000 0.008 0.256 0.000
#> SRR390536 4 0.3527 0.69313 0.000 0.016 0.192 0.792 0.000
#> SRR390537 4 0.3527 0.69313 0.000 0.016 0.192 0.792 0.000
#> SRR390538 1 0.0912 0.89026 0.972 0.000 0.012 0.016 0.000
#> SRR390539 1 0.1106 0.88940 0.964 0.000 0.012 0.024 0.000
#> SRR390540 1 0.1818 0.87499 0.932 0.000 0.024 0.044 0.000
#> SRR390541 1 0.0898 0.89021 0.972 0.000 0.008 0.020 0.000
#> SRR390542 2 0.0000 0.93430 0.000 1.000 0.000 0.000 0.000
#> SRR390543 2 0.0290 0.93439 0.000 0.992 0.000 0.008 0.000
#> SRR390544 2 0.0510 0.93271 0.000 0.984 0.000 0.016 0.000
#> SRR390545 2 0.0404 0.93386 0.000 0.988 0.000 0.012 0.000
show/hide code output
cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#> class entropy silhouette p1 p2 p3 p4 p5 p6
#> SRR390470 1 0.1180 0.8833 0.960 0.000 0.016 0.012 0.012 0.000
#> SRR390471 1 0.1245 0.8769 0.952 0.000 0.032 0.000 0.016 0.000
#> SRR390472 6 0.4086 0.6521 0.052 0.000 0.060 0.000 0.096 0.792
#> SRR390473 6 0.4798 0.6006 0.112 0.000 0.048 0.000 0.108 0.732
#> SRR390474 4 0.6975 0.1172 0.000 0.000 0.064 0.392 0.252 0.292
#> SRR390475 1 0.1180 0.8849 0.960 0.000 0.012 0.016 0.012 0.000
#> SRR390476 1 0.0984 0.8857 0.968 0.000 0.008 0.012 0.012 0.000
#> SRR390477 1 0.0692 0.8818 0.976 0.000 0.000 0.020 0.004 0.000
#> SRR390478 1 0.0547 0.8840 0.980 0.000 0.000 0.020 0.000 0.000
#> SRR390480 4 0.2425 0.2797 0.024 0.000 0.004 0.884 0.088 0.000
#> SRR390481 4 0.1946 0.2940 0.012 0.000 0.004 0.912 0.072 0.000
#> SRR390482 4 0.5619 0.4058 0.008 0.000 0.020 0.596 0.280 0.096
#> SRR390483 4 0.4232 0.4326 0.004 0.000 0.020 0.708 0.252 0.016
#> SRR390484 6 0.0000 0.7222 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR390485 6 0.0632 0.7234 0.000 0.000 0.000 0.000 0.024 0.976
#> SRR390486 3 0.3139 0.6975 0.000 0.000 0.816 0.000 0.032 0.152
#> SRR390487 3 0.3539 0.7045 0.000 0.000 0.808 0.012 0.044 0.136
#> SRR390488 3 0.2775 0.7362 0.048 0.000 0.888 0.020 0.024 0.020
#> SRR390489 3 0.2433 0.7310 0.052 0.000 0.900 0.008 0.008 0.032
#> SRR390492 5 0.7000 0.2630 0.000 0.016 0.028 0.272 0.348 0.336
#> SRR390493 6 0.6775 0.0388 0.000 0.008 0.048 0.180 0.308 0.456
#> SRR390494 5 0.4859 0.7957 0.000 0.004 0.016 0.464 0.496 0.020
#> SRR390495 5 0.4227 0.8082 0.000 0.008 0.004 0.488 0.500 0.000
#> SRR390496 5 0.4357 0.7878 0.004 0.004 0.008 0.492 0.492 0.000
#> SRR390497 6 0.0000 0.7222 0.000 0.000 0.000 0.000 0.000 1.000
#> SRR390498 2 0.4969 0.6170 0.000 0.684 0.020 0.000 0.104 0.192
#> SRR390499 4 0.0725 0.3517 0.012 0.000 0.000 0.976 0.012 0.000
#> SRR390500 4 0.1562 0.3957 0.032 0.000 0.004 0.940 0.024 0.000
#> SRR390501 3 0.6160 0.5433 0.096 0.000 0.600 0.144 0.160 0.000
#> SRR390502 3 0.5539 0.6043 0.060 0.000 0.660 0.128 0.152 0.000
#> SRR390503 3 0.3917 0.5146 0.000 0.000 0.692 0.000 0.024 0.284
#> SRR390504 6 0.3834 0.6469 0.000 0.000 0.144 0.000 0.084 0.772
#> SRR390505 1 0.5053 0.6000 0.668 0.000 0.136 0.000 0.184 0.012
#> SRR390506 6 0.5910 0.4382 0.016 0.000 0.252 0.000 0.188 0.544
#> SRR390507 2 0.0000 0.9346 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390508 2 0.0000 0.9346 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390509 2 0.0000 0.9346 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390510 2 0.0000 0.9346 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390512 2 0.1995 0.8941 0.000 0.912 0.000 0.052 0.036 0.000
#> SRR390513 2 0.2250 0.8833 0.000 0.896 0.000 0.064 0.040 0.000
#> SRR390514 2 0.2250 0.8833 0.000 0.896 0.000 0.064 0.040 0.000
#> SRR390515 1 0.4705 0.6392 0.696 0.000 0.104 0.000 0.192 0.008
#> SRR390516 3 0.3753 0.6273 0.000 0.000 0.792 0.004 0.100 0.104
#> SRR390517 2 0.2518 0.8529 0.000 0.880 0.012 0.000 0.016 0.092
#> SRR390519 6 0.2294 0.7102 0.000 0.000 0.036 0.000 0.072 0.892
#> SRR390520 6 0.6696 0.4082 0.000 0.000 0.240 0.080 0.180 0.500
#> SRR390521 4 0.4600 -0.6704 0.012 0.000 0.020 0.552 0.416 0.000
#> SRR390522 4 0.4688 -0.6753 0.016 0.000 0.020 0.544 0.420 0.000
#> SRR390523 4 0.4698 -0.6235 0.020 0.000 0.020 0.576 0.384 0.000
#> SRR390524 1 0.0146 0.8854 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR390525 1 0.0146 0.8854 0.996 0.000 0.000 0.004 0.000 0.000
#> SRR390526 1 0.3885 0.5543 0.684 0.000 0.004 0.300 0.012 0.000
#> SRR390527 1 0.3921 0.5388 0.676 0.000 0.004 0.308 0.012 0.000
#> SRR390528 4 0.3886 0.4405 0.084 0.000 0.008 0.784 0.124 0.000
#> SRR390529 1 0.3634 0.7812 0.820 0.000 0.060 0.000 0.092 0.028
#> SRR390530 1 0.1364 0.8695 0.944 0.000 0.004 0.048 0.004 0.000
#> SRR390531 1 0.1429 0.8670 0.940 0.000 0.004 0.052 0.004 0.000
#> SRR390532 4 0.4890 0.4205 0.000 0.000 0.024 0.644 0.284 0.048
#> SRR390533 4 0.6425 0.3287 0.220 0.000 0.196 0.528 0.056 0.000
#> SRR390534 4 0.6301 0.3436 0.216 0.000 0.196 0.540 0.048 0.000
#> SRR390535 4 0.4467 -0.1023 0.480 0.000 0.004 0.496 0.020 0.000
#> SRR390536 5 0.4326 0.8102 0.000 0.008 0.000 0.484 0.500 0.008
#> SRR390537 5 0.3998 0.8094 0.000 0.004 0.000 0.492 0.504 0.000
#> SRR390538 1 0.0767 0.8855 0.976 0.000 0.012 0.004 0.008 0.000
#> SRR390539 1 0.1173 0.8844 0.960 0.000 0.008 0.016 0.016 0.000
#> SRR390540 1 0.2384 0.8485 0.900 0.000 0.016 0.044 0.040 0.000
#> SRR390541 1 0.1180 0.8848 0.960 0.000 0.012 0.016 0.012 0.000
#> SRR390542 2 0.0000 0.9346 0.000 1.000 0.000 0.000 0.000 0.000
#> SRR390543 2 0.0291 0.9345 0.000 0.992 0.000 0.004 0.004 0.000
#> SRR390544 2 0.0508 0.9322 0.000 0.984 0.000 0.012 0.004 0.000
#> SRR390545 2 0.0291 0.9345 0.000 0.992 0.000 0.004 0.004 0.000
Heatmaps for the consensus matrix. It visualizes the probability of two
samples to be in a same group.
consensus_heatmap(res, k = 2)

consensus_heatmap(res, k = 3)

consensus_heatmap(res, k = 4)

consensus_heatmap(res, k = 5)

consensus_heatmap(res, k = 6)

Heatmaps for the membership of samples in all partitions to see how consistent they are:
membership_heatmap(res, k = 2)

membership_heatmap(res, k = 3)

membership_heatmap(res, k = 4)

membership_heatmap(res, k = 5)

membership_heatmap(res, k = 6)

As soon as we have had the classes for columns, we can look for signatures
which are significantly different between classes which can be candidate marks
for certain classes. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
get_signatures(res, k = 2)

get_signatures(res, k = 3)

get_signatures(res, k = 4)

get_signatures(res, k = 5)

get_signatures(res, k = 6)

Signature heatmaps where rows are not scaled:
get_signatures(res, k = 2, scale_rows = FALSE)

get_signatures(res, k = 3, scale_rows = FALSE)

get_signatures(res, k = 4, scale_rows = FALSE)

get_signatures(res, k = 5, scale_rows = FALSE)

get_signatures(res, k = 6, scale_rows = FALSE)

Compare the overlap of signatures from different k:
compare_signatures(res)

get_signature()
returns a data frame invisibly. TO get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.
fdr
: FDR for the differential test.
mean_x
: The mean value in group x.
scaled_mean_x
: The mean value in group x after rows are scaled.
km
: Row groups if k-means clustering is applied to rows.
UMAP plot which shows how samples are separated.
dimension_reduction(res, k = 2, method = "UMAP")

dimension_reduction(res, k = 3, method = "UMAP")

dimension_reduction(res, k = 4, method = "UMAP")

dimension_reduction(res, k = 5, method = "UMAP")

dimension_reduction(res, k = 6, method = "UMAP")

Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)

If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
Session info
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