Date: 2021-07-27 11:47:26 CEST, cola version: 1.9.4
Document is loading...
First the variable is renamed to res_rh
.
res_rh = rh
The partition hierarchy and all available functions which can be applied to res_rh
object.
res_rh
#> A 'HierarchicalPartition' object with 'ATC:skmeans' method.
#> On a matrix with 8082 rows and 243 columns.
#> Performed in total 2250 partitions.
#> There are 10 groups under the following parameters:
#> - min_samples: 6
#> - mean_silhouette_cutoff: 0.9
#> - min_n_signatures: 312 (signatures are selected based on:)
#> - fdr_cutoff: 0.05
#> - group_diff (scaled values): 0.5
#>
#> Hierarchy of the partition:
#> 0, 243 cols
#> |-- 01, 94 cols, 2287 signatures
#> | |-- 011, 48 cols, 459 signatures
#> | | |-- 0111, 19 cols, 9 signatures (c)
#> | | |-- 0112, 14 cols, 21 signatures (c)
#> | | `-- 0113, 15 cols, 0 signatures (c)
#> | `-- 012, 46 cols, 326 signatures
#> | |-- 0121, 24 cols, 7 signatures (c)
#> | |-- 0122, 13 cols, 8 signatures (c)
#> | `-- 0123, 9 cols (b)
#> |-- 02, 75 cols, 1015 signatures
#> | |-- 021, 34 cols, 32 signatures (c)
#> | `-- 022, 41 cols, 170 signatures (c)
#> |-- 03, 31 cols, 25 signatures (c)
#> `-- 04, 43 cols, 16 signatures (c)
#> Stop reason:
#> b) Subgroup had too few columns.
#> c) There were too few signatures.
#>
#> Following methods can be applied to this 'HierarchicalPartition' object:
#> [1] "all_leaves" "all_nodes" "cola_report" "collect_classes"
#> [5] "colnames" "compare_signatures" "dimension_reduction" "functional_enrichment"
#> [9] "get_anno_col" "get_anno" "get_children_nodes" "get_classes"
#> [13] "get_matrix" "get_signatures" "is_leaf_node" "max_depth"
#> [17] "merge_node" "ncol" "node_info" "node_level"
#> [21] "nrow" "rownames" "show" "split_node"
#> [25] "suggest_best_k" "test_to_known_factors" "top_rows_heatmap" "top_rows_overlap"
#>
#> You can get result for a single node by e.g. object["01"]
The call of hierarchical_partition()
was:
#> hierarchical_partition(data = lt$mat, anno = lt$anno, subset = 500, cores = 4)
Dimension of the input matrix:
mat = get_matrix(res_rh)
dim(mat)
#> [1] 8082 243
All the methods that were tried:
res_rh@param$combination_method
#> [[1]]
#> [1] "ATC" "skmeans"
The density distribution for each sample is visualized as one column in the following heatmap. The clustering is based on the distance which is the Kolmogorov-Smirnov statistic between two distributions.
library(ComplexHeatmap)
densityHeatmap(mat, top_annotation = HeatmapAnnotation(df = get_anno(res_rh),
col = get_anno_col(res_rh)), ylab = "value", cluster_columns = TRUE, show_column_names = FALSE,
mc.cores = 1)
Some values about the hierarchy:
all_nodes(res_rh)
#> [1] "0" "01" "011" "0111" "0112" "0113" "012" "0121" "0122" "0123" "02" "021" "022"
#> [14] "03" "04"
all_leaves(res_rh)
#> [1] "0111" "0112" "0113" "0121" "0122" "0123" "021" "022" "03" "04"
node_info(res_rh)
#> id best_method depth best_k n_columns n_signatures p_signatures is_leaf
#> 1 0 ATC:skmeans 1 4 243 6256 0.774066 FALSE
#> 2 01 ATC:skmeans 2 2 94 2287 0.282975 FALSE
#> 3 011 ATC:skmeans 3 3 48 459 0.056793 FALSE
#> 4 0111 ATC:skmeans 4 2 19 9 0.001114 TRUE
#> 5 0112 ATC:skmeans 4 3 14 21 0.002598 TRUE
#> 6 0113 ATC:skmeans 4 2 15 0 0.000000 TRUE
#> 7 012 ATC:skmeans 3 3 46 326 0.040337 FALSE
#> 8 0121 ATC:skmeans 4 2 24 7 0.000866 TRUE
#> 9 0122 ATC:skmeans 4 3 13 8 0.000990 TRUE
#> 10 0123 not applied 4 NA 9 NA NA TRUE
#> 11 02 ATC:skmeans 2 2 75 1015 0.125588 FALSE
#> 12 021 ATC:skmeans 3 2 34 32 0.003959 TRUE
#> 13 022 ATC:skmeans 3 3 41 170 0.021034 TRUE
#> 14 03 ATC:skmeans 2 2 31 25 0.003093 TRUE
#> 15 04 ATC:skmeans 2 2 43 16 0.001980 TRUE
In the output from node_info()
, there are the following columns:
id
: The node id.best_method
: The best method selected.depth
: Depth of the node in the hierarchy.best_k
: Best number of groups of the partition on that node.n_columns
: Number of columns in the submatrix.n_signatures
: Number of signatures with the best_k
.p_signatures
: Proportion of hte signatures in total number of rows in the matrix.is_leaf
: Whether the node is a leaf.Labels of nodes are encoded in a special way. The number of digits correspond to the depth of the node in the hierarchy and the value of the digits correspond to the index of the subgroup in the current node, E.g. a label of “012” means the node is the second subgroup of the partition which is the first subgroup of the root node.
Following table shows the best k
(number of partitions) for each node in the
partition hierarchy. Clicking on the node name in the table goes to the
corresponding section for the partitioning on that node.
The cola vignette explains the definition of the metrics used for determining the best number of partitions.
suggest_best_k(res_rh)
Node | Best method | Is leaf | Best k | 1-PAC | Mean silhouette | Concordance | #samples | |
---|---|---|---|---|---|---|---|---|
Node0 | ATC:skmeans | 4 | 1.00 | 0.96 | 0.98 | 243 | ** | |
Node01 | ATC:skmeans | 4 | 0.91 | 0.92 | 0.95 | 94 | * | |
Node011 | ATC:skmeans | 3 | 1.00 | 0.97 | 0.99 | 48 | ** | |
Node0111-leaf | ATC:skmeans | ✓ (c) | 2 | 1.00 | 1.00 | 1.00 | 19 | ** |
Node0112-leaf | ATC:skmeans | ✓ (c) | 3 | 1.00 | 0.98 | 0.99 | 14 | ** |
Node0113-leaf | ATC:skmeans | ✓ (c) | 2 | 0.87 | 0.96 | 0.98 | 15 | |
Node012 | ATC:skmeans | 3 | 1.00 | 0.96 | 0.99 | 46 | ** | |
Node0121-leaf | ATC:skmeans | ✓ (c) | 2 | 1.00 | 0.94 | 0.98 | 24 | ** |
Node0122-leaf | ATC:skmeans | ✓ (c) | 2 | 1.00 | 0.99 | 1.00 | 13 | ** |
Node0123-leaf | not applied | ✓ (b) | 9 | |||||
Node02 | ATC:skmeans | 2 | 1.00 | 0.98 | 0.99 | 75 | ** | |
Node021-leaf | ATC:skmeans | ✓ (c) | 2 | 1.00 | 0.98 | 0.99 | 34 | ** |
Node022-leaf | ATC:skmeans | ✓ (c) | 3 | 1.00 | 0.98 | 0.99 | 41 | ** |
Node03-leaf | ATC:skmeans | ✓ (c) | 2 | 1.00 | 0.96 | 0.99 | 31 | ** |
Node04-leaf | ATC:skmeans | ✓ (c) | 2 | 1.00 | 0.95 | 0.98 | 43 | ** |
Stop reason: b) Subgroup had too few columns. c) There were too few signatures.
**: 1-PAC > 0.95, *: 1-PAC > 0.9
The nodes of the hierarchy can be merged by setting the merge_node
parameters. Here we
control the hierarchy with the min_n_signatures
parameter. The value of min_n_signatures
is
from node_info()
.
collect_classes(res_rh, merge_node = merge_node_param(min_n_signatures = 326))
collect_classes(res_rh, merge_node = merge_node_param(min_n_signatures = 459))
collect_classes(res_rh, merge_node = merge_node_param(min_n_signatures = 1015))
collect_classes(res_rh, merge_node = merge_node_param(min_n_signatures = 2287))
collect_classes(res_rh, merge_node = merge_node_param(min_n_signatures = 6256))
Following shows the table of the partitions (You need to click the show/hide code output link to see it).
get_classes(res_rh, merge_node = merge_node_param(min_n_signatures = 326))
#> 1772072122_A04 1772072122_A05 1772072122_A06 1772072122_A07 1772072122_A08 1772072122_A09
#> "022" "021" "021" "022" "021" "03"
#> 1772072122_A10 1772072122_A11 1772072122_A12 1772072122_B01 1772072122_B02 1772072122_B03
#> "022" "03" "021" "021" "021" "021"
#> 1772072122_B04 1772072122_B05 1772072122_B06 1772072122_B07 1772072122_B08 1772072122_B09
#> "03" "021" "022" "021" "021" "0121"
#> 1772072122_B10 1772072122_B11 1772072122_B12 1772072122_C01 1772072122_C02 1772072122_C03
#> "04" "04" "04" "0121" "04" "021"
#> 1772072122_C05 1772072122_C07 1772072122_C08 1772072122_C09 1772072122_C10 1772072122_C11
#> "021" "04" "03" "022" "0121" "021"
#> 1772072122_C12 1772072122_D01 1772072122_D04 1772072122_D05 1772072122_D06 1772072122_D07
#> "021" "021" "022" "021" "03" "03"
#> 1772072122_D08 1772072122_D09 1772072122_D10 1772072122_D11 1772072122_E01 1772072122_E02
#> "04" "03" "04" "04" "04" "0121"
#> 1772072122_E03 1772072122_E04 1772072122_E05 1772072122_E06 1772072122_E07 1772072122_E08
#> "022" "022" "04" "022" "04" "021"
#> 1772072122_E09 1772072122_E10 1772072122_E12 1772072122_F01 1772072122_F02 1772072122_F03
#> "0121" "04" "04" "022" "022" "04"
#> 1772072122_F04 1772072122_F05 1772072122_F06 1772072122_F07 1772072122_F08 1772072122_F09
#> "022" "04" "022" "022" "0121" "022"
#> 1772072122_F10 1772072122_F11 1772072122_F12 1772072122_G01 1772072122_G02 1772072122_G04
#> "0121" "03" "04" "021" "021" "022"
#> 1772072122_G05 1772072122_G06 1772072122_G07 1772072122_G08 1772072122_G09 1772072122_G10
#> "04" "04" "0113" "0121" "022" "022"
#> 1772072122_G12 1772072122_H02 1772072122_H04 1772072122_H05 1772072122_H06 1772072122_H07
#> "04" "021" "03" "04" "022" "021"
#> 1772072122_H08 1772072122_H09 1772072122_H10 1772072122_H11 1772072122_H12 1772082029_A02
#> "0121" "03" "04" "03" "04" "022"
#> 1772082029_A03 1772082029_A04 1772082029_A05 1772082029_A06 1772082029_A07 1772082029_A08
#> "0121" "0121" "0121" "04" "0113" "0121"
#> 1772082029_A09 1772082029_A10 1772082029_A11 1772082029_B02 1772082029_B03 1772082029_B04
#> "022" "021" "022" "03" "04" "0113"
#> 1772082029_B05 1772082029_B06 1772082029_B07 1772082029_B08 1772082029_B09 1772082029_B10
#> "022" "0121" "0121" "04" "0113" "022"
#> 1772082029_B11 1772082029_B12 1772082029_C01 1772082029_C02 1772082029_C03 1772082029_C04
#> "03" "0121" "022" "04" "03" "04"
#> 1772082029_C05 1772082029_C06 1772082029_C07 1772082029_C09 1772082029_C10 1772082029_C11
#> "03" "04" "022" "022" "04" "021"
#> 1772082029_C12 1772082029_D01 1772082029_D02 1772082029_D03 1772082029_D05 1772082029_D06
#> "0121" "022" "03" "03" "022" "022"
#> 1772082029_D07 1772082029_D08 1772082029_D09 1772082029_D10 1772082029_D11 1772082029_D12
#> "03" "022" "022" "04" "0113" "022"
#> 1772082029_E01 1772082029_E02 1772082029_E03 1772082029_E04 1772082029_E05 1772082029_E06
#> "03" "021" "03" "0121" "022" "0113"
#> 1772082029_E07 1772082029_E09 1772082029_E10 1772082029_E11 1772082029_E12 1772082029_F01
#> "022" "0113" "04" "021" "04" "03"
#> 1772082029_F02 1772082029_F03 1772082029_F04 1772082029_F05 1772082029_F06 1772082029_F07
#> "04" "0121" "0111" "022" "022" "03"
#> 1772082029_F10 1772082029_F11 1772082029_F12 1772082029_G01 1772082029_G02 1772082029_G03
#> "04" "03" "021" "0121" "022" "0121"
#> 1772082029_G04 1772082029_G05 1772082029_G06 1772082029_G09 1772082029_G10 1772082029_G11
#> "03" "021" "03" "021" "0121" "0121"
#> 1772082029_G12 1772082029_H02 1772082029_H03 1772082029_H04 1772082029_H05 1772082029_H06
#> "04" "0113" "022" "03" "04" "021"
#> 1772082029_H07 1772082029_H08 1772082029_H10 1772082029_H11 1772082029_H12 1772084018_C07
#> "022" "0121" "04" "03" "04" "0113"
#> 1772084018_D12 1772092002_A07 1772092002_A10 1772092002_B05 1772092002_B10 1772092002_D10
#> "0111" "0112" "04" "021" "0123" "0122"
#> 1772092002_E07 1772092002_E10 1772092002_G05 1772092002_G07 1772092277_A10 1772094135_F02
#> "0112" "0123" "04" "0112" "021" "0112"
#> 1772094136_B06 1772094136_C02 1772094143_D09 1772094143_E08 1772096086_H03 1772096087_C09
#> "0112" "0112" "0112" "021" "04" "0113"
#> 1772096087_E02 1772096088_F01 1772096091_A02 1772096092_A02 1772096092_A10 1772096092_D08
#> "0111" "0111" "0122" "0111" "0111" "0112"
#> 1772096093_A07 1772096093_A11 1772096093_B05 1772096093_B10 1772096093_C10 1772096094_A10
#> "0112" "0111" "0123" "021" "0122" "0122"
#> 1772096094_D01 1772096094_D02 1772096094_D09 1772096116_G04 1772096118_F09 1772096146_D02
#> "0123" "0113" "0112" "03" "0122" "0111"
#> 1772096146_D07 1772096146_D08 1772096146_F07 1772096149_F01 1772096149_F12 1772096149_G09
#> "0112" "0123" "0112" "0122" "0111" "0113"
#> 1772096150_B08 1772096150_C08 1772096150_G01 1772096150_H03 1772096150_H04 1772096151_C04
#> "0122" "0111" "0123" "0111" "0122" "022"
#> 1772096151_D03 1772096151_D11 1772096151_E01 1772096151_H03 1772096151_H08 1772096151_H09
#> "04" "0112" "0122" "03" "0113" "0111"
#> 1772099002_A12 1772099002_C02 1772099002_C05 1772099002_D02 1772099002_E02 1772099002_E08
#> "0111" "0123" "0123" "0123" "0111" "0122"
#> 1772099002_F11 1772099002_G09 1772099002_H04 1772099003_A05 1772099003_F09 1772099003_H07
#> "0113" "03" "0111" "04" "03" "0113"
#> 1772099008_A08 1772099008_G08 1772099008_H01 1772099009_E05 1772099011_D01 1772099011_F04
#> "021" "0122" "0111" "0111" "0122" "0111"
#> 1772099011_G07 1772099011_H05 1772099012_E04
#> "0122" "0111" "0112"
get_classes(res_rh, merge_node = merge_node_param(min_n_signatures = 459))
#> 1772072122_A04 1772072122_A05 1772072122_A06 1772072122_A07 1772072122_A08 1772072122_A09
#> "022" "021" "021" "022" "021" "03"
#> 1772072122_A10 1772072122_A11 1772072122_A12 1772072122_B01 1772072122_B02 1772072122_B03
#> "022" "03" "021" "021" "021" "021"
#> 1772072122_B04 1772072122_B05 1772072122_B06 1772072122_B07 1772072122_B08 1772072122_B09
#> "03" "021" "022" "021" "021" "012"
#> 1772072122_B10 1772072122_B11 1772072122_B12 1772072122_C01 1772072122_C02 1772072122_C03
#> "04" "04" "04" "012" "04" "021"
#> 1772072122_C05 1772072122_C07 1772072122_C08 1772072122_C09 1772072122_C10 1772072122_C11
#> "021" "04" "03" "022" "012" "021"
#> 1772072122_C12 1772072122_D01 1772072122_D04 1772072122_D05 1772072122_D06 1772072122_D07
#> "021" "021" "022" "021" "03" "03"
#> 1772072122_D08 1772072122_D09 1772072122_D10 1772072122_D11 1772072122_E01 1772072122_E02
#> "04" "03" "04" "04" "04" "012"
#> 1772072122_E03 1772072122_E04 1772072122_E05 1772072122_E06 1772072122_E07 1772072122_E08
#> "022" "022" "04" "022" "04" "021"
#> 1772072122_E09 1772072122_E10 1772072122_E12 1772072122_F01 1772072122_F02 1772072122_F03
#> "012" "04" "04" "022" "022" "04"
#> 1772072122_F04 1772072122_F05 1772072122_F06 1772072122_F07 1772072122_F08 1772072122_F09
#> "022" "04" "022" "022" "012" "022"
#> 1772072122_F10 1772072122_F11 1772072122_F12 1772072122_G01 1772072122_G02 1772072122_G04
#> "012" "03" "04" "021" "021" "022"
#> 1772072122_G05 1772072122_G06 1772072122_G07 1772072122_G08 1772072122_G09 1772072122_G10
#> "04" "04" "0113" "012" "022" "022"
#> 1772072122_G12 1772072122_H02 1772072122_H04 1772072122_H05 1772072122_H06 1772072122_H07
#> "04" "021" "03" "04" "022" "021"
#> 1772072122_H08 1772072122_H09 1772072122_H10 1772072122_H11 1772072122_H12 1772082029_A02
#> "012" "03" "04" "03" "04" "022"
#> 1772082029_A03 1772082029_A04 1772082029_A05 1772082029_A06 1772082029_A07 1772082029_A08
#> "012" "012" "012" "04" "0113" "012"
#> 1772082029_A09 1772082029_A10 1772082029_A11 1772082029_B02 1772082029_B03 1772082029_B04
#> "022" "021" "022" "03" "04" "0113"
#> 1772082029_B05 1772082029_B06 1772082029_B07 1772082029_B08 1772082029_B09 1772082029_B10
#> "022" "012" "012" "04" "0113" "022"
#> 1772082029_B11 1772082029_B12 1772082029_C01 1772082029_C02 1772082029_C03 1772082029_C04
#> "03" "012" "022" "04" "03" "04"
#> 1772082029_C05 1772082029_C06 1772082029_C07 1772082029_C09 1772082029_C10 1772082029_C11
#> "03" "04" "022" "022" "04" "021"
#> 1772082029_C12 1772082029_D01 1772082029_D02 1772082029_D03 1772082029_D05 1772082029_D06
#> "012" "022" "03" "03" "022" "022"
#> 1772082029_D07 1772082029_D08 1772082029_D09 1772082029_D10 1772082029_D11 1772082029_D12
#> "03" "022" "022" "04" "0113" "022"
#> 1772082029_E01 1772082029_E02 1772082029_E03 1772082029_E04 1772082029_E05 1772082029_E06
#> "03" "021" "03" "012" "022" "0113"
#> 1772082029_E07 1772082029_E09 1772082029_E10 1772082029_E11 1772082029_E12 1772082029_F01
#> "022" "0113" "04" "021" "04" "03"
#> 1772082029_F02 1772082029_F03 1772082029_F04 1772082029_F05 1772082029_F06 1772082029_F07
#> "04" "012" "0111" "022" "022" "03"
#> 1772082029_F10 1772082029_F11 1772082029_F12 1772082029_G01 1772082029_G02 1772082029_G03
#> "04" "03" "021" "012" "022" "012"
#> 1772082029_G04 1772082029_G05 1772082029_G06 1772082029_G09 1772082029_G10 1772082029_G11
#> "03" "021" "03" "021" "012" "012"
#> 1772082029_G12 1772082029_H02 1772082029_H03 1772082029_H04 1772082029_H05 1772082029_H06
#> "04" "0113" "022" "03" "04" "021"
#> 1772082029_H07 1772082029_H08 1772082029_H10 1772082029_H11 1772082029_H12 1772084018_C07
#> "022" "012" "04" "03" "04" "0113"
#> 1772084018_D12 1772092002_A07 1772092002_A10 1772092002_B05 1772092002_B10 1772092002_D10
#> "0111" "0112" "04" "021" "012" "012"
#> 1772092002_E07 1772092002_E10 1772092002_G05 1772092002_G07 1772092277_A10 1772094135_F02
#> "0112" "012" "04" "0112" "021" "0112"
#> 1772094136_B06 1772094136_C02 1772094143_D09 1772094143_E08 1772096086_H03 1772096087_C09
#> "0112" "0112" "0112" "021" "04" "0113"
#> 1772096087_E02 1772096088_F01 1772096091_A02 1772096092_A02 1772096092_A10 1772096092_D08
#> "0111" "0111" "012" "0111" "0111" "0112"
#> 1772096093_A07 1772096093_A11 1772096093_B05 1772096093_B10 1772096093_C10 1772096094_A10
#> "0112" "0111" "012" "021" "012" "012"
#> 1772096094_D01 1772096094_D02 1772096094_D09 1772096116_G04 1772096118_F09 1772096146_D02
#> "012" "0113" "0112" "03" "012" "0111"
#> 1772096146_D07 1772096146_D08 1772096146_F07 1772096149_F01 1772096149_F12 1772096149_G09
#> "0112" "012" "0112" "012" "0111" "0113"
#> 1772096150_B08 1772096150_C08 1772096150_G01 1772096150_H03 1772096150_H04 1772096151_C04
#> "012" "0111" "012" "0111" "012" "022"
#> 1772096151_D03 1772096151_D11 1772096151_E01 1772096151_H03 1772096151_H08 1772096151_H09
#> "04" "0112" "012" "03" "0113" "0111"
#> 1772099002_A12 1772099002_C02 1772099002_C05 1772099002_D02 1772099002_E02 1772099002_E08
#> "0111" "012" "012" "012" "0111" "012"
#> 1772099002_F11 1772099002_G09 1772099002_H04 1772099003_A05 1772099003_F09 1772099003_H07
#> "0113" "03" "0111" "04" "03" "0113"
#> 1772099008_A08 1772099008_G08 1772099008_H01 1772099009_E05 1772099011_D01 1772099011_F04
#> "021" "012" "0111" "0111" "012" "0111"
#> 1772099011_G07 1772099011_H05 1772099012_E04
#> "012" "0111" "0112"
get_classes(res_rh, merge_node = merge_node_param(min_n_signatures = 1015))
#> 1772072122_A04 1772072122_A05 1772072122_A06 1772072122_A07 1772072122_A08 1772072122_A09
#> "022" "021" "021" "022" "021" "03"
#> 1772072122_A10 1772072122_A11 1772072122_A12 1772072122_B01 1772072122_B02 1772072122_B03
#> "022" "03" "021" "021" "021" "021"
#> 1772072122_B04 1772072122_B05 1772072122_B06 1772072122_B07 1772072122_B08 1772072122_B09
#> "03" "021" "022" "021" "021" "012"
#> 1772072122_B10 1772072122_B11 1772072122_B12 1772072122_C01 1772072122_C02 1772072122_C03
#> "04" "04" "04" "012" "04" "021"
#> 1772072122_C05 1772072122_C07 1772072122_C08 1772072122_C09 1772072122_C10 1772072122_C11
#> "021" "04" "03" "022" "012" "021"
#> 1772072122_C12 1772072122_D01 1772072122_D04 1772072122_D05 1772072122_D06 1772072122_D07
#> "021" "021" "022" "021" "03" "03"
#> 1772072122_D08 1772072122_D09 1772072122_D10 1772072122_D11 1772072122_E01 1772072122_E02
#> "04" "03" "04" "04" "04" "012"
#> 1772072122_E03 1772072122_E04 1772072122_E05 1772072122_E06 1772072122_E07 1772072122_E08
#> "022" "022" "04" "022" "04" "021"
#> 1772072122_E09 1772072122_E10 1772072122_E12 1772072122_F01 1772072122_F02 1772072122_F03
#> "012" "04" "04" "022" "022" "04"
#> 1772072122_F04 1772072122_F05 1772072122_F06 1772072122_F07 1772072122_F08 1772072122_F09
#> "022" "04" "022" "022" "012" "022"
#> 1772072122_F10 1772072122_F11 1772072122_F12 1772072122_G01 1772072122_G02 1772072122_G04
#> "012" "03" "04" "021" "021" "022"
#> 1772072122_G05 1772072122_G06 1772072122_G07 1772072122_G08 1772072122_G09 1772072122_G10
#> "04" "04" "011" "012" "022" "022"
#> 1772072122_G12 1772072122_H02 1772072122_H04 1772072122_H05 1772072122_H06 1772072122_H07
#> "04" "021" "03" "04" "022" "021"
#> 1772072122_H08 1772072122_H09 1772072122_H10 1772072122_H11 1772072122_H12 1772082029_A02
#> "012" "03" "04" "03" "04" "022"
#> 1772082029_A03 1772082029_A04 1772082029_A05 1772082029_A06 1772082029_A07 1772082029_A08
#> "012" "012" "012" "04" "011" "012"
#> 1772082029_A09 1772082029_A10 1772082029_A11 1772082029_B02 1772082029_B03 1772082029_B04
#> "022" "021" "022" "03" "04" "011"
#> 1772082029_B05 1772082029_B06 1772082029_B07 1772082029_B08 1772082029_B09 1772082029_B10
#> "022" "012" "012" "04" "011" "022"
#> 1772082029_B11 1772082029_B12 1772082029_C01 1772082029_C02 1772082029_C03 1772082029_C04
#> "03" "012" "022" "04" "03" "04"
#> 1772082029_C05 1772082029_C06 1772082029_C07 1772082029_C09 1772082029_C10 1772082029_C11
#> "03" "04" "022" "022" "04" "021"
#> 1772082029_C12 1772082029_D01 1772082029_D02 1772082029_D03 1772082029_D05 1772082029_D06
#> "012" "022" "03" "03" "022" "022"
#> 1772082029_D07 1772082029_D08 1772082029_D09 1772082029_D10 1772082029_D11 1772082029_D12
#> "03" "022" "022" "04" "011" "022"
#> 1772082029_E01 1772082029_E02 1772082029_E03 1772082029_E04 1772082029_E05 1772082029_E06
#> "03" "021" "03" "012" "022" "011"
#> 1772082029_E07 1772082029_E09 1772082029_E10 1772082029_E11 1772082029_E12 1772082029_F01
#> "022" "011" "04" "021" "04" "03"
#> 1772082029_F02 1772082029_F03 1772082029_F04 1772082029_F05 1772082029_F06 1772082029_F07
#> "04" "012" "011" "022" "022" "03"
#> 1772082029_F10 1772082029_F11 1772082029_F12 1772082029_G01 1772082029_G02 1772082029_G03
#> "04" "03" "021" "012" "022" "012"
#> 1772082029_G04 1772082029_G05 1772082029_G06 1772082029_G09 1772082029_G10 1772082029_G11
#> "03" "021" "03" "021" "012" "012"
#> 1772082029_G12 1772082029_H02 1772082029_H03 1772082029_H04 1772082029_H05 1772082029_H06
#> "04" "011" "022" "03" "04" "021"
#> 1772082029_H07 1772082029_H08 1772082029_H10 1772082029_H11 1772082029_H12 1772084018_C07
#> "022" "012" "04" "03" "04" "011"
#> 1772084018_D12 1772092002_A07 1772092002_A10 1772092002_B05 1772092002_B10 1772092002_D10
#> "011" "011" "04" "021" "012" "012"
#> 1772092002_E07 1772092002_E10 1772092002_G05 1772092002_G07 1772092277_A10 1772094135_F02
#> "011" "012" "04" "011" "021" "011"
#> 1772094136_B06 1772094136_C02 1772094143_D09 1772094143_E08 1772096086_H03 1772096087_C09
#> "011" "011" "011" "021" "04" "011"
#> 1772096087_E02 1772096088_F01 1772096091_A02 1772096092_A02 1772096092_A10 1772096092_D08
#> "011" "011" "012" "011" "011" "011"
#> 1772096093_A07 1772096093_A11 1772096093_B05 1772096093_B10 1772096093_C10 1772096094_A10
#> "011" "011" "012" "021" "012" "012"
#> 1772096094_D01 1772096094_D02 1772096094_D09 1772096116_G04 1772096118_F09 1772096146_D02
#> "012" "011" "011" "03" "012" "011"
#> 1772096146_D07 1772096146_D08 1772096146_F07 1772096149_F01 1772096149_F12 1772096149_G09
#> "011" "012" "011" "012" "011" "011"
#> 1772096150_B08 1772096150_C08 1772096150_G01 1772096150_H03 1772096150_H04 1772096151_C04
#> "012" "011" "012" "011" "012" "022"
#> 1772096151_D03 1772096151_D11 1772096151_E01 1772096151_H03 1772096151_H08 1772096151_H09
#> "04" "011" "012" "03" "011" "011"
#> 1772099002_A12 1772099002_C02 1772099002_C05 1772099002_D02 1772099002_E02 1772099002_E08
#> "011" "012" "012" "012" "011" "012"
#> 1772099002_F11 1772099002_G09 1772099002_H04 1772099003_A05 1772099003_F09 1772099003_H07
#> "011" "03" "011" "04" "03" "011"
#> 1772099008_A08 1772099008_G08 1772099008_H01 1772099009_E05 1772099011_D01 1772099011_F04
#> "021" "012" "011" "011" "012" "011"
#> 1772099011_G07 1772099011_H05 1772099012_E04
#> "012" "011" "011"
get_classes(res_rh, merge_node = merge_node_param(min_n_signatures = 2287))
#> 1772072122_A04 1772072122_A05 1772072122_A06 1772072122_A07 1772072122_A08 1772072122_A09
#> "02" "02" "02" "02" "02" "03"
#> 1772072122_A10 1772072122_A11 1772072122_A12 1772072122_B01 1772072122_B02 1772072122_B03
#> "02" "03" "02" "02" "02" "02"
#> 1772072122_B04 1772072122_B05 1772072122_B06 1772072122_B07 1772072122_B08 1772072122_B09
#> "03" "02" "02" "02" "02" "012"
#> 1772072122_B10 1772072122_B11 1772072122_B12 1772072122_C01 1772072122_C02 1772072122_C03
#> "04" "04" "04" "012" "04" "02"
#> 1772072122_C05 1772072122_C07 1772072122_C08 1772072122_C09 1772072122_C10 1772072122_C11
#> "02" "04" "03" "02" "012" "02"
#> 1772072122_C12 1772072122_D01 1772072122_D04 1772072122_D05 1772072122_D06 1772072122_D07
#> "02" "02" "02" "02" "03" "03"
#> 1772072122_D08 1772072122_D09 1772072122_D10 1772072122_D11 1772072122_E01 1772072122_E02
#> "04" "03" "04" "04" "04" "012"
#> 1772072122_E03 1772072122_E04 1772072122_E05 1772072122_E06 1772072122_E07 1772072122_E08
#> "02" "02" "04" "02" "04" "02"
#> 1772072122_E09 1772072122_E10 1772072122_E12 1772072122_F01 1772072122_F02 1772072122_F03
#> "012" "04" "04" "02" "02" "04"
#> 1772072122_F04 1772072122_F05 1772072122_F06 1772072122_F07 1772072122_F08 1772072122_F09
#> "02" "04" "02" "02" "012" "02"
#> 1772072122_F10 1772072122_F11 1772072122_F12 1772072122_G01 1772072122_G02 1772072122_G04
#> "012" "03" "04" "02" "02" "02"
#> 1772072122_G05 1772072122_G06 1772072122_G07 1772072122_G08 1772072122_G09 1772072122_G10
#> "04" "04" "011" "012" "02" "02"
#> 1772072122_G12 1772072122_H02 1772072122_H04 1772072122_H05 1772072122_H06 1772072122_H07
#> "04" "02" "03" "04" "02" "02"
#> 1772072122_H08 1772072122_H09 1772072122_H10 1772072122_H11 1772072122_H12 1772082029_A02
#> "012" "03" "04" "03" "04" "02"
#> 1772082029_A03 1772082029_A04 1772082029_A05 1772082029_A06 1772082029_A07 1772082029_A08
#> "012" "012" "012" "04" "011" "012"
#> 1772082029_A09 1772082029_A10 1772082029_A11 1772082029_B02 1772082029_B03 1772082029_B04
#> "02" "02" "02" "03" "04" "011"
#> 1772082029_B05 1772082029_B06 1772082029_B07 1772082029_B08 1772082029_B09 1772082029_B10
#> "02" "012" "012" "04" "011" "02"
#> 1772082029_B11 1772082029_B12 1772082029_C01 1772082029_C02 1772082029_C03 1772082029_C04
#> "03" "012" "02" "04" "03" "04"
#> 1772082029_C05 1772082029_C06 1772082029_C07 1772082029_C09 1772082029_C10 1772082029_C11
#> "03" "04" "02" "02" "04" "02"
#> 1772082029_C12 1772082029_D01 1772082029_D02 1772082029_D03 1772082029_D05 1772082029_D06
#> "012" "02" "03" "03" "02" "02"
#> 1772082029_D07 1772082029_D08 1772082029_D09 1772082029_D10 1772082029_D11 1772082029_D12
#> "03" "02" "02" "04" "011" "02"
#> 1772082029_E01 1772082029_E02 1772082029_E03 1772082029_E04 1772082029_E05 1772082029_E06
#> "03" "02" "03" "012" "02" "011"
#> 1772082029_E07 1772082029_E09 1772082029_E10 1772082029_E11 1772082029_E12 1772082029_F01
#> "02" "011" "04" "02" "04" "03"
#> 1772082029_F02 1772082029_F03 1772082029_F04 1772082029_F05 1772082029_F06 1772082029_F07
#> "04" "012" "011" "02" "02" "03"
#> 1772082029_F10 1772082029_F11 1772082029_F12 1772082029_G01 1772082029_G02 1772082029_G03
#> "04" "03" "02" "012" "02" "012"
#> 1772082029_G04 1772082029_G05 1772082029_G06 1772082029_G09 1772082029_G10 1772082029_G11
#> "03" "02" "03" "02" "012" "012"
#> 1772082029_G12 1772082029_H02 1772082029_H03 1772082029_H04 1772082029_H05 1772082029_H06
#> "04" "011" "02" "03" "04" "02"
#> 1772082029_H07 1772082029_H08 1772082029_H10 1772082029_H11 1772082029_H12 1772084018_C07
#> "02" "012" "04" "03" "04" "011"
#> 1772084018_D12 1772092002_A07 1772092002_A10 1772092002_B05 1772092002_B10 1772092002_D10
#> "011" "011" "04" "02" "012" "012"
#> 1772092002_E07 1772092002_E10 1772092002_G05 1772092002_G07 1772092277_A10 1772094135_F02
#> "011" "012" "04" "011" "02" "011"
#> 1772094136_B06 1772094136_C02 1772094143_D09 1772094143_E08 1772096086_H03 1772096087_C09
#> "011" "011" "011" "02" "04" "011"
#> 1772096087_E02 1772096088_F01 1772096091_A02 1772096092_A02 1772096092_A10 1772096092_D08
#> "011" "011" "012" "011" "011" "011"
#> 1772096093_A07 1772096093_A11 1772096093_B05 1772096093_B10 1772096093_C10 1772096094_A10
#> "011" "011" "012" "02" "012" "012"
#> 1772096094_D01 1772096094_D02 1772096094_D09 1772096116_G04 1772096118_F09 1772096146_D02
#> "012" "011" "011" "03" "012" "011"
#> 1772096146_D07 1772096146_D08 1772096146_F07 1772096149_F01 1772096149_F12 1772096149_G09
#> "011" "012" "011" "012" "011" "011"
#> 1772096150_B08 1772096150_C08 1772096150_G01 1772096150_H03 1772096150_H04 1772096151_C04
#> "012" "011" "012" "011" "012" "02"
#> 1772096151_D03 1772096151_D11 1772096151_E01 1772096151_H03 1772096151_H08 1772096151_H09
#> "04" "011" "012" "03" "011" "011"
#> 1772099002_A12 1772099002_C02 1772099002_C05 1772099002_D02 1772099002_E02 1772099002_E08
#> "011" "012" "012" "012" "011" "012"
#> 1772099002_F11 1772099002_G09 1772099002_H04 1772099003_A05 1772099003_F09 1772099003_H07
#> "011" "03" "011" "04" "03" "011"
#> 1772099008_A08 1772099008_G08 1772099008_H01 1772099009_E05 1772099011_D01 1772099011_F04
#> "02" "012" "011" "011" "012" "011"
#> 1772099011_G07 1772099011_H05 1772099012_E04
#> "012" "011" "011"
get_classes(res_rh, merge_node = merge_node_param(min_n_signatures = 6256))
#> 1772072122_A04 1772072122_A05 1772072122_A06 1772072122_A07 1772072122_A08 1772072122_A09
#> "02" "02" "02" "02" "02" "03"
#> 1772072122_A10 1772072122_A11 1772072122_A12 1772072122_B01 1772072122_B02 1772072122_B03
#> "02" "03" "02" "02" "02" "02"
#> 1772072122_B04 1772072122_B05 1772072122_B06 1772072122_B07 1772072122_B08 1772072122_B09
#> "03" "02" "02" "02" "02" "01"
#> 1772072122_B10 1772072122_B11 1772072122_B12 1772072122_C01 1772072122_C02 1772072122_C03
#> "04" "04" "04" "01" "04" "02"
#> 1772072122_C05 1772072122_C07 1772072122_C08 1772072122_C09 1772072122_C10 1772072122_C11
#> "02" "04" "03" "02" "01" "02"
#> 1772072122_C12 1772072122_D01 1772072122_D04 1772072122_D05 1772072122_D06 1772072122_D07
#> "02" "02" "02" "02" "03" "03"
#> 1772072122_D08 1772072122_D09 1772072122_D10 1772072122_D11 1772072122_E01 1772072122_E02
#> "04" "03" "04" "04" "04" "01"
#> 1772072122_E03 1772072122_E04 1772072122_E05 1772072122_E06 1772072122_E07 1772072122_E08
#> "02" "02" "04" "02" "04" "02"
#> 1772072122_E09 1772072122_E10 1772072122_E12 1772072122_F01 1772072122_F02 1772072122_F03
#> "01" "04" "04" "02" "02" "04"
#> 1772072122_F04 1772072122_F05 1772072122_F06 1772072122_F07 1772072122_F08 1772072122_F09
#> "02" "04" "02" "02" "01" "02"
#> 1772072122_F10 1772072122_F11 1772072122_F12 1772072122_G01 1772072122_G02 1772072122_G04
#> "01" "03" "04" "02" "02" "02"
#> 1772072122_G05 1772072122_G06 1772072122_G07 1772072122_G08 1772072122_G09 1772072122_G10
#> "04" "04" "01" "01" "02" "02"
#> 1772072122_G12 1772072122_H02 1772072122_H04 1772072122_H05 1772072122_H06 1772072122_H07
#> "04" "02" "03" "04" "02" "02"
#> 1772072122_H08 1772072122_H09 1772072122_H10 1772072122_H11 1772072122_H12 1772082029_A02
#> "01" "03" "04" "03" "04" "02"
#> 1772082029_A03 1772082029_A04 1772082029_A05 1772082029_A06 1772082029_A07 1772082029_A08
#> "01" "01" "01" "04" "01" "01"
#> 1772082029_A09 1772082029_A10 1772082029_A11 1772082029_B02 1772082029_B03 1772082029_B04
#> "02" "02" "02" "03" "04" "01"
#> 1772082029_B05 1772082029_B06 1772082029_B07 1772082029_B08 1772082029_B09 1772082029_B10
#> "02" "01" "01" "04" "01" "02"
#> 1772082029_B11 1772082029_B12 1772082029_C01 1772082029_C02 1772082029_C03 1772082029_C04
#> "03" "01" "02" "04" "03" "04"
#> 1772082029_C05 1772082029_C06 1772082029_C07 1772082029_C09 1772082029_C10 1772082029_C11
#> "03" "04" "02" "02" "04" "02"
#> 1772082029_C12 1772082029_D01 1772082029_D02 1772082029_D03 1772082029_D05 1772082029_D06
#> "01" "02" "03" "03" "02" "02"
#> 1772082029_D07 1772082029_D08 1772082029_D09 1772082029_D10 1772082029_D11 1772082029_D12
#> "03" "02" "02" "04" "01" "02"
#> 1772082029_E01 1772082029_E02 1772082029_E03 1772082029_E04 1772082029_E05 1772082029_E06
#> "03" "02" "03" "01" "02" "01"
#> 1772082029_E07 1772082029_E09 1772082029_E10 1772082029_E11 1772082029_E12 1772082029_F01
#> "02" "01" "04" "02" "04" "03"
#> 1772082029_F02 1772082029_F03 1772082029_F04 1772082029_F05 1772082029_F06 1772082029_F07
#> "04" "01" "01" "02" "02" "03"
#> 1772082029_F10 1772082029_F11 1772082029_F12 1772082029_G01 1772082029_G02 1772082029_G03
#> "04" "03" "02" "01" "02" "01"
#> 1772082029_G04 1772082029_G05 1772082029_G06 1772082029_G09 1772082029_G10 1772082029_G11
#> "03" "02" "03" "02" "01" "01"
#> 1772082029_G12 1772082029_H02 1772082029_H03 1772082029_H04 1772082029_H05 1772082029_H06
#> "04" "01" "02" "03" "04" "02"
#> 1772082029_H07 1772082029_H08 1772082029_H10 1772082029_H11 1772082029_H12 1772084018_C07
#> "02" "01" "04" "03" "04" "01"
#> 1772084018_D12 1772092002_A07 1772092002_A10 1772092002_B05 1772092002_B10 1772092002_D10
#> "01" "01" "04" "02" "01" "01"
#> 1772092002_E07 1772092002_E10 1772092002_G05 1772092002_G07 1772092277_A10 1772094135_F02
#> "01" "01" "04" "01" "02" "01"
#> 1772094136_B06 1772094136_C02 1772094143_D09 1772094143_E08 1772096086_H03 1772096087_C09
#> "01" "01" "01" "02" "04" "01"
#> 1772096087_E02 1772096088_F01 1772096091_A02 1772096092_A02 1772096092_A10 1772096092_D08
#> "01" "01" "01" "01" "01" "01"
#> 1772096093_A07 1772096093_A11 1772096093_B05 1772096093_B10 1772096093_C10 1772096094_A10
#> "01" "01" "01" "02" "01" "01"
#> 1772096094_D01 1772096094_D02 1772096094_D09 1772096116_G04 1772096118_F09 1772096146_D02
#> "01" "01" "01" "03" "01" "01"
#> 1772096146_D07 1772096146_D08 1772096146_F07 1772096149_F01 1772096149_F12 1772096149_G09
#> "01" "01" "01" "01" "01" "01"
#> 1772096150_B08 1772096150_C08 1772096150_G01 1772096150_H03 1772096150_H04 1772096151_C04
#> "01" "01" "01" "01" "01" "02"
#> 1772096151_D03 1772096151_D11 1772096151_E01 1772096151_H03 1772096151_H08 1772096151_H09
#> "04" "01" "01" "03" "01" "01"
#> 1772099002_A12 1772099002_C02 1772099002_C05 1772099002_D02 1772099002_E02 1772099002_E08
#> "01" "01" "01" "01" "01" "01"
#> 1772099002_F11 1772099002_G09 1772099002_H04 1772099003_A05 1772099003_F09 1772099003_H07
#> "01" "03" "01" "04" "03" "01"
#> 1772099008_A08 1772099008_G08 1772099008_H01 1772099009_E05 1772099011_D01 1772099011_F04
#> "02" "01" "01" "01" "01" "01"
#> 1772099011_G07 1772099011_H05 1772099012_E04
#> "01" "01" "01"
Heatmaps of the top rows:
top_rows_heatmap(res_rh)
Top rows on each node:
top_rows_overlap(res_rh, method = "upset")
UMAP plot which shows how samples are separated.
par(mfrow = c(1, 2))
dimension_reduction(res_rh, merge_node = merge_node_param(min_n_signatures = 326),
method = "UMAP", top_value_method = "SD", top_n = 1000, scale_rows = FALSE)
dimension_reduction(res_rh, merge_node = merge_node_param(min_n_signatures = 326),
method = "UMAP", top_value_method = "ATC", top_n = 1000, scale_rows = TRUE)
par(mfrow = c(1, 2))
dimension_reduction(res_rh, merge_node = merge_node_param(min_n_signatures = 459),
method = "UMAP", top_value_method = "SD", top_n = 1000, scale_rows = FALSE)
dimension_reduction(res_rh, merge_node = merge_node_param(min_n_signatures = 459),
method = "UMAP", top_value_method = "ATC", top_n = 1000, scale_rows = TRUE)
par(mfrow = c(1, 2))
dimension_reduction(res_rh, merge_node = merge_node_param(min_n_signatures = 1015),
method = "UMAP", top_value_method = "SD", top_n = 1000, scale_rows = FALSE)
dimension_reduction(res_rh, merge_node = merge_node_param(min_n_signatures = 1015),
method = "UMAP", top_value_method = "ATC", top_n = 1000, scale_rows = TRUE)
par(mfrow = c(1, 2))
dimension_reduction(res_rh, merge_node = merge_node_param(min_n_signatures = 2287),
method = "UMAP", top_value_method = "SD", top_n = 1000, scale_rows = FALSE)
dimension_reduction(res_rh, merge_node = merge_node_param(min_n_signatures = 2287),
method = "UMAP", top_value_method = "ATC", top_n = 1000, scale_rows = TRUE)
par(mfrow = c(1, 2))
dimension_reduction(res_rh, merge_node = merge_node_param(min_n_signatures = 6256),
method = "UMAP", top_value_method = "SD", top_n = 1000, scale_rows = FALSE)
dimension_reduction(res_rh, merge_node = merge_node_param(min_n_signatures = 6256),
method = "UMAP", top_value_method = "ATC", top_n = 1000, scale_rows = TRUE)
Signatures on the heatmap are the union of all signatures found on every node on the hierarchy. The number of k-means on rows are automatically selected by the function.
get_signatures(res_rh, merge_node = merge_node_param(min_n_signatures = 326))
get_signatures(res_rh, merge_node = merge_node_param(min_n_signatures = 459))
get_signatures(res_rh, merge_node = merge_node_param(min_n_signatures = 1015))
get_signatures(res_rh, merge_node = merge_node_param(min_n_signatures = 2287))
get_signatures(res_rh, merge_node = merge_node_param(min_n_signatures = 6256))
Compare signatures from different nodes:
compare_signatures(res_rh, verbose = FALSE)
If there are too many signatures, top_signatures = ...
can be set to only show the
signatures with the highest FDRs. Note it only works on every node and the final signatures
are the union of all signatures of all nodes.
# code only for demonstration
# e.g. to show the top 500 most significant rows on each node.
tb = get_signature(res_rh, top_signatures = 500)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res_rh, merge_node = merge_node_param(min_n_signatures = 326))
#> Cell_type
#> class 5.45e-10
test_to_known_factors(res_rh, merge_node = merge_node_param(min_n_signatures = 459))
#> Cell_type
#> class 1.4e-10
test_to_known_factors(res_rh, merge_node = merge_node_param(min_n_signatures = 1015))
#> Cell_type
#> class 1.6e-11
test_to_known_factors(res_rh, merge_node = merge_node_param(min_n_signatures = 2287))
#> Cell_type
#> class 4.99e-12
test_to_known_factors(res_rh, merge_node = merge_node_param(min_n_signatures = 6256))
#> Cell_type
#> class 2.63e-13
Child nodes: Node01 , Node02 , Node03-leaf , Node04-leaf .
The object with results only for a single top-value method and a single partitioning method can be extracted as:
res = res_rh["0"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4.
#> On a matrix with 6544 rows and 243 columns.
#> Top rows (654) are extracted by 'ATC' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 150 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_partitions"
#> [7] "compare_signatures" "consensus_heatmap" "dimension_reduction"
#> [10] "functional_enrichment" "get_anno_col" "get_anno"
#> [13] "get_classes" "get_consensus" "get_matrix"
#> [16] "get_membership" "get_param" "get_signatures"
#> [19] "get_stats" "is_best_k" "is_stable_k"
#> [22] "membership_heatmap" "ncol" "nrow"
#> [25] "plot_ecdf" "predict_classes" "rownames"
#> [28] "select_partition_number" "show" "suggest_best_k"
#> [31] "test_to_known_factors" "top_rows_heatmap"
collect_plots()
function collects all the plots made from res
for all k
(number of subgroups)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, higher 1-PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.985 0.994 0.502 0.498 0.498
#> 3 3 1.000 0.962 0.980 0.216 0.867 0.741
#> 4 4 0.999 0.960 0.983 0.163 0.873 0.686
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 4
#> attr(,"optional")
#> [1] 2 3
There is also optional best \(k\) = 2 3 that is worth to check.
Following is 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 subgroup
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> 1772072122_A04 2 0.000 0.992 0.00 1.00
#> 1772072122_A05 2 0.000 0.992 0.00 1.00
#> 1772072122_A06 2 0.000 0.992 0.00 1.00
#> 1772072122_A07 2 0.000 0.992 0.00 1.00
#> 1772072122_A08 2 0.000 0.992 0.00 1.00
#> 1772072122_A09 2 0.000 0.992 0.00 1.00
#> 1772072122_A10 2 0.000 0.992 0.00 1.00
#> 1772072122_A11 1 0.000 0.995 1.00 0.00
#> 1772072122_A12 2 0.000 0.992 0.00 1.00
#> 1772072122_B01 2 0.000 0.992 0.00 1.00
#> 1772072122_B02 2 0.000 0.992 0.00 1.00
#> 1772072122_B03 2 0.000 0.992 0.00 1.00
#> 1772072122_B04 2 0.000 0.992 0.00 1.00
#> 1772072122_B05 2 0.000 0.992 0.00 1.00
#> 1772072122_B06 2 0.000 0.992 0.00 1.00
#> 1772072122_B07 2 0.000 0.992 0.00 1.00
#> 1772072122_B08 2 0.000 0.992 0.00 1.00
#> 1772072122_B09 1 0.000 0.995 1.00 0.00
#> 1772072122_B10 1 0.000 0.995 1.00 0.00
#> 1772072122_B11 2 0.943 0.440 0.36 0.64
#> 1772072122_B12 2 0.000 0.992 0.00 1.00
#> 1772072122_C01 1 0.000 0.995 1.00 0.00
#> 1772072122_C02 2 0.000 0.992 0.00 1.00
#> 1772072122_C03 2 0.000 0.992 0.00 1.00
#> 1772072122_C05 2 0.000 0.992 0.00 1.00
#> 1772072122_C07 2 0.000 0.992 0.00 1.00
#> 1772072122_C08 1 0.000 0.995 1.00 0.00
#> 1772072122_C09 2 0.000 0.992 0.00 1.00
#> 1772072122_C10 1 0.000 0.995 1.00 0.00
#> 1772072122_C11 2 0.000 0.992 0.00 1.00
#> 1772072122_C12 2 0.000 0.992 0.00 1.00
#> 1772072122_D01 2 0.000 0.992 0.00 1.00
#> 1772072122_D04 2 0.000 0.992 0.00 1.00
#> 1772072122_D05 2 0.000 0.992 0.00 1.00
#> 1772072122_D06 1 0.327 0.935 0.94 0.06
#> 1772072122_D07 1 0.000 0.995 1.00 0.00
#> 1772072122_D08 1 0.000 0.995 1.00 0.00
#> 1772072122_D09 1 0.000 0.995 1.00 0.00
#> 1772072122_D10 2 0.000 0.992 0.00 1.00
#> 1772072122_D11 2 0.855 0.615 0.28 0.72
#> 1772072122_E01 2 0.000 0.992 0.00 1.00
#> 1772072122_E02 1 0.000 0.995 1.00 0.00
#> 1772072122_E03 2 0.000 0.992 0.00 1.00
#> 1772072122_E04 2 0.000 0.992 0.00 1.00
#> 1772072122_E05 2 0.000 0.992 0.00 1.00
#> 1772072122_E06 2 0.000 0.992 0.00 1.00
#> 1772072122_E07 2 0.000 0.992 0.00 1.00
#> 1772072122_E08 2 0.000 0.992 0.00 1.00
#> 1772072122_E09 1 0.000 0.995 1.00 0.00
#> 1772072122_E10 2 0.881 0.575 0.30 0.70
#> 1772072122_E12 2 0.000 0.992 0.00 1.00
#> 1772072122_F01 2 0.000 0.992 0.00 1.00
#> 1772072122_F02 2 0.000 0.992 0.00 1.00
#> 1772072122_F03 2 0.000 0.992 0.00 1.00
#> 1772072122_F04 2 0.000 0.992 0.00 1.00
#> 1772072122_F05 2 0.000 0.992 0.00 1.00
#> 1772072122_F06 2 0.000 0.992 0.00 1.00
#> 1772072122_F07 2 0.000 0.992 0.00 1.00
#> 1772072122_F08 1 0.000 0.995 1.00 0.00
#> 1772072122_F09 2 0.000 0.992 0.00 1.00
#> 1772072122_F10 1 0.000 0.995 1.00 0.00
#> 1772072122_F11 1 0.000 0.995 1.00 0.00
#> 1772072122_F12 1 0.242 0.956 0.96 0.04
#> 1772072122_G01 2 0.000 0.992 0.00 1.00
#> 1772072122_G02 2 0.000 0.992 0.00 1.00
#> 1772072122_G04 2 0.000 0.992 0.00 1.00
#> 1772072122_G05 2 0.000 0.992 0.00 1.00
#> 1772072122_G06 2 0.000 0.992 0.00 1.00
#> 1772072122_G07 1 0.000 0.995 1.00 0.00
#> 1772072122_G08 1 0.000 0.995 1.00 0.00
#> 1772072122_G09 2 0.000 0.992 0.00 1.00
#> 1772072122_G10 2 0.000 0.992 0.00 1.00
#> 1772072122_G12 2 0.000 0.992 0.00 1.00
#> 1772072122_H02 2 0.000 0.992 0.00 1.00
#> 1772072122_H04 1 0.000 0.995 1.00 0.00
#> 1772072122_H05 2 0.000 0.992 0.00 1.00
#> 1772072122_H06 2 0.000 0.992 0.00 1.00
#> 1772072122_H07 2 0.000 0.992 0.00 1.00
#> 1772072122_H08 1 0.000 0.995 1.00 0.00
#> 1772072122_H09 2 0.000 0.992 0.00 1.00
#> 1772072122_H10 1 0.760 0.717 0.78 0.22
#> 1772072122_H11 1 0.000 0.995 1.00 0.00
#> 1772072122_H12 2 0.000 0.992 0.00 1.00
#> 1772082029_A02 2 0.000 0.992 0.00 1.00
#> 1772082029_A03 1 0.000 0.995 1.00 0.00
#> 1772082029_A04 1 0.000 0.995 1.00 0.00
#> 1772082029_A05 1 0.000 0.995 1.00 0.00
#> 1772082029_A06 2 0.000 0.992 0.00 1.00
#> 1772082029_A07 1 0.000 0.995 1.00 0.00
#> 1772082029_A08 1 0.000 0.995 1.00 0.00
#> 1772082029_A09 2 0.000 0.992 0.00 1.00
#> 1772082029_A10 2 0.000 0.992 0.00 1.00
#> 1772082029_A11 2 0.000 0.992 0.00 1.00
#> 1772082029_B02 1 0.000 0.995 1.00 0.00
#> 1772082029_B03 2 0.000 0.992 0.00 1.00
#> 1772082029_B04 1 0.000 0.995 1.00 0.00
#> 1772082029_B05 2 0.000 0.992 0.00 1.00
#> 1772082029_B06 1 0.000 0.995 1.00 0.00
#> 1772082029_B07 1 0.000 0.995 1.00 0.00
#> 1772082029_B08 2 0.000 0.992 0.00 1.00
#> 1772082029_B09 1 0.000 0.995 1.00 0.00
#> 1772082029_B10 2 0.000 0.992 0.00 1.00
#> 1772082029_B11 2 0.000 0.992 0.00 1.00
#> 1772082029_B12 1 0.000 0.995 1.00 0.00
#> 1772082029_C01 2 0.000 0.992 0.00 1.00
#> 1772082029_C02 2 0.000 0.992 0.00 1.00
#> 1772082029_C03 1 0.000 0.995 1.00 0.00
#> 1772082029_C04 1 0.000 0.995 1.00 0.00
#> 1772082029_C05 1 0.000 0.995 1.00 0.00
#> 1772082029_C06 2 0.000 0.992 0.00 1.00
#> 1772082029_C07 2 0.000 0.992 0.00 1.00
#> 1772082029_C09 2 0.000 0.992 0.00 1.00
#> 1772082029_C10 2 0.000 0.992 0.00 1.00
#> 1772082029_C11 2 0.000 0.992 0.00 1.00
#> 1772082029_C12 1 0.000 0.995 1.00 0.00
#> 1772082029_D01 2 0.000 0.992 0.00 1.00
#> 1772082029_D02 1 0.000 0.995 1.00 0.00
#> 1772082029_D03 2 0.000 0.992 0.00 1.00
#> 1772082029_D05 2 0.000 0.992 0.00 1.00
#> 1772082029_D06 2 0.000 0.992 0.00 1.00
#> 1772082029_D07 1 0.000 0.995 1.00 0.00
#> 1772082029_D08 2 0.000 0.992 0.00 1.00
#> 1772082029_D09 2 0.000 0.992 0.00 1.00
#> 1772082029_D10 2 0.000 0.992 0.00 1.00
#> 1772082029_D11 1 0.000 0.995 1.00 0.00
#> 1772082029_D12 2 0.000 0.992 0.00 1.00
#> 1772082029_E01 2 0.000 0.992 0.00 1.00
#> 1772082029_E02 2 0.000 0.992 0.00 1.00
#> 1772082029_E03 1 0.722 0.751 0.80 0.20
#> 1772082029_E04 1 0.000 0.995 1.00 0.00
#> 1772082029_E05 2 0.000 0.992 0.00 1.00
#> 1772082029_E06 1 0.000 0.995 1.00 0.00
#> 1772082029_E07 2 0.000 0.992 0.00 1.00
#> 1772082029_E09 1 0.000 0.995 1.00 0.00
#> 1772082029_E10 2 0.000 0.992 0.00 1.00
#> 1772082029_E11 2 0.000 0.992 0.00 1.00
#> 1772082029_E12 2 0.000 0.992 0.00 1.00
#> 1772082029_F01 1 0.000 0.995 1.00 0.00
#> 1772082029_F02 2 0.000 0.992 0.00 1.00
#> 1772082029_F03 1 0.000 0.995 1.00 0.00
#> 1772082029_F04 1 0.000 0.995 1.00 0.00
#> 1772082029_F05 2 0.000 0.992 0.00 1.00
#> 1772082029_F06 2 0.000 0.992 0.00 1.00
#> 1772082029_F07 1 0.000 0.995 1.00 0.00
#> 1772082029_F10 2 0.000 0.992 0.00 1.00
#> 1772082029_F11 1 0.000 0.995 1.00 0.00
#> 1772082029_F12 2 0.000 0.992 0.00 1.00
#> 1772082029_G01 1 0.000 0.995 1.00 0.00
#> 1772082029_G02 2 0.000 0.992 0.00 1.00
#> 1772082029_G03 1 0.000 0.995 1.00 0.00
#> 1772082029_G04 1 0.000 0.995 1.00 0.00
#> 1772082029_G05 2 0.000 0.992 0.00 1.00
#> 1772082029_G06 1 0.000 0.995 1.00 0.00
#> 1772082029_G09 2 0.000 0.992 0.00 1.00
#> 1772082029_G10 1 0.000 0.995 1.00 0.00
#> 1772082029_G11 1 0.000 0.995 1.00 0.00
#> 1772082029_G12 2 0.000 0.992 0.00 1.00
#> 1772082029_H02 1 0.000 0.995 1.00 0.00
#> 1772082029_H03 2 0.000 0.992 0.00 1.00
#> 1772082029_H04 1 0.000 0.995 1.00 0.00
#> 1772082029_H05 2 0.000 0.992 0.00 1.00
#> 1772082029_H06 2 0.000 0.992 0.00 1.00
#> 1772082029_H07 2 0.000 0.992 0.00 1.00
#> 1772082029_H08 1 0.000 0.995 1.00 0.00
#> 1772082029_H10 2 0.000 0.992 0.00 1.00
#> 1772082029_H11 2 0.000 0.992 0.00 1.00
#> 1772082029_H12 2 0.000 0.992 0.00 1.00
#> 1772084018_C07 1 0.000 0.995 1.00 0.00
#> 1772084018_D12 1 0.000 0.995 1.00 0.00
#> 1772092002_A07 1 0.000 0.995 1.00 0.00
#> 1772092002_A10 2 0.000 0.992 0.00 1.00
#> 1772092002_B05 2 0.000 0.992 0.00 1.00
#> 1772092002_B10 1 0.000 0.995 1.00 0.00
#> 1772092002_D10 1 0.000 0.995 1.00 0.00
#> 1772092002_E07 1 0.000 0.995 1.00 0.00
#> 1772092002_E10 1 0.000 0.995 1.00 0.00
#> 1772092002_G05 2 0.000 0.992 0.00 1.00
#> 1772092002_G07 1 0.000 0.995 1.00 0.00
#> 1772092277_A10 2 0.000 0.992 0.00 1.00
#> 1772094135_F02 1 0.000 0.995 1.00 0.00
#> 1772094136_B06 1 0.000 0.995 1.00 0.00
#> 1772094136_C02 1 0.000 0.995 1.00 0.00
#> 1772094143_D09 1 0.000 0.995 1.00 0.00
#> 1772094143_E08 2 0.000 0.992 0.00 1.00
#> 1772096086_H03 2 0.141 0.972 0.02 0.98
#> 1772096087_C09 1 0.000 0.995 1.00 0.00
#> 1772096087_E02 1 0.000 0.995 1.00 0.00
#> 1772096088_F01 1 0.000 0.995 1.00 0.00
#> 1772096091_A02 1 0.000 0.995 1.00 0.00
#> 1772096092_A02 1 0.000 0.995 1.00 0.00
#> 1772096092_A10 1 0.000 0.995 1.00 0.00
#> 1772096092_D08 1 0.000 0.995 1.00 0.00
#> 1772096093_A07 1 0.000 0.995 1.00 0.00
#> 1772096093_A11 1 0.000 0.995 1.00 0.00
#> 1772096093_B05 1 0.000 0.995 1.00 0.00
#> 1772096093_B10 2 0.000 0.992 0.00 1.00
#> 1772096093_C10 1 0.000 0.995 1.00 0.00
#> 1772096094_A10 1 0.000 0.995 1.00 0.00
#> 1772096094_D01 1 0.000 0.995 1.00 0.00
#> 1772096094_D02 1 0.000 0.995 1.00 0.00
#> 1772096094_D09 1 0.000 0.995 1.00 0.00
#> 1772096116_G04 1 0.000 0.995 1.00 0.00
#> 1772096118_F09 1 0.000 0.995 1.00 0.00
#> 1772096146_D02 1 0.000 0.995 1.00 0.00
#> 1772096146_D07 1 0.000 0.995 1.00 0.00
#> 1772096146_D08 1 0.000 0.995 1.00 0.00
#> 1772096146_F07 1 0.000 0.995 1.00 0.00
#> 1772096149_F01 1 0.000 0.995 1.00 0.00
#> 1772096149_F12 1 0.000 0.995 1.00 0.00
#> 1772096149_G09 1 0.000 0.995 1.00 0.00
#> 1772096150_B08 1 0.000 0.995 1.00 0.00
#> 1772096150_C08 1 0.000 0.995 1.00 0.00
#> 1772096150_G01 1 0.000 0.995 1.00 0.00
#> 1772096150_H03 1 0.000 0.995 1.00 0.00
#> 1772096150_H04 1 0.000 0.995 1.00 0.00
#> 1772096151_C04 2 0.000 0.992 0.00 1.00
#> 1772096151_D03 2 0.000 0.992 0.00 1.00
#> 1772096151_D11 1 0.000 0.995 1.00 0.00
#> 1772096151_E01 1 0.000 0.995 1.00 0.00
#> 1772096151_H03 1 0.000 0.995 1.00 0.00
#> 1772096151_H08 1 0.000 0.995 1.00 0.00
#> 1772096151_H09 1 0.000 0.995 1.00 0.00
#> 1772099002_A12 1 0.000 0.995 1.00 0.00
#> 1772099002_C02 1 0.000 0.995 1.00 0.00
#> 1772099002_C05 1 0.000 0.995 1.00 0.00
#> 1772099002_D02 1 0.000 0.995 1.00 0.00
#> 1772099002_E02 1 0.000 0.995 1.00 0.00
#> 1772099002_E08 1 0.000 0.995 1.00 0.00
#> 1772099002_F11 1 0.000 0.995 1.00 0.00
#> 1772099002_G09 1 0.000 0.995 1.00 0.00
#> 1772099002_H04 1 0.000 0.995 1.00 0.00
#> 1772099003_A05 1 0.242 0.956 0.96 0.04
#> 1772099003_F09 1 0.000 0.995 1.00 0.00
#> 1772099003_H07 1 0.000 0.995 1.00 0.00
#> 1772099008_A08 2 0.000 0.992 0.00 1.00
#> 1772099008_G08 1 0.000 0.995 1.00 0.00
#> 1772099008_H01 1 0.000 0.995 1.00 0.00
#> 1772099009_E05 1 0.000 0.995 1.00 0.00
#> 1772099011_D01 1 0.000 0.995 1.00 0.00
#> 1772099011_F04 1 0.000 0.995 1.00 0.00
#> 1772099011_G07 1 0.000 0.995 1.00 0.00
#> 1772099011_H05 1 0.000 0.995 1.00 0.00
#> 1772099012_E04 1 0.000 0.995 1.00 0.00
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> 1772072122_A04 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_A05 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_A06 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_A07 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772072122_A08 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_A09 3 0.0892 0.9669 0.00 0.02 0.98
#> 1772072122_A10 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_A11 3 0.0892 0.9747 0.02 0.00 0.98
#> 1772072122_A12 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_B01 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_B02 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_B03 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_B04 3 0.0892 0.9669 0.00 0.02 0.98
#> 1772072122_B05 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_B06 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_B07 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_B08 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_B09 1 0.3340 0.8564 0.88 0.00 0.12
#> 1772072122_B10 1 0.0892 0.9670 0.98 0.00 0.02
#> 1772072122_B11 2 0.8859 0.1408 0.40 0.48 0.12
#> 1772072122_B12 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772072122_C01 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772072122_C02 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772072122_C03 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_C05 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_C07 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772072122_C08 3 0.1529 0.9677 0.04 0.00 0.96
#> 1772072122_C09 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_C10 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772072122_C11 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_C12 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_D01 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_D04 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772072122_D05 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_D06 3 0.0892 0.9669 0.00 0.02 0.98
#> 1772072122_D07 3 0.0892 0.9747 0.02 0.00 0.98
#> 1772072122_D08 1 0.0892 0.9670 0.98 0.00 0.02
#> 1772072122_D09 3 0.1529 0.9677 0.04 0.00 0.96
#> 1772072122_D10 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772072122_D11 1 0.7059 0.0886 0.52 0.46 0.02
#> 1772072122_E01 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772072122_E02 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772072122_E03 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772072122_E04 2 0.6280 0.1595 0.00 0.54 0.46
#> 1772072122_E05 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772072122_E06 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772072122_E07 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772072122_E08 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_E09 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772072122_E10 1 0.5858 0.6192 0.74 0.24 0.02
#> 1772072122_E12 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772072122_F01 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_F02 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772072122_F03 2 0.1781 0.9559 0.02 0.96 0.02
#> 1772072122_F04 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772072122_F05 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772072122_F06 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772072122_F07 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_F08 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772072122_F09 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772072122_F10 1 0.1529 0.9499 0.96 0.00 0.04
#> 1772072122_F11 3 0.0892 0.9747 0.02 0.00 0.98
#> 1772072122_F12 1 0.0892 0.9670 0.98 0.00 0.02
#> 1772072122_G01 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_G02 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_G04 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772072122_G05 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772072122_G06 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772072122_G07 1 0.0892 0.9683 0.98 0.00 0.02
#> 1772072122_G08 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772072122_G09 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772072122_G10 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772072122_G12 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772072122_H02 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_H04 3 0.0892 0.9747 0.02 0.00 0.98
#> 1772072122_H05 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772072122_H06 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_H07 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772072122_H08 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772072122_H09 3 0.0892 0.9669 0.00 0.02 0.98
#> 1772072122_H10 1 0.2414 0.9226 0.94 0.04 0.02
#> 1772072122_H11 3 0.0892 0.9747 0.02 0.00 0.98
#> 1772072122_H12 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772082029_A02 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772082029_A03 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_A04 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_A05 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_A06 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772082029_A07 1 0.1529 0.9499 0.96 0.00 0.04
#> 1772082029_A08 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_A09 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772082029_A10 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772082029_A11 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772082029_B02 3 0.0892 0.9747 0.02 0.00 0.98
#> 1772082029_B03 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772082029_B04 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_B05 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772082029_B06 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_B07 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_B08 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772082029_B09 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_B10 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772082029_B11 3 0.0892 0.9669 0.00 0.02 0.98
#> 1772082029_B12 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_C01 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772082029_C02 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772082029_C03 3 0.1529 0.9677 0.04 0.00 0.96
#> 1772082029_C04 1 0.0892 0.9670 0.98 0.00 0.02
#> 1772082029_C05 3 0.0892 0.9747 0.02 0.00 0.98
#> 1772082029_C06 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772082029_C07 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772082029_C09 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772082029_C10 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772082029_C11 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772082029_C12 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_D01 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772082029_D02 3 0.0892 0.9747 0.02 0.00 0.98
#> 1772082029_D03 3 0.0892 0.9669 0.00 0.02 0.98
#> 1772082029_D05 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772082029_D06 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772082029_D07 3 0.1529 0.9677 0.04 0.00 0.96
#> 1772082029_D08 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772082029_D09 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772082029_D10 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772082029_D11 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_D12 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772082029_E01 3 0.0892 0.9669 0.00 0.02 0.98
#> 1772082029_E02 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772082029_E03 3 0.0892 0.9669 0.00 0.02 0.98
#> 1772082029_E04 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_E05 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772082029_E06 1 0.1529 0.9499 0.96 0.00 0.04
#> 1772082029_E07 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772082029_E09 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_E10 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772082029_E11 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772082029_E12 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772082029_F01 3 0.0892 0.9747 0.02 0.00 0.98
#> 1772082029_F02 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772082029_F03 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_F04 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_F05 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772082029_F06 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772082029_F07 3 0.1529 0.9677 0.04 0.00 0.96
#> 1772082029_F10 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772082029_F11 3 0.1529 0.9677 0.04 0.00 0.96
#> 1772082029_F12 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772082029_G01 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_G02 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772082029_G03 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_G04 3 0.1529 0.9677 0.04 0.00 0.96
#> 1772082029_G05 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772082029_G06 3 0.4291 0.8119 0.18 0.00 0.82
#> 1772082029_G09 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772082029_G10 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_G11 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_G12 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772082029_H02 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_H03 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772082029_H04 3 0.0892 0.9747 0.02 0.00 0.98
#> 1772082029_H05 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772082029_H06 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772082029_H07 2 0.0892 0.9697 0.00 0.98 0.02
#> 1772082029_H08 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772082029_H10 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772082029_H11 3 0.0892 0.9669 0.00 0.02 0.98
#> 1772082029_H12 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772084018_C07 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772084018_D12 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772092002_A07 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772092002_A10 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772092002_B05 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772092002_B10 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772092002_D10 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772092002_E07 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772092002_E10 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772092002_G05 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772092002_G07 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772092277_A10 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772094135_F02 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772094136_B06 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772094136_C02 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772094143_D09 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772094143_E08 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772096086_H03 2 0.4862 0.7674 0.16 0.82 0.02
#> 1772096087_C09 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096087_E02 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096088_F01 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096091_A02 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096092_A02 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096092_A10 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096092_D08 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096093_A07 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096093_A11 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096093_B05 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096093_B10 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772096093_C10 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096094_A10 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096094_D01 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096094_D02 1 0.1529 0.9499 0.96 0.00 0.04
#> 1772096094_D09 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096116_G04 3 0.1529 0.9677 0.04 0.00 0.96
#> 1772096118_F09 1 0.0892 0.9670 0.98 0.00 0.02
#> 1772096146_D02 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096146_D07 1 0.1529 0.9499 0.96 0.00 0.04
#> 1772096146_D08 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096146_F07 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096149_F01 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096149_F12 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096149_G09 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096150_B08 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096150_C08 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096150_G01 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096150_H03 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096150_H04 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096151_C04 3 0.0892 0.9669 0.00 0.02 0.98
#> 1772096151_D03 2 0.0892 0.9727 0.00 0.98 0.02
#> 1772096151_D11 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096151_E01 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096151_H03 3 0.4291 0.8120 0.18 0.00 0.82
#> 1772096151_H08 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772096151_H09 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772099002_A12 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772099002_C02 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772099002_C05 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772099002_D02 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772099002_E02 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772099002_E08 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772099002_F11 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772099002_G09 3 0.1529 0.9677 0.04 0.00 0.96
#> 1772099002_H04 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772099003_A05 1 0.1781 0.9462 0.96 0.02 0.02
#> 1772099003_F09 3 0.0892 0.9747 0.02 0.00 0.98
#> 1772099003_H07 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772099008_A08 2 0.0000 0.9773 0.00 1.00 0.00
#> 1772099008_G08 1 0.0892 0.9683 0.98 0.00 0.02
#> 1772099008_H01 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772099009_E05 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772099011_D01 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772099011_F04 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772099011_G07 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772099011_H05 1 0.0000 0.9847 1.00 0.00 0.00
#> 1772099012_E04 1 0.0000 0.9847 1.00 0.00 0.00
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> 1772072122_A04 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_A05 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_A06 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_A07 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_A08 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_A09 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772072122_A10 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_A11 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772072122_A12 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_B01 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_B02 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_B03 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_B04 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772072122_B05 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_B06 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_B07 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_B08 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_B09 1 0.3172 0.803 0.84 0.00 0.16 0.00
#> 1772072122_B10 4 0.1637 0.902 0.06 0.00 0.00 0.94
#> 1772072122_B11 4 0.2011 0.875 0.08 0.00 0.00 0.92
#> 1772072122_B12 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772072122_C01 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772072122_C02 4 0.2011 0.913 0.00 0.08 0.00 0.92
#> 1772072122_C03 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_C05 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_C07 4 0.1637 0.929 0.00 0.06 0.00 0.94
#> 1772072122_C08 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772072122_C09 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_C10 1 0.0707 0.972 0.98 0.00 0.00 0.02
#> 1772072122_C11 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_C12 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_D01 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_D04 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_D05 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_D06 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772072122_D07 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772072122_D08 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772072122_D09 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772072122_D10 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772072122_D11 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772072122_E01 4 0.1637 0.929 0.00 0.06 0.00 0.94
#> 1772072122_E02 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772072122_E03 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_E04 2 0.1211 0.945 0.00 0.96 0.04 0.00
#> 1772072122_E05 4 0.1637 0.929 0.00 0.06 0.00 0.94
#> 1772072122_E06 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_E07 4 0.2345 0.894 0.00 0.10 0.00 0.90
#> 1772072122_E08 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_E09 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772072122_E10 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772072122_E12 4 0.1637 0.929 0.00 0.06 0.00 0.94
#> 1772072122_F01 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_F02 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_F03 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772072122_F04 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_F05 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772072122_F06 2 0.4948 0.162 0.00 0.56 0.00 0.44
#> 1772072122_F07 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_F08 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772072122_F09 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_F10 1 0.0707 0.973 0.98 0.00 0.02 0.00
#> 1772072122_F11 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772072122_F12 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772072122_G01 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_G02 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_G04 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_G05 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772072122_G06 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772072122_G07 1 0.0707 0.973 0.98 0.00 0.02 0.00
#> 1772072122_G08 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772072122_G09 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_G10 2 0.0707 0.967 0.00 0.98 0.00 0.02
#> 1772072122_G12 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772072122_H02 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_H04 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772072122_H05 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772072122_H06 2 0.1211 0.946 0.00 0.96 0.00 0.04
#> 1772072122_H07 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772072122_H08 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772072122_H09 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772072122_H10 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772072122_H11 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772072122_H12 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772082029_A02 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_A03 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772082029_A04 1 0.1637 0.933 0.94 0.00 0.00 0.06
#> 1772082029_A05 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772082029_A06 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772082029_A07 1 0.0707 0.973 0.98 0.00 0.02 0.00
#> 1772082029_A08 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772082029_A09 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_A10 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_A11 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_B02 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772082029_B03 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772082029_B04 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772082029_B05 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_B06 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772082029_B07 1 0.1637 0.933 0.94 0.00 0.00 0.06
#> 1772082029_B08 4 0.2011 0.914 0.00 0.08 0.00 0.92
#> 1772082029_B09 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772082029_B10 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_B11 3 0.1211 0.924 0.00 0.04 0.96 0.00
#> 1772082029_B12 1 0.1637 0.933 0.94 0.00 0.00 0.06
#> 1772082029_C01 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_C02 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772082029_C03 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772082029_C04 4 0.1211 0.923 0.04 0.00 0.00 0.96
#> 1772082029_C05 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772082029_C06 4 0.0707 0.950 0.00 0.02 0.00 0.98
#> 1772082029_C07 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_C09 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_C10 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772082029_C11 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_C12 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772082029_D01 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_D02 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772082029_D03 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772082029_D05 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_D06 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_D07 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772082029_D08 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_D09 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_D10 4 0.1637 0.929 0.00 0.06 0.00 0.94
#> 1772082029_D11 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772082029_D12 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_E01 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772082029_E02 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_E03 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772082029_E04 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772082029_E05 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_E06 1 0.0707 0.973 0.98 0.00 0.02 0.00
#> 1772082029_E07 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_E09 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772082029_E10 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772082029_E11 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_E12 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772082029_F01 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772082029_F02 4 0.3400 0.796 0.00 0.18 0.00 0.82
#> 1772082029_F03 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772082029_F04 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772082029_F05 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_F06 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_F07 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772082029_F10 4 0.0707 0.950 0.00 0.02 0.00 0.98
#> 1772082029_F11 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772082029_F12 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_G01 1 0.1211 0.954 0.96 0.00 0.00 0.04
#> 1772082029_G02 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_G03 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772082029_G04 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772082029_G05 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_G06 3 0.4277 0.617 0.28 0.00 0.72 0.00
#> 1772082029_G09 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_G10 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772082029_G11 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772082029_G12 4 0.2011 0.914 0.00 0.08 0.00 0.92
#> 1772082029_H02 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772082029_H03 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_H04 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772082029_H05 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772082029_H06 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_H07 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772082029_H08 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772082029_H10 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772082029_H11 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772082029_H12 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772084018_C07 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772084018_D12 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772092002_A07 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772092002_A10 4 0.1637 0.930 0.00 0.06 0.00 0.94
#> 1772092002_B05 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772092002_B10 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772092002_D10 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772092002_E07 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772092002_E10 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772092002_G05 4 0.3400 0.796 0.00 0.18 0.00 0.82
#> 1772092002_G07 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772092277_A10 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772094135_F02 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772094136_B06 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772094136_C02 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772094143_D09 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772094143_E08 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772096086_H03 4 0.0000 0.957 0.00 0.00 0.00 1.00
#> 1772096087_C09 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096087_E02 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096088_F01 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096091_A02 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096092_A02 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096092_A10 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096092_D08 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096093_A07 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096093_A11 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096093_B05 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096093_B10 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772096093_C10 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096094_A10 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096094_D01 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096094_D02 1 0.0707 0.973 0.98 0.00 0.02 0.00
#> 1772096094_D09 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096116_G04 3 0.0707 0.946 0.02 0.00 0.98 0.00
#> 1772096118_F09 1 0.4948 0.227 0.56 0.00 0.00 0.44
#> 1772096146_D02 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096146_D07 1 0.0707 0.973 0.98 0.00 0.02 0.00
#> 1772096146_D08 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096146_F07 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096149_F01 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096149_F12 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096149_G09 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096150_B08 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096150_C08 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096150_G01 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096150_H03 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096150_H04 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096151_C04 2 0.4907 0.281 0.00 0.58 0.42 0.00
#> 1772096151_D03 4 0.2921 0.847 0.00 0.14 0.00 0.86
#> 1772096151_D11 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096151_E01 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096151_H03 3 0.4790 0.398 0.38 0.00 0.62 0.00
#> 1772096151_H08 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772096151_H09 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772099002_A12 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772099002_C02 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772099002_C05 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772099002_D02 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772099002_E02 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772099002_E08 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772099002_F11 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772099002_G09 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772099002_H04 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772099003_A05 4 0.0707 0.942 0.02 0.00 0.00 0.98
#> 1772099003_F09 3 0.0000 0.968 0.00 0.00 1.00 0.00
#> 1772099003_H07 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772099008_A08 2 0.0000 0.987 0.00 1.00 0.00 0.00
#> 1772099008_G08 1 0.0707 0.973 0.98 0.00 0.02 0.00
#> 1772099008_H01 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772099009_E05 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772099011_D01 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772099011_F04 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772099011_G07 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772099011_H05 1 0.0000 0.989 1.00 0.00 0.00 0.00
#> 1772099012_E04 1 0.0000 0.989 1.00 0.00 0.00 0.00
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)
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)
As soon as the classes for columns are determined, the signatures that are significantly different between subgroups can be looked for. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
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)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. To get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows (which is done by automatically selecting number of clusters).If there are too many signatures, top_signatures = ...
can be set to only show the
signatures with the highest FDRs:
# code only for demonstration
# e.g. to show the top 500 most significant rows
tb = get_signature(res, k = ..., top_signatures = 500)
If the signatures are defined as these which are uniquely high in current group, diff_method
argument
can be set to "uniquely_high_in_one_group"
:
# code only for demonstration
tb = get_signature(res, k = ..., diff_method = "uniquely_high_in_one_group")
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")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n_sample Cell_type(p-value) k
#> ATC:skmeans 242 8.29e-13 2
#> ATC:skmeans 240 2.43e-11 3
#> ATC:skmeans 239 5.18e-13 4
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.
Parent node: Node0. Child nodes: Node011 , Node012 , Node021-leaf , Node022-leaf .
The object with results only for a single top-value method and a single partitioning method can be extracted as:
res = res_rh["01"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4.
#> On a matrix with 6396 rows and 94 columns.
#> Top rows (640) are extracted by 'ATC' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 150 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_partitions"
#> [7] "compare_signatures" "consensus_heatmap" "dimension_reduction"
#> [10] "functional_enrichment" "get_anno_col" "get_anno"
#> [13] "get_classes" "get_consensus" "get_matrix"
#> [16] "get_membership" "get_param" "get_signatures"
#> [19] "get_stats" "is_best_k" "is_stable_k"
#> [22] "membership_heatmap" "ncol" "nrow"
#> [25] "plot_ecdf" "predict_classes" "rownames"
#> [28] "select_partition_number" "show" "suggest_best_k"
#> [31] "test_to_known_factors" "top_rows_heatmap"
collect_plots()
function collects all the plots made from res
for all k
(number of subgroups)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, higher 1-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.506 0.495 0.495
#> 3 3 1.000 0.995 0.998 0.254 0.843 0.691
#> 4 4 0.905 0.920 0.947 0.118 0.921 0.785
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 4
#> attr(,"optional")
#> [1] 2 3
There is also optional best \(k\) = 2 3 that is worth to check.
Following is 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 subgroup
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> 1772072122_B09 2 0.000 1.000 0.00 1.00
#> 1772072122_C01 2 0.000 1.000 0.00 1.00
#> 1772072122_C10 2 0.000 1.000 0.00 1.00
#> 1772072122_E02 2 0.000 1.000 0.00 1.00
#> 1772072122_E09 2 0.000 1.000 0.00 1.00
#> 1772072122_F08 2 0.000 1.000 0.00 1.00
#> 1772072122_F10 2 0.000 1.000 0.00 1.00
#> 1772072122_G07 1 0.000 0.998 1.00 0.00
#> 1772072122_G08 2 0.000 1.000 0.00 1.00
#> 1772072122_H08 2 0.000 1.000 0.00 1.00
#> 1772082029_A03 2 0.000 1.000 0.00 1.00
#> 1772082029_A04 2 0.000 1.000 0.00 1.00
#> 1772082029_A05 2 0.000 1.000 0.00 1.00
#> 1772082029_A07 1 0.000 0.998 1.00 0.00
#> 1772082029_A08 2 0.000 1.000 0.00 1.00
#> 1772082029_B04 1 0.000 0.998 1.00 0.00
#> 1772082029_B06 2 0.000 1.000 0.00 1.00
#> 1772082029_B07 2 0.000 1.000 0.00 1.00
#> 1772082029_B09 1 0.327 0.937 0.94 0.06
#> 1772082029_B12 2 0.000 1.000 0.00 1.00
#> 1772082029_C12 2 0.000 1.000 0.00 1.00
#> 1772082029_D11 1 0.000 0.998 1.00 0.00
#> 1772082029_E04 2 0.000 1.000 0.00 1.00
#> 1772082029_E06 1 0.000 0.998 1.00 0.00
#> 1772082029_E09 1 0.000 0.998 1.00 0.00
#> 1772082029_F03 2 0.000 1.000 0.00 1.00
#> 1772082029_F04 1 0.000 0.998 1.00 0.00
#> 1772082029_G01 2 0.000 1.000 0.00 1.00
#> 1772082029_G03 2 0.000 1.000 0.00 1.00
#> 1772082029_G10 2 0.000 1.000 0.00 1.00
#> 1772082029_G11 2 0.000 1.000 0.00 1.00
#> 1772082029_H02 1 0.000 0.998 1.00 0.00
#> 1772082029_H08 2 0.000 1.000 0.00 1.00
#> 1772084018_C07 1 0.000 0.998 1.00 0.00
#> 1772084018_D12 1 0.000 0.998 1.00 0.00
#> 1772092002_A07 1 0.000 0.998 1.00 0.00
#> 1772092002_B10 2 0.000 1.000 0.00 1.00
#> 1772092002_D10 2 0.000 1.000 0.00 1.00
#> 1772092002_E07 1 0.000 0.998 1.00 0.00
#> 1772092002_E10 2 0.000 1.000 0.00 1.00
#> 1772092002_G07 1 0.000 0.998 1.00 0.00
#> 1772094135_F02 1 0.000 0.998 1.00 0.00
#> 1772094136_B06 1 0.000 0.998 1.00 0.00
#> 1772094136_C02 1 0.000 0.998 1.00 0.00
#> 1772094143_D09 1 0.000 0.998 1.00 0.00
#> 1772096087_C09 1 0.000 0.998 1.00 0.00
#> 1772096087_E02 1 0.000 0.998 1.00 0.00
#> 1772096088_F01 1 0.000 0.998 1.00 0.00
#> 1772096091_A02 2 0.000 1.000 0.00 1.00
#> 1772096092_A02 1 0.000 0.998 1.00 0.00
#> 1772096092_A10 1 0.000 0.998 1.00 0.00
#> 1772096092_D08 1 0.000 0.998 1.00 0.00
#> 1772096093_A07 1 0.000 0.998 1.00 0.00
#> 1772096093_A11 1 0.000 0.998 1.00 0.00
#> 1772096093_B05 2 0.000 1.000 0.00 1.00
#> 1772096093_C10 2 0.000 1.000 0.00 1.00
#> 1772096094_A10 2 0.000 1.000 0.00 1.00
#> 1772096094_D01 2 0.000 1.000 0.00 1.00
#> 1772096094_D02 1 0.000 0.998 1.00 0.00
#> 1772096094_D09 1 0.141 0.979 0.98 0.02
#> 1772096118_F09 2 0.000 1.000 0.00 1.00
#> 1772096146_D02 1 0.000 0.998 1.00 0.00
#> 1772096146_D07 1 0.000 0.998 1.00 0.00
#> 1772096146_D08 2 0.000 1.000 0.00 1.00
#> 1772096146_F07 1 0.000 0.998 1.00 0.00
#> 1772096149_F01 2 0.000 1.000 0.00 1.00
#> 1772096149_F12 1 0.000 0.998 1.00 0.00
#> 1772096149_G09 1 0.000 0.998 1.00 0.00
#> 1772096150_B08 2 0.000 1.000 0.00 1.00
#> 1772096150_C08 1 0.000 0.998 1.00 0.00
#> 1772096150_G01 2 0.000 1.000 0.00 1.00
#> 1772096150_H03 1 0.000 0.998 1.00 0.00
#> 1772096150_H04 2 0.000 1.000 0.00 1.00
#> 1772096151_D11 1 0.000 0.998 1.00 0.00
#> 1772096151_E01 2 0.000 1.000 0.00 1.00
#> 1772096151_H08 1 0.000 0.998 1.00 0.00
#> 1772096151_H09 1 0.000 0.998 1.00 0.00
#> 1772099002_A12 1 0.000 0.998 1.00 0.00
#> 1772099002_C02 2 0.000 1.000 0.00 1.00
#> 1772099002_C05 2 0.000 1.000 0.00 1.00
#> 1772099002_D02 2 0.000 1.000 0.00 1.00
#> 1772099002_E02 1 0.000 0.998 1.00 0.00
#> 1772099002_E08 2 0.000 1.000 0.00 1.00
#> 1772099002_F11 1 0.000 0.998 1.00 0.00
#> 1772099002_H04 1 0.000 0.998 1.00 0.00
#> 1772099003_H07 1 0.000 0.998 1.00 0.00
#> 1772099008_G08 2 0.000 1.000 0.00 1.00
#> 1772099008_H01 1 0.000 0.998 1.00 0.00
#> 1772099009_E05 1 0.000 0.998 1.00 0.00
#> 1772099011_D01 2 0.000 1.000 0.00 1.00
#> 1772099011_F04 1 0.141 0.979 0.98 0.02
#> 1772099011_G07 2 0.000 1.000 0.00 1.00
#> 1772099011_H05 1 0.000 0.998 1.00 0.00
#> 1772099012_E04 1 0.000 0.998 1.00 0.00
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> 1772072122_B09 2 0.000 1.000 0.00 1.00 0.00
#> 1772072122_C01 2 0.000 1.000 0.00 1.00 0.00
#> 1772072122_C10 2 0.000 1.000 0.00 1.00 0.00
#> 1772072122_E02 2 0.000 1.000 0.00 1.00 0.00
#> 1772072122_E09 2 0.000 1.000 0.00 1.00 0.00
#> 1772072122_F08 2 0.000 1.000 0.00 1.00 0.00
#> 1772072122_F10 2 0.000 1.000 0.00 1.00 0.00
#> 1772072122_G07 1 0.000 0.994 1.00 0.00 0.00
#> 1772072122_G08 2 0.000 1.000 0.00 1.00 0.00
#> 1772072122_H08 2 0.000 1.000 0.00 1.00 0.00
#> 1772082029_A03 2 0.000 1.000 0.00 1.00 0.00
#> 1772082029_A04 2 0.000 1.000 0.00 1.00 0.00
#> 1772082029_A05 2 0.000 1.000 0.00 1.00 0.00
#> 1772082029_A07 1 0.000 0.994 1.00 0.00 0.00
#> 1772082029_A08 2 0.000 1.000 0.00 1.00 0.00
#> 1772082029_B04 1 0.000 0.994 1.00 0.00 0.00
#> 1772082029_B06 2 0.000 1.000 0.00 1.00 0.00
#> 1772082029_B07 2 0.000 1.000 0.00 1.00 0.00
#> 1772082029_B09 1 0.207 0.926 0.94 0.06 0.00
#> 1772082029_B12 2 0.000 1.000 0.00 1.00 0.00
#> 1772082029_C12 2 0.000 1.000 0.00 1.00 0.00
#> 1772082029_D11 1 0.000 0.994 1.00 0.00 0.00
#> 1772082029_E04 2 0.000 1.000 0.00 1.00 0.00
#> 1772082029_E06 1 0.000 0.994 1.00 0.00 0.00
#> 1772082029_E09 1 0.000 0.994 1.00 0.00 0.00
#> 1772082029_F03 2 0.000 1.000 0.00 1.00 0.00
#> 1772082029_F04 1 0.000 0.994 1.00 0.00 0.00
#> 1772082029_G01 2 0.000 1.000 0.00 1.00 0.00
#> 1772082029_G03 2 0.000 1.000 0.00 1.00 0.00
#> 1772082029_G10 2 0.000 1.000 0.00 1.00 0.00
#> 1772082029_G11 2 0.000 1.000 0.00 1.00 0.00
#> 1772082029_H02 1 0.000 0.994 1.00 0.00 0.00
#> 1772082029_H08 2 0.000 1.000 0.00 1.00 0.00
#> 1772084018_C07 1 0.000 0.994 1.00 0.00 0.00
#> 1772084018_D12 1 0.000 0.994 1.00 0.00 0.00
#> 1772092002_A07 3 0.000 1.000 0.00 0.00 1.00
#> 1772092002_B10 3 0.000 1.000 0.00 0.00 1.00
#> 1772092002_D10 2 0.000 1.000 0.00 1.00 0.00
#> 1772092002_E07 3 0.000 1.000 0.00 0.00 1.00
#> 1772092002_E10 3 0.000 1.000 0.00 0.00 1.00
#> 1772092002_G07 3 0.000 1.000 0.00 0.00 1.00
#> 1772094135_F02 3 0.000 1.000 0.00 0.00 1.00
#> 1772094136_B06 1 0.000 0.994 1.00 0.00 0.00
#> 1772094136_C02 1 0.334 0.864 0.88 0.00 0.12
#> 1772094143_D09 1 0.000 0.994 1.00 0.00 0.00
#> 1772096087_C09 1 0.000 0.994 1.00 0.00 0.00
#> 1772096087_E02 1 0.000 0.994 1.00 0.00 0.00
#> 1772096088_F01 1 0.000 0.994 1.00 0.00 0.00
#> 1772096091_A02 2 0.000 1.000 0.00 1.00 0.00
#> 1772096092_A02 1 0.000 0.994 1.00 0.00 0.00
#> 1772096092_A10 1 0.000 0.994 1.00 0.00 0.00
#> 1772096092_D08 3 0.000 1.000 0.00 0.00 1.00
#> 1772096093_A07 3 0.000 1.000 0.00 0.00 1.00
#> 1772096093_A11 1 0.000 0.994 1.00 0.00 0.00
#> 1772096093_B05 3 0.000 1.000 0.00 0.00 1.00
#> 1772096093_C10 2 0.000 1.000 0.00 1.00 0.00
#> 1772096094_A10 2 0.000 1.000 0.00 1.00 0.00
#> 1772096094_D01 3 0.000 1.000 0.00 0.00 1.00
#> 1772096094_D02 1 0.000 0.994 1.00 0.00 0.00
#> 1772096094_D09 3 0.000 1.000 0.00 0.00 1.00
#> 1772096118_F09 2 0.000 1.000 0.00 1.00 0.00
#> 1772096146_D02 1 0.000 0.994 1.00 0.00 0.00
#> 1772096146_D07 1 0.000 0.994 1.00 0.00 0.00
#> 1772096146_D08 3 0.000 1.000 0.00 0.00 1.00
#> 1772096146_F07 1 0.000 0.994 1.00 0.00 0.00
#> 1772096149_F01 2 0.000 1.000 0.00 1.00 0.00
#> 1772096149_F12 1 0.000 0.994 1.00 0.00 0.00
#> 1772096149_G09 1 0.000 0.994 1.00 0.00 0.00
#> 1772096150_B08 2 0.000 1.000 0.00 1.00 0.00
#> 1772096150_C08 1 0.000 0.994 1.00 0.00 0.00
#> 1772096150_G01 2 0.000 1.000 0.00 1.00 0.00
#> 1772096150_H03 1 0.000 0.994 1.00 0.00 0.00
#> 1772096150_H04 2 0.000 1.000 0.00 1.00 0.00
#> 1772096151_D11 1 0.000 0.994 1.00 0.00 0.00
#> 1772096151_E01 2 0.000 1.000 0.00 1.00 0.00
#> 1772096151_H08 1 0.000 0.994 1.00 0.00 0.00
#> 1772096151_H09 1 0.000 0.994 1.00 0.00 0.00
#> 1772099002_A12 1 0.000 0.994 1.00 0.00 0.00
#> 1772099002_C02 3 0.000 1.000 0.00 0.00 1.00
#> 1772099002_C05 3 0.000 1.000 0.00 0.00 1.00
#> 1772099002_D02 3 0.000 1.000 0.00 0.00 1.00
#> 1772099002_E02 1 0.000 0.994 1.00 0.00 0.00
#> 1772099002_E08 2 0.000 1.000 0.00 1.00 0.00
#> 1772099002_F11 1 0.000 0.994 1.00 0.00 0.00
#> 1772099002_H04 1 0.000 0.994 1.00 0.00 0.00
#> 1772099003_H07 1 0.000 0.994 1.00 0.00 0.00
#> 1772099008_G08 2 0.000 1.000 0.00 1.00 0.00
#> 1772099008_H01 1 0.000 0.994 1.00 0.00 0.00
#> 1772099009_E05 1 0.000 0.994 1.00 0.00 0.00
#> 1772099011_D01 2 0.000 1.000 0.00 1.00 0.00
#> 1772099011_F04 1 0.153 0.950 0.96 0.04 0.00
#> 1772099011_G07 2 0.000 1.000 0.00 1.00 0.00
#> 1772099011_H05 1 0.000 0.994 1.00 0.00 0.00
#> 1772099012_E04 3 0.000 1.000 0.00 0.00 1.00
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> 1772072122_B09 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772072122_C01 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772072122_C10 2 0.0707 0.9690 0.00 0.98 0.00 0.02
#> 1772072122_E02 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772072122_E09 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772072122_F08 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772072122_F10 4 0.3975 0.6182 0.00 0.24 0.00 0.76
#> 1772072122_G07 4 0.3975 0.8985 0.24 0.00 0.00 0.76
#> 1772072122_G08 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772072122_H08 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772082029_A03 2 0.1211 0.9545 0.00 0.96 0.00 0.04
#> 1772082029_A04 2 0.0707 0.9690 0.00 0.98 0.00 0.02
#> 1772082029_A05 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772082029_A07 4 0.3975 0.8985 0.24 0.00 0.00 0.76
#> 1772082029_A08 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772082029_B04 4 0.3975 0.8985 0.24 0.00 0.00 0.76
#> 1772082029_B06 2 0.0707 0.9690 0.00 0.98 0.00 0.02
#> 1772082029_B07 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772082029_B09 4 0.1211 0.7527 0.04 0.00 0.00 0.96
#> 1772082029_B12 2 0.0707 0.9690 0.00 0.98 0.00 0.02
#> 1772082029_C12 2 0.0707 0.9690 0.00 0.98 0.00 0.02
#> 1772082029_D11 4 0.3801 0.8945 0.22 0.00 0.00 0.78
#> 1772082029_E04 2 0.0707 0.9690 0.00 0.98 0.00 0.02
#> 1772082029_E06 4 0.3975 0.8985 0.24 0.00 0.00 0.76
#> 1772082029_E09 4 0.3975 0.8985 0.24 0.00 0.00 0.76
#> 1772082029_F03 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772082029_F04 4 0.2647 0.7083 0.12 0.00 0.00 0.88
#> 1772082029_G01 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772082029_G03 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772082029_G10 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772082029_G11 2 0.4994 0.0484 0.00 0.52 0.00 0.48
#> 1772082029_H02 4 0.3801 0.8945 0.22 0.00 0.00 0.78
#> 1772082029_H08 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772084018_C07 1 0.1211 0.8890 0.96 0.00 0.00 0.04
#> 1772084018_D12 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772092002_A07 3 0.2011 0.8945 0.08 0.00 0.92 0.00
#> 1772092002_B10 3 0.0000 0.9876 0.00 0.00 1.00 0.00
#> 1772092002_D10 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772092002_E07 3 0.0000 0.9876 0.00 0.00 1.00 0.00
#> 1772092002_E10 3 0.0000 0.9876 0.00 0.00 1.00 0.00
#> 1772092002_G07 3 0.0000 0.9876 0.00 0.00 1.00 0.00
#> 1772094135_F02 3 0.1637 0.9208 0.06 0.00 0.94 0.00
#> 1772094136_B06 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772094136_C02 1 0.1211 0.8893 0.96 0.00 0.04 0.00
#> 1772094143_D09 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772096087_C09 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772096087_E02 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772096088_F01 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772096091_A02 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772096092_A02 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772096092_A10 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772096092_D08 3 0.0000 0.9876 0.00 0.00 1.00 0.00
#> 1772096093_A07 3 0.0000 0.9876 0.00 0.00 1.00 0.00
#> 1772096093_A11 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772096093_B05 3 0.0000 0.9876 0.00 0.00 1.00 0.00
#> 1772096093_C10 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772096094_A10 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772096094_D01 3 0.0000 0.9876 0.00 0.00 1.00 0.00
#> 1772096094_D02 4 0.3975 0.8985 0.24 0.00 0.00 0.76
#> 1772096094_D09 3 0.0000 0.9876 0.00 0.00 1.00 0.00
#> 1772096118_F09 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772096146_D02 1 0.3975 0.7490 0.76 0.00 0.00 0.24
#> 1772096146_D07 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772096146_D08 3 0.0000 0.9876 0.00 0.00 1.00 0.00
#> 1772096146_F07 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772096149_F01 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772096149_F12 1 0.3975 0.7490 0.76 0.00 0.00 0.24
#> 1772096149_G09 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772096150_B08 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772096150_C08 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772096150_G01 2 0.2706 0.8965 0.00 0.90 0.02 0.08
#> 1772096150_H03 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772096150_H04 2 0.0707 0.9690 0.00 0.98 0.00 0.02
#> 1772096151_D11 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772096151_E01 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772096151_H08 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772096151_H09 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772099002_A12 1 0.3801 0.7670 0.78 0.00 0.00 0.22
#> 1772099002_C02 3 0.0000 0.9876 0.00 0.00 1.00 0.00
#> 1772099002_C05 3 0.0000 0.9876 0.00 0.00 1.00 0.00
#> 1772099002_D02 3 0.0000 0.9876 0.00 0.00 1.00 0.00
#> 1772099002_E02 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772099002_E08 2 0.0707 0.9690 0.00 0.98 0.00 0.02
#> 1772099002_F11 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772099002_H04 1 0.3801 0.7670 0.78 0.00 0.00 0.22
#> 1772099003_H07 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772099008_G08 2 0.1211 0.9436 0.00 0.96 0.00 0.04
#> 1772099008_H01 1 0.3801 0.7670 0.78 0.00 0.00 0.22
#> 1772099009_E05 1 0.0000 0.9277 1.00 0.00 0.00 0.00
#> 1772099011_D01 2 0.0707 0.9690 0.00 0.98 0.00 0.02
#> 1772099011_F04 1 0.3975 0.7490 0.76 0.00 0.00 0.24
#> 1772099011_G07 2 0.0000 0.9765 0.00 1.00 0.00 0.00
#> 1772099011_H05 1 0.3801 0.7670 0.78 0.00 0.00 0.22
#> 1772099012_E04 3 0.0000 0.9876 0.00 0.00 1.00 0.00
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)
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)
As soon as the classes for columns are determined, the signatures that are significantly different between subgroups can be looked for. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
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)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. To get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows (which is done by automatically selecting number of clusters).If there are too many signatures, top_signatures = ...
can be set to only show the
signatures with the highest FDRs:
# code only for demonstration
# e.g. to show the top 500 most significant rows
tb = get_signature(res, k = ..., top_signatures = 500)
If the signatures are defined as these which are uniquely high in current group, diff_method
argument
can be set to "uniquely_high_in_one_group"
:
# code only for demonstration
tb = get_signature(res, k = ..., diff_method = "uniquely_high_in_one_group")
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")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n_sample Cell_type(p-value) k
#> ATC:skmeans 94 5.18e-01 2
#> ATC:skmeans 94 7.18e-05 3
#> ATC:skmeans 93 9.81e-04 4
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.
Parent node: Node01. Child nodes: Node0111-leaf , Node0112-leaf , Node0113-leaf , Node0121-leaf , Node0122-leaf , Node0123-leaf .
The object with results only for a single top-value method and a single partitioning method can be extracted as:
res = res_rh["011"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4.
#> On a matrix with 6611 rows and 48 columns.
#> Top rows (661) are extracted by 'ATC' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 150 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_partitions"
#> [7] "compare_signatures" "consensus_heatmap" "dimension_reduction"
#> [10] "functional_enrichment" "get_anno_col" "get_anno"
#> [13] "get_classes" "get_consensus" "get_matrix"
#> [16] "get_membership" "get_param" "get_signatures"
#> [19] "get_stats" "is_best_k" "is_stable_k"
#> [22] "membership_heatmap" "ncol" "nrow"
#> [25] "plot_ecdf" "predict_classes" "rownames"
#> [28] "select_partition_number" "show" "suggest_best_k"
#> [31] "test_to_known_factors" "top_rows_heatmap"
collect_plots()
function collects all the plots made from res
for all k
(number of subgroups)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, higher 1-PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.997 0.998 0.469 0.533 0.533
#> 3 3 1.000 0.971 0.987 0.441 0.707 0.492
#> 4 4 0.896 0.914 0.955 0.131 0.824 0.522
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
#> attr(,"optional")
#> [1] 2
There is also optional best \(k\) = 2 that is worth to check.
Following is 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 subgroup
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> 1772072122_G07 1 0.000 0.997 1.00 0.00
#> 1772082029_A07 1 0.000 0.997 1.00 0.00
#> 1772082029_B04 1 0.000 0.997 1.00 0.00
#> 1772082029_B09 1 0.000 0.997 1.00 0.00
#> 1772082029_D11 1 0.000 0.997 1.00 0.00
#> 1772082029_E06 1 0.000 0.997 1.00 0.00
#> 1772082029_E09 1 0.000 0.997 1.00 0.00
#> 1772082029_F04 1 0.000 0.997 1.00 0.00
#> 1772082029_H02 1 0.000 0.997 1.00 0.00
#> 1772084018_C07 1 0.000 0.997 1.00 0.00
#> 1772084018_D12 2 0.000 1.000 0.00 1.00
#> 1772092002_A07 2 0.000 1.000 0.00 1.00
#> 1772092002_E07 2 0.000 1.000 0.00 1.00
#> 1772092002_G07 2 0.000 1.000 0.00 1.00
#> 1772094135_F02 2 0.000 1.000 0.00 1.00
#> 1772094136_B06 2 0.000 1.000 0.00 1.00
#> 1772094136_C02 2 0.000 1.000 0.00 1.00
#> 1772094143_D09 2 0.000 1.000 0.00 1.00
#> 1772096087_C09 1 0.402 0.913 0.92 0.08
#> 1772096087_E02 1 0.000 0.997 1.00 0.00
#> 1772096088_F01 1 0.000 0.997 1.00 0.00
#> 1772096092_A02 1 0.000 0.997 1.00 0.00
#> 1772096092_A10 1 0.000 0.997 1.00 0.00
#> 1772096092_D08 2 0.000 1.000 0.00 1.00
#> 1772096093_A07 2 0.000 1.000 0.00 1.00
#> 1772096093_A11 2 0.000 1.000 0.00 1.00
#> 1772096094_D02 2 0.000 1.000 0.00 1.00
#> 1772096094_D09 2 0.000 1.000 0.00 1.00
#> 1772096146_D02 1 0.000 0.997 1.00 0.00
#> 1772096146_D07 2 0.000 1.000 0.00 1.00
#> 1772096146_F07 2 0.000 1.000 0.00 1.00
#> 1772096149_F12 1 0.000 0.997 1.00 0.00
#> 1772096149_G09 1 0.000 0.997 1.00 0.00
#> 1772096150_C08 1 0.000 0.997 1.00 0.00
#> 1772096150_H03 1 0.000 0.997 1.00 0.00
#> 1772096151_D11 2 0.000 1.000 0.00 1.00
#> 1772096151_H08 1 0.000 0.997 1.00 0.00
#> 1772096151_H09 1 0.000 0.997 1.00 0.00
#> 1772099002_A12 1 0.000 0.997 1.00 0.00
#> 1772099002_E02 1 0.000 0.997 1.00 0.00
#> 1772099002_F11 1 0.000 0.997 1.00 0.00
#> 1772099002_H04 1 0.000 0.997 1.00 0.00
#> 1772099003_H07 1 0.000 0.997 1.00 0.00
#> 1772099008_H01 1 0.000 0.997 1.00 0.00
#> 1772099009_E05 1 0.000 0.997 1.00 0.00
#> 1772099011_F04 1 0.000 0.997 1.00 0.00
#> 1772099011_H05 1 0.000 0.997 1.00 0.00
#> 1772099012_E04 2 0.000 1.000 0.00 1.00
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> 1772072122_G07 3 0.000 0.982 0.00 0.00 1.00
#> 1772082029_A07 3 0.000 0.982 0.00 0.00 1.00
#> 1772082029_B04 3 0.000 0.982 0.00 0.00 1.00
#> 1772082029_B09 3 0.455 0.757 0.20 0.00 0.80
#> 1772082029_D11 3 0.000 0.982 0.00 0.00 1.00
#> 1772082029_E06 3 0.000 0.982 0.00 0.00 1.00
#> 1772082029_E09 3 0.000 0.982 0.00 0.00 1.00
#> 1772082029_F04 1 0.000 0.978 1.00 0.00 0.00
#> 1772082029_H02 3 0.000 0.982 0.00 0.00 1.00
#> 1772084018_C07 3 0.000 0.982 0.00 0.00 1.00
#> 1772084018_D12 1 0.522 0.651 0.74 0.26 0.00
#> 1772092002_A07 2 0.000 1.000 0.00 1.00 0.00
#> 1772092002_E07 2 0.000 1.000 0.00 1.00 0.00
#> 1772092002_G07 2 0.000 1.000 0.00 1.00 0.00
#> 1772094135_F02 2 0.000 1.000 0.00 1.00 0.00
#> 1772094136_B06 2 0.000 1.000 0.00 1.00 0.00
#> 1772094136_C02 2 0.000 1.000 0.00 1.00 0.00
#> 1772094143_D09 2 0.000 1.000 0.00 1.00 0.00
#> 1772096087_C09 3 0.000 0.982 0.00 0.00 1.00
#> 1772096087_E02 1 0.000 0.978 1.00 0.00 0.00
#> 1772096088_F01 1 0.000 0.978 1.00 0.00 0.00
#> 1772096092_A02 1 0.000 0.978 1.00 0.00 0.00
#> 1772096092_A10 1 0.000 0.978 1.00 0.00 0.00
#> 1772096092_D08 2 0.000 1.000 0.00 1.00 0.00
#> 1772096093_A07 2 0.000 1.000 0.00 1.00 0.00
#> 1772096093_A11 1 0.000 0.978 1.00 0.00 0.00
#> 1772096094_D02 3 0.000 0.982 0.00 0.00 1.00
#> 1772096094_D09 2 0.000 1.000 0.00 1.00 0.00
#> 1772096146_D02 1 0.000 0.978 1.00 0.00 0.00
#> 1772096146_D07 2 0.000 1.000 0.00 1.00 0.00
#> 1772096146_F07 2 0.000 1.000 0.00 1.00 0.00
#> 1772096149_F12 1 0.000 0.978 1.00 0.00 0.00
#> 1772096149_G09 3 0.000 0.982 0.00 0.00 1.00
#> 1772096150_C08 1 0.153 0.945 0.96 0.00 0.04
#> 1772096150_H03 1 0.000 0.978 1.00 0.00 0.00
#> 1772096151_D11 2 0.000 1.000 0.00 1.00 0.00
#> 1772096151_H08 3 0.000 0.982 0.00 0.00 1.00
#> 1772096151_H09 1 0.000 0.978 1.00 0.00 0.00
#> 1772099002_A12 1 0.000 0.978 1.00 0.00 0.00
#> 1772099002_E02 1 0.254 0.904 0.92 0.00 0.08
#> 1772099002_F11 3 0.000 0.982 0.00 0.00 1.00
#> 1772099002_H04 1 0.000 0.978 1.00 0.00 0.00
#> 1772099003_H07 3 0.153 0.948 0.04 0.00 0.96
#> 1772099008_H01 1 0.000 0.978 1.00 0.00 0.00
#> 1772099009_E05 1 0.000 0.978 1.00 0.00 0.00
#> 1772099011_F04 1 0.000 0.978 1.00 0.00 0.00
#> 1772099011_H05 1 0.000 0.978 1.00 0.00 0.00
#> 1772099012_E04 2 0.000 1.000 0.00 1.00 0.00
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> 1772072122_G07 3 0.0000 0.971 0.00 0.00 1.00 0.00
#> 1772082029_A07 3 0.0000 0.971 0.00 0.00 1.00 0.00
#> 1772082029_B04 3 0.0000 0.971 0.00 0.00 1.00 0.00
#> 1772082029_B09 1 0.0000 0.965 1.00 0.00 0.00 0.00
#> 1772082029_D11 3 0.0000 0.971 0.00 0.00 1.00 0.00
#> 1772082029_E06 3 0.0000 0.971 0.00 0.00 1.00 0.00
#> 1772082029_E09 3 0.0000 0.971 0.00 0.00 1.00 0.00
#> 1772082029_F04 1 0.0000 0.965 1.00 0.00 0.00 0.00
#> 1772082029_H02 3 0.1637 0.927 0.06 0.00 0.94 0.00
#> 1772084018_C07 3 0.3172 0.813 0.16 0.00 0.84 0.00
#> 1772084018_D12 4 0.2647 0.834 0.00 0.12 0.00 0.88
#> 1772092002_A07 2 0.0000 0.972 0.00 1.00 0.00 0.00
#> 1772092002_E07 2 0.0000 0.972 0.00 1.00 0.00 0.00
#> 1772092002_G07 2 0.0000 0.972 0.00 1.00 0.00 0.00
#> 1772094135_F02 2 0.0000 0.972 0.00 1.00 0.00 0.00
#> 1772094136_B06 4 0.3172 0.790 0.00 0.16 0.00 0.84
#> 1772094136_C02 2 0.0707 0.966 0.00 0.98 0.00 0.02
#> 1772094143_D09 2 0.0707 0.966 0.00 0.98 0.00 0.02
#> 1772096087_C09 3 0.0000 0.971 0.00 0.00 1.00 0.00
#> 1772096087_E02 4 0.0000 0.899 0.00 0.00 0.00 1.00
#> 1772096088_F01 4 0.0707 0.905 0.02 0.00 0.00 0.98
#> 1772096092_A02 1 0.1211 0.931 0.96 0.00 0.00 0.04
#> 1772096092_A10 4 0.0707 0.905 0.02 0.00 0.00 0.98
#> 1772096092_D08 2 0.0000 0.972 0.00 1.00 0.00 0.00
#> 1772096093_A07 2 0.0000 0.972 0.00 1.00 0.00 0.00
#> 1772096093_A11 4 0.4284 0.759 0.20 0.02 0.00 0.78
#> 1772096094_D02 3 0.0000 0.971 0.00 0.00 1.00 0.00
#> 1772096094_D09 2 0.0000 0.972 0.00 1.00 0.00 0.00
#> 1772096146_D02 1 0.0000 0.965 1.00 0.00 0.00 0.00
#> 1772096146_D07 2 0.4797 0.648 0.00 0.72 0.26 0.02
#> 1772096146_F07 2 0.0707 0.966 0.00 0.98 0.00 0.02
#> 1772096149_F12 1 0.0000 0.965 1.00 0.00 0.00 0.00
#> 1772096149_G09 4 0.0707 0.899 0.00 0.00 0.02 0.98
#> 1772096150_C08 4 0.0707 0.905 0.02 0.00 0.00 0.98
#> 1772096150_H03 4 0.4277 0.646 0.28 0.00 0.00 0.72
#> 1772096151_D11 2 0.0707 0.966 0.00 0.98 0.00 0.02
#> 1772096151_H08 4 0.0707 0.899 0.00 0.00 0.02 0.98
#> 1772096151_H09 4 0.0707 0.905 0.02 0.00 0.00 0.98
#> 1772099002_A12 1 0.0000 0.965 1.00 0.00 0.00 0.00
#> 1772099002_E02 1 0.4936 0.588 0.70 0.00 0.02 0.28
#> 1772099002_F11 3 0.1637 0.924 0.00 0.00 0.94 0.06
#> 1772099002_H04 1 0.0000 0.965 1.00 0.00 0.00 0.00
#> 1772099003_H07 4 0.4755 0.695 0.04 0.00 0.20 0.76
#> 1772099008_H01 1 0.0000 0.965 1.00 0.00 0.00 0.00
#> 1772099009_E05 4 0.0707 0.905 0.02 0.00 0.00 0.98
#> 1772099011_F04 1 0.0000 0.965 1.00 0.00 0.00 0.00
#> 1772099011_H05 1 0.0000 0.965 1.00 0.00 0.00 0.00
#> 1772099012_E04 2 0.0000 0.972 0.00 1.00 0.00 0.00
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)
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)
As soon as the classes for columns are determined, the signatures that are significantly different between subgroups can be looked for. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
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)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. To get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows (which is done by automatically selecting number of clusters).If there are too many signatures, top_signatures = ...
can be set to only show the
signatures with the highest FDRs:
# code only for demonstration
# e.g. to show the top 500 most significant rows
tb = get_signature(res, k = ..., top_signatures = 500)
If the signatures are defined as these which are uniquely high in current group, diff_method
argument
can be set to "uniquely_high_in_one_group"
:
# code only for demonstration
tb = get_signature(res, k = ..., diff_method = "uniquely_high_in_one_group")
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")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n_sample Cell_type(p-value) k
#> ATC:skmeans 48 0.0434 2
#> ATC:skmeans 48 0.0779 3
#> ATC:skmeans 48 0.1198 4
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.
Parent node: Node01. Child nodes: Node0111-leaf , Node0112-leaf , Node0113-leaf , Node0121-leaf , Node0122-leaf , Node0123-leaf .
The object with results only for a single top-value method and a single partitioning method can be extracted as:
res = res_rh["012"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4.
#> On a matrix with 6223 rows and 46 columns.
#> Top rows (622) are extracted by 'ATC' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 150 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_partitions"
#> [7] "compare_signatures" "consensus_heatmap" "dimension_reduction"
#> [10] "functional_enrichment" "get_anno_col" "get_anno"
#> [13] "get_classes" "get_consensus" "get_matrix"
#> [16] "get_membership" "get_param" "get_signatures"
#> [19] "get_stats" "is_best_k" "is_stable_k"
#> [22] "membership_heatmap" "ncol" "nrow"
#> [25] "plot_ecdf" "predict_classes" "rownames"
#> [28] "select_partition_number" "show" "suggest_best_k"
#> [31] "test_to_known_factors" "top_rows_heatmap"
collect_plots()
function collects all the plots made from res
for all k
(number of subgroups)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, higher 1-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.980 0.991 0.509 0.490 0.490
#> 3 3 0.999 0.964 0.985 0.228 0.887 0.769
#> 4 4 0.670 0.609 0.782 0.162 0.843 0.600
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 3
#> attr(,"optional")
#> [1] 2
There is also optional best \(k\) = 2 that is worth to check.
Following is 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 subgroup
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> 1772072122_B09 1 0.000 1.000 1.00 0.00
#> 1772072122_C01 1 0.000 1.000 1.00 0.00
#> 1772072122_C10 1 0.000 1.000 1.00 0.00
#> 1772072122_E02 1 0.000 1.000 1.00 0.00
#> 1772072122_E09 1 0.000 1.000 1.00 0.00
#> 1772072122_F08 1 0.000 1.000 1.00 0.00
#> 1772072122_F10 1 0.000 1.000 1.00 0.00
#> 1772072122_G08 1 0.000 1.000 1.00 0.00
#> 1772072122_H08 1 0.000 1.000 1.00 0.00
#> 1772082029_A03 1 0.000 1.000 1.00 0.00
#> 1772082029_A04 1 0.000 1.000 1.00 0.00
#> 1772082029_A05 1 0.000 1.000 1.00 0.00
#> 1772082029_A08 1 0.000 1.000 1.00 0.00
#> 1772082029_B06 1 0.000 1.000 1.00 0.00
#> 1772082029_B07 1 0.000 1.000 1.00 0.00
#> 1772082029_B12 1 0.000 1.000 1.00 0.00
#> 1772082029_C12 1 0.000 1.000 1.00 0.00
#> 1772082029_E04 1 0.000 1.000 1.00 0.00
#> 1772082029_F03 1 0.000 1.000 1.00 0.00
#> 1772082029_G01 1 0.000 1.000 1.00 0.00
#> 1772082029_G03 1 0.000 1.000 1.00 0.00
#> 1772082029_G10 1 0.000 1.000 1.00 0.00
#> 1772082029_G11 1 0.000 1.000 1.00 0.00
#> 1772082029_H08 1 0.000 1.000 1.00 0.00
#> 1772092002_B10 2 0.000 0.980 0.00 1.00
#> 1772092002_D10 2 0.000 0.980 0.00 1.00
#> 1772092002_E10 2 0.000 0.980 0.00 1.00
#> 1772096091_A02 2 0.000 0.980 0.00 1.00
#> 1772096093_B05 2 0.000 0.980 0.00 1.00
#> 1772096093_C10 2 0.000 0.980 0.00 1.00
#> 1772096094_A10 2 0.000 0.980 0.00 1.00
#> 1772096094_D01 2 0.000 0.980 0.00 1.00
#> 1772096118_F09 2 0.000 0.980 0.00 1.00
#> 1772096146_D08 2 0.000 0.980 0.00 1.00
#> 1772096149_F01 2 0.000 0.980 0.00 1.00
#> 1772096150_B08 2 0.000 0.980 0.00 1.00
#> 1772096150_G01 2 0.000 0.980 0.00 1.00
#> 1772096150_H04 2 0.000 0.980 0.00 1.00
#> 1772096151_E01 2 0.000 0.980 0.00 1.00
#> 1772099002_C02 2 0.000 0.980 0.00 1.00
#> 1772099002_C05 2 0.000 0.980 0.00 1.00
#> 1772099002_D02 2 0.000 0.980 0.00 1.00
#> 1772099002_E08 2 0.795 0.698 0.24 0.76
#> 1772099008_G08 2 0.000 0.980 0.00 1.00
#> 1772099011_D01 2 0.680 0.787 0.18 0.82
#> 1772099011_G07 2 0.000 0.980 0.00 1.00
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> 1772072122_B09 1 0.0000 0.999 1.00 0.00 0.00
#> 1772072122_C01 1 0.0000 0.999 1.00 0.00 0.00
#> 1772072122_C10 1 0.0000 0.999 1.00 0.00 0.00
#> 1772072122_E02 1 0.0000 0.999 1.00 0.00 0.00
#> 1772072122_E09 1 0.0892 0.979 0.98 0.02 0.00
#> 1772072122_F08 1 0.0000 0.999 1.00 0.00 0.00
#> 1772072122_F10 1 0.0000 0.999 1.00 0.00 0.00
#> 1772072122_G08 1 0.0000 0.999 1.00 0.00 0.00
#> 1772072122_H08 1 0.0000 0.999 1.00 0.00 0.00
#> 1772082029_A03 1 0.0000 0.999 1.00 0.00 0.00
#> 1772082029_A04 1 0.0000 0.999 1.00 0.00 0.00
#> 1772082029_A05 1 0.0000 0.999 1.00 0.00 0.00
#> 1772082029_A08 1 0.0000 0.999 1.00 0.00 0.00
#> 1772082029_B06 1 0.0000 0.999 1.00 0.00 0.00
#> 1772082029_B07 1 0.0000 0.999 1.00 0.00 0.00
#> 1772082029_B12 1 0.0000 0.999 1.00 0.00 0.00
#> 1772082029_C12 1 0.0000 0.999 1.00 0.00 0.00
#> 1772082029_E04 1 0.0000 0.999 1.00 0.00 0.00
#> 1772082029_F03 1 0.0000 0.999 1.00 0.00 0.00
#> 1772082029_G01 1 0.0000 0.999 1.00 0.00 0.00
#> 1772082029_G03 1 0.0000 0.999 1.00 0.00 0.00
#> 1772082029_G10 1 0.0000 0.999 1.00 0.00 0.00
#> 1772082029_G11 1 0.0000 0.999 1.00 0.00 0.00
#> 1772082029_H08 1 0.0000 0.999 1.00 0.00 0.00
#> 1772092002_B10 3 0.0000 0.992 0.00 0.00 1.00
#> 1772092002_D10 2 0.0000 0.948 0.00 1.00 0.00
#> 1772092002_E10 3 0.0000 0.992 0.00 0.00 1.00
#> 1772096091_A02 2 0.0000 0.948 0.00 1.00 0.00
#> 1772096093_B05 3 0.0000 0.992 0.00 0.00 1.00
#> 1772096093_C10 2 0.6192 0.268 0.00 0.58 0.42
#> 1772096094_A10 2 0.0000 0.948 0.00 1.00 0.00
#> 1772096094_D01 3 0.0000 0.992 0.00 0.00 1.00
#> 1772096118_F09 2 0.0000 0.948 0.00 1.00 0.00
#> 1772096146_D08 3 0.0000 0.992 0.00 0.00 1.00
#> 1772096149_F01 2 0.0000 0.948 0.00 1.00 0.00
#> 1772096150_B08 2 0.0000 0.948 0.00 1.00 0.00
#> 1772096150_G01 3 0.2066 0.931 0.00 0.06 0.94
#> 1772096150_H04 2 0.0000 0.948 0.00 1.00 0.00
#> 1772096151_E01 2 0.0000 0.948 0.00 1.00 0.00
#> 1772099002_C02 3 0.0000 0.992 0.00 0.00 1.00
#> 1772099002_C05 3 0.0000 0.992 0.00 0.00 1.00
#> 1772099002_D02 3 0.0000 0.992 0.00 0.00 1.00
#> 1772099002_E08 2 0.2066 0.910 0.00 0.94 0.06
#> 1772099008_G08 2 0.2537 0.889 0.00 0.92 0.08
#> 1772099011_D01 2 0.1529 0.925 0.00 0.96 0.04
#> 1772099011_G07 2 0.0000 0.948 0.00 1.00 0.00
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> 1772072122_B09 1 0.1637 0.526 0.94 0.00 0.00 0.06
#> 1772072122_C01 1 0.5000 -0.587 0.50 0.00 0.00 0.50
#> 1772072122_C10 4 0.4790 0.943 0.38 0.00 0.00 0.62
#> 1772072122_E02 1 0.2345 0.532 0.90 0.00 0.00 0.10
#> 1772072122_E09 1 0.2011 0.545 0.92 0.00 0.00 0.08
#> 1772072122_F08 1 0.2011 0.529 0.92 0.00 0.00 0.08
#> 1772072122_F10 1 0.1211 0.536 0.96 0.00 0.00 0.04
#> 1772072122_G08 1 0.4948 -0.344 0.56 0.00 0.00 0.44
#> 1772072122_H08 1 0.2647 0.498 0.88 0.00 0.00 0.12
#> 1772082029_A03 4 0.4713 0.975 0.36 0.00 0.00 0.64
#> 1772082029_A04 4 0.4522 0.891 0.32 0.00 0.00 0.68
#> 1772082029_A05 1 0.3801 0.422 0.78 0.00 0.00 0.22
#> 1772082029_A08 1 0.4907 -0.256 0.58 0.00 0.00 0.42
#> 1772082029_B06 4 0.4713 0.975 0.36 0.00 0.00 0.64
#> 1772082029_B07 1 0.4907 -0.256 0.58 0.00 0.00 0.42
#> 1772082029_B12 4 0.4713 0.975 0.36 0.00 0.00 0.64
#> 1772082029_C12 4 0.4713 0.975 0.36 0.00 0.00 0.64
#> 1772082029_E04 4 0.4713 0.975 0.36 0.00 0.00 0.64
#> 1772082029_F03 4 0.4790 0.943 0.38 0.00 0.00 0.62
#> 1772082029_G01 1 0.4907 -0.273 0.58 0.00 0.00 0.42
#> 1772082029_G03 1 0.3400 0.432 0.82 0.00 0.00 0.18
#> 1772082029_G10 4 0.4713 0.975 0.36 0.00 0.00 0.64
#> 1772082029_G11 1 0.0707 0.546 0.98 0.00 0.00 0.02
#> 1772082029_H08 1 0.4406 0.155 0.70 0.00 0.00 0.30
#> 1772092002_B10 3 0.0000 0.948 0.00 0.00 1.00 0.00
#> 1772092002_D10 2 0.5661 0.743 0.08 0.70 0.00 0.22
#> 1772092002_E10 3 0.0000 0.948 0.00 0.00 1.00 0.00
#> 1772096091_A02 2 0.5820 0.739 0.08 0.68 0.00 0.24
#> 1772096093_B05 3 0.0000 0.948 0.00 0.00 1.00 0.00
#> 1772096093_C10 2 0.3172 0.673 0.00 0.84 0.16 0.00
#> 1772096094_A10 2 0.0000 0.791 0.00 1.00 0.00 0.00
#> 1772096094_D01 3 0.0000 0.948 0.00 0.00 1.00 0.00
#> 1772096118_F09 2 0.0000 0.791 0.00 1.00 0.00 0.00
#> 1772096146_D08 3 0.0000 0.948 0.00 0.00 1.00 0.00
#> 1772096149_F01 2 0.5661 0.743 0.08 0.70 0.00 0.22
#> 1772096150_B08 2 0.0000 0.791 0.00 1.00 0.00 0.00
#> 1772096150_G01 3 0.6382 0.381 0.00 0.34 0.58 0.08
#> 1772096150_H04 2 0.3975 0.749 0.00 0.76 0.00 0.24
#> 1772096151_E01 2 0.0000 0.791 0.00 1.00 0.00 0.00
#> 1772099002_C02 3 0.0000 0.948 0.00 0.00 1.00 0.00
#> 1772099002_C05 3 0.0000 0.948 0.00 0.00 1.00 0.00
#> 1772099002_D02 3 0.0000 0.948 0.00 0.00 1.00 0.00
#> 1772099002_E08 2 0.5535 0.541 0.00 0.56 0.02 0.42
#> 1772099008_G08 1 0.8797 -0.255 0.44 0.22 0.06 0.28
#> 1772099011_D01 2 0.5570 0.565 0.00 0.54 0.02 0.44
#> 1772099011_G07 2 0.5327 0.751 0.06 0.72 0.00 0.22
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)
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)
As soon as the classes for columns are determined, the signatures that are significantly different between subgroups can be looked for. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
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)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. To get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows (which is done by automatically selecting number of clusters).If there are too many signatures, top_signatures = ...
can be set to only show the
signatures with the highest FDRs:
# code only for demonstration
# e.g. to show the top 500 most significant rows
tb = get_signature(res, k = ..., top_signatures = 500)
If the signatures are defined as these which are uniquely high in current group, diff_method
argument
can be set to "uniquely_high_in_one_group"
:
# code only for demonstration
tb = get_signature(res, k = ..., diff_method = "uniquely_high_in_one_group")
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")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n_sample Cell_type(p-value) k
#> ATC:skmeans 46 0.117 2
#> ATC:skmeans 45 0.170 3
#> ATC:skmeans 35 0.400 4
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.
Parent node: Node0. Child nodes: Node011 , Node012 , Node021-leaf , Node022-leaf .
The object with results only for a single top-value method and a single partitioning method can be extracted as:
res = res_rh["02"]
A summary of res
and all the functions that can be applied to it:
res
#> A 'ConsensusPartition' object with k = 2, 3, 4.
#> On a matrix with 6257 rows and 75 columns.
#> Top rows (626) are extracted by 'ATC' method.
#> Subgroups are detected by 'skmeans' method.
#> Performed in total 150 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_partitions"
#> [7] "compare_signatures" "consensus_heatmap" "dimension_reduction"
#> [10] "functional_enrichment" "get_anno_col" "get_anno"
#> [13] "get_classes" "get_consensus" "get_matrix"
#> [16] "get_membership" "get_param" "get_signatures"
#> [19] "get_stats" "is_best_k" "is_stable_k"
#> [22] "membership_heatmap" "ncol" "nrow"
#> [25] "plot_ecdf" "predict_classes" "rownames"
#> [28] "select_partition_number" "show" "suggest_best_k"
#> [31] "test_to_known_factors" "top_rows_heatmap"
collect_plots()
function collects all the plots made from res
for all k
(number of subgroups)
into one single page to provide an easy and fast comparison between different k
.
collect_plots(res)
The plots are:
k
and the heatmap of
predicted classes for each k
.k
.k
.k
.All the plots in panels can be made by individual functions and they are plotted later in this section.
select_partition_number()
produces several plots showing different
statistics for choosing “optimized” k
. There are following statistics:
k
;k
, the area increased is defined as \(A_k - A_{k-1}\).The detailed explanations of these statistics can be found in the cola vignette.
Generally speaking, higher 1-PAC score, higher mean silhouette score or higher
concordance corresponds to better partition. Rand index and Jaccard index
measure how similar the current partition is compared to partition with k-1
.
If they are too similar, we won't accept k
is better than k-1
.
select_partition_number(res)
The numeric values for all these statistics can be obtained by get_stats()
.
get_stats(res)
#> k 1-PAC mean_silhouette concordance area_increased Rand Jaccard
#> 2 2 1.000 0.982 0.991 0.502 0.498 0.498
#> 3 3 0.806 0.839 0.925 0.302 0.814 0.643
#> 4 4 0.766 0.732 0.875 0.102 0.846 0.608
suggest_best_k()
suggests the best \(k\) based on these statistics. The rules are as follows:
suggest_best_k(res)
#> [1] 2
Following is 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 subgroup
label for an item is determined with the group with highest probability it
belongs to.
In get_classes()
function, the entropy is calculated from the membership
matrix and the silhouette score is calculated from the consensus matrix.
cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#> class entropy silhouette p1 p2
#> 1772072122_A04 2 0.000 0.997 0.00 1.00
#> 1772072122_A05 1 0.000 0.984 1.00 0.00
#> 1772072122_A06 1 0.000 0.984 1.00 0.00
#> 1772072122_A07 2 0.000 0.997 0.00 1.00
#> 1772072122_A08 1 0.000 0.984 1.00 0.00
#> 1772072122_A10 2 0.000 0.997 0.00 1.00
#> 1772072122_A12 1 0.000 0.984 1.00 0.00
#> 1772072122_B01 1 0.000 0.984 1.00 0.00
#> 1772072122_B02 1 0.000 0.984 1.00 0.00
#> 1772072122_B03 1 0.000 0.984 1.00 0.00
#> 1772072122_B05 1 0.000 0.984 1.00 0.00
#> 1772072122_B06 2 0.000 0.997 0.00 1.00
#> 1772072122_B07 1 0.722 0.761 0.80 0.20
#> 1772072122_B08 1 0.000 0.984 1.00 0.00
#> 1772072122_C03 1 0.000 0.984 1.00 0.00
#> 1772072122_C05 1 0.000 0.984 1.00 0.00
#> 1772072122_C09 2 0.469 0.888 0.10 0.90
#> 1772072122_C11 1 0.000 0.984 1.00 0.00
#> 1772072122_C12 1 0.000 0.984 1.00 0.00
#> 1772072122_D01 1 0.000 0.984 1.00 0.00
#> 1772072122_D04 2 0.000 0.997 0.00 1.00
#> 1772072122_D05 1 0.000 0.984 1.00 0.00
#> 1772072122_E03 2 0.000 0.997 0.00 1.00
#> 1772072122_E04 2 0.000 0.997 0.00 1.00
#> 1772072122_E06 2 0.000 0.997 0.00 1.00
#> 1772072122_E08 1 0.634 0.816 0.84 0.16
#> 1772072122_F01 2 0.000 0.997 0.00 1.00
#> 1772072122_F02 2 0.000 0.997 0.00 1.00
#> 1772072122_F04 2 0.000 0.997 0.00 1.00
#> 1772072122_F06 2 0.000 0.997 0.00 1.00
#> 1772072122_F07 2 0.000 0.997 0.00 1.00
#> 1772072122_F09 2 0.000 0.997 0.00 1.00
#> 1772072122_G01 1 0.000 0.984 1.00 0.00
#> 1772072122_G02 1 0.000 0.984 1.00 0.00
#> 1772072122_G04 2 0.000 0.997 0.00 1.00
#> 1772072122_G09 2 0.000 0.997 0.00 1.00
#> 1772072122_G10 2 0.000 0.997 0.00 1.00
#> 1772072122_H02 1 0.000 0.984 1.00 0.00
#> 1772072122_H06 2 0.000 0.997 0.00 1.00
#> 1772072122_H07 1 0.000 0.984 1.00 0.00
#> 1772082029_A02 2 0.000 0.997 0.00 1.00
#> 1772082029_A09 2 0.000 0.997 0.00 1.00
#> 1772082029_A10 1 0.000 0.984 1.00 0.00
#> 1772082029_A11 2 0.000 0.997 0.00 1.00
#> 1772082029_B05 2 0.000 0.997 0.00 1.00
#> 1772082029_B10 2 0.000 0.997 0.00 1.00
#> 1772082029_C01 2 0.000 0.997 0.00 1.00
#> 1772082029_C07 2 0.000 0.997 0.00 1.00
#> 1772082029_C09 2 0.000 0.997 0.00 1.00
#> 1772082029_C11 1 0.000 0.984 1.00 0.00
#> 1772082029_D01 2 0.000 0.997 0.00 1.00
#> 1772082029_D05 2 0.000 0.997 0.00 1.00
#> 1772082029_D06 2 0.000 0.997 0.00 1.00
#> 1772082029_D08 2 0.000 0.997 0.00 1.00
#> 1772082029_D09 2 0.000 0.997 0.00 1.00
#> 1772082029_D12 2 0.000 0.997 0.00 1.00
#> 1772082029_E02 1 0.000 0.984 1.00 0.00
#> 1772082029_E05 2 0.000 0.997 0.00 1.00
#> 1772082029_E07 2 0.000 0.997 0.00 1.00
#> 1772082029_E11 1 0.000 0.984 1.00 0.00
#> 1772082029_F05 2 0.000 0.997 0.00 1.00
#> 1772082029_F06 2 0.000 0.997 0.00 1.00
#> 1772082029_F12 1 0.000 0.984 1.00 0.00
#> 1772082029_G02 2 0.000 0.997 0.00 1.00
#> 1772082029_G05 1 0.000 0.984 1.00 0.00
#> 1772082029_G09 1 0.680 0.791 0.82 0.18
#> 1772082029_H03 2 0.000 0.997 0.00 1.00
#> 1772082029_H06 1 0.000 0.984 1.00 0.00
#> 1772082029_H07 2 0.000 0.997 0.00 1.00
#> 1772092002_B05 1 0.000 0.984 1.00 0.00
#> 1772092277_A10 1 0.000 0.984 1.00 0.00
#> 1772094143_E08 1 0.000 0.984 1.00 0.00
#> 1772096093_B10 1 0.000 0.984 1.00 0.00
#> 1772096151_C04 2 0.000 0.997 0.00 1.00
#> 1772099008_A08 1 0.000 0.984 1.00 0.00
cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#> class entropy silhouette p1 p2 p3
#> 1772072122_A04 3 0.0000 0.9254 0.00 0.00 1.00
#> 1772072122_A05 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772072122_A06 3 0.4002 0.7695 0.16 0.00 0.84
#> 1772072122_A07 2 0.2066 0.8404 0.00 0.94 0.06
#> 1772072122_A08 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772072122_A10 2 0.1529 0.8302 0.00 0.96 0.04
#> 1772072122_A12 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772072122_B01 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772072122_B02 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772072122_B03 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772072122_B05 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772072122_B06 2 0.0000 0.8508 0.00 1.00 0.00
#> 1772072122_B07 2 0.8143 0.2917 0.36 0.56 0.08
#> 1772072122_B08 1 0.6192 0.2932 0.58 0.00 0.42
#> 1772072122_C03 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772072122_C05 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772072122_C09 3 0.0000 0.9254 0.00 0.00 1.00
#> 1772072122_C11 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772072122_C12 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772072122_D01 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772072122_D04 2 0.0000 0.8508 0.00 1.00 0.00
#> 1772072122_D05 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772072122_E03 2 0.4002 0.7929 0.00 0.84 0.16
#> 1772072122_E04 2 0.0000 0.8508 0.00 1.00 0.00
#> 1772072122_E06 2 0.0000 0.8508 0.00 1.00 0.00
#> 1772072122_E08 3 0.0892 0.9105 0.02 0.00 0.98
#> 1772072122_F01 3 0.0000 0.9254 0.00 0.00 1.00
#> 1772072122_F02 2 0.0000 0.8508 0.00 1.00 0.00
#> 1772072122_F04 2 0.3686 0.8060 0.00 0.86 0.14
#> 1772072122_F06 3 0.0000 0.9254 0.00 0.00 1.00
#> 1772072122_F07 3 0.0000 0.9254 0.00 0.00 1.00
#> 1772072122_F09 2 0.5706 0.6426 0.00 0.68 0.32
#> 1772072122_G01 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772072122_G02 3 0.2959 0.8314 0.10 0.00 0.90
#> 1772072122_G04 2 0.0000 0.8508 0.00 1.00 0.00
#> 1772072122_G09 2 0.0000 0.8508 0.00 1.00 0.00
#> 1772072122_G10 3 0.0000 0.9254 0.00 0.00 1.00
#> 1772072122_H02 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772072122_H06 3 0.0000 0.9254 0.00 0.00 1.00
#> 1772072122_H07 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772082029_A02 2 0.3686 0.8060 0.00 0.86 0.14
#> 1772082029_A09 2 0.0000 0.8508 0.00 1.00 0.00
#> 1772082029_A10 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772082029_A11 3 0.0000 0.9254 0.00 0.00 1.00
#> 1772082029_B05 2 0.6126 0.5117 0.00 0.60 0.40
#> 1772082029_B10 2 0.6192 0.4705 0.00 0.58 0.42
#> 1772082029_C01 2 0.0000 0.8508 0.00 1.00 0.00
#> 1772082029_C07 2 0.0000 0.8508 0.00 1.00 0.00
#> 1772082029_C09 2 0.0000 0.8508 0.00 1.00 0.00
#> 1772082029_C11 1 0.0892 0.9514 0.98 0.00 0.02
#> 1772082029_D01 2 0.5397 0.6903 0.00 0.72 0.28
#> 1772082029_D05 2 0.0892 0.8490 0.00 0.98 0.02
#> 1772082029_D06 2 0.0000 0.8508 0.00 1.00 0.00
#> 1772082029_D08 2 0.6126 0.5117 0.00 0.60 0.40
#> 1772082029_D09 2 0.6244 0.4234 0.00 0.56 0.44
#> 1772082029_D12 3 0.1529 0.8873 0.00 0.04 0.96
#> 1772082029_E02 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772082029_E05 3 0.6192 -0.0318 0.00 0.42 0.58
#> 1772082029_E07 2 0.0892 0.8492 0.00 0.98 0.02
#> 1772082029_E11 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772082029_F05 2 0.5706 0.6411 0.00 0.68 0.32
#> 1772082029_F06 3 0.0000 0.9254 0.00 0.00 1.00
#> 1772082029_F12 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772082029_G02 2 0.2959 0.8257 0.00 0.90 0.10
#> 1772082029_G05 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772082029_G09 1 0.8803 0.3879 0.58 0.24 0.18
#> 1772082029_H03 2 0.2066 0.8407 0.00 0.94 0.06
#> 1772082029_H06 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772082029_H07 2 0.0000 0.8508 0.00 1.00 0.00
#> 1772092002_B05 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772092277_A10 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772094143_E08 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772096093_B10 1 0.0000 0.9699 1.00 0.00 0.00
#> 1772096151_C04 2 0.5397 0.6903 0.00 0.72 0.28
#> 1772099008_A08 1 0.0000 0.9699 1.00 0.00 0.00
cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#> class entropy silhouette p1 p2 p3 p4
#> 1772072122_A04 3 0.0707 0.8175 0.00 0.02 0.98 0.00
#> 1772072122_A05 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772072122_A06 3 0.2830 0.7545 0.06 0.00 0.90 0.04
#> 1772072122_A07 2 0.4134 0.5359 0.00 0.74 0.00 0.26
#> 1772072122_A08 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772072122_A10 4 0.3975 0.5362 0.00 0.24 0.00 0.76
#> 1772072122_A12 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772072122_B01 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772072122_B02 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772072122_B03 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772072122_B05 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772072122_B06 4 0.4277 0.6519 0.00 0.28 0.00 0.72
#> 1772072122_B07 4 0.5445 0.6364 0.10 0.08 0.04 0.78
#> 1772072122_B08 3 0.4624 0.4332 0.34 0.00 0.66 0.00
#> 1772072122_C03 1 0.2921 0.8490 0.86 0.00 0.00 0.14
#> 1772072122_C05 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772072122_C09 3 0.0000 0.8115 0.00 0.00 1.00 0.00
#> 1772072122_C11 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772072122_C12 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772072122_D01 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772072122_D04 4 0.3975 0.6737 0.00 0.24 0.00 0.76
#> 1772072122_D05 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772072122_E03 2 0.3172 0.6486 0.00 0.84 0.00 0.16
#> 1772072122_E04 2 0.4855 0.0240 0.00 0.60 0.00 0.40
#> 1772072122_E06 4 0.3975 0.6737 0.00 0.24 0.00 0.76
#> 1772072122_E08 3 0.0707 0.8114 0.02 0.00 0.98 0.00
#> 1772072122_F01 3 0.0707 0.8175 0.00 0.02 0.98 0.00
#> 1772072122_F02 4 0.4277 0.6523 0.00 0.28 0.00 0.72
#> 1772072122_F04 2 0.3172 0.6486 0.00 0.84 0.00 0.16
#> 1772072122_F06 3 0.1637 0.7970 0.00 0.06 0.94 0.00
#> 1772072122_F07 3 0.4977 0.0618 0.00 0.46 0.54 0.00
#> 1772072122_F09 2 0.1211 0.7618 0.00 0.96 0.04 0.00
#> 1772072122_G01 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772072122_G02 3 0.0707 0.8054 0.02 0.00 0.98 0.00
#> 1772072122_G04 4 0.3172 0.6848 0.00 0.16 0.00 0.84
#> 1772072122_G09 2 0.4948 -0.1851 0.00 0.56 0.00 0.44
#> 1772072122_G10 3 0.0707 0.8175 0.00 0.02 0.98 0.00
#> 1772072122_H02 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772072122_H06 2 0.4907 0.2500 0.00 0.58 0.42 0.00
#> 1772072122_H07 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772082029_A02 2 0.3172 0.6486 0.00 0.84 0.00 0.16
#> 1772082029_A09 4 0.4994 0.3323 0.00 0.48 0.00 0.52
#> 1772082029_A10 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772082029_A11 2 0.4977 0.1394 0.00 0.54 0.46 0.00
#> 1772082029_B05 2 0.1637 0.7599 0.00 0.94 0.06 0.00
#> 1772082029_B10 2 0.1637 0.7599 0.00 0.94 0.06 0.00
#> 1772082029_C01 4 0.2647 0.6839 0.00 0.12 0.00 0.88
#> 1772082029_C07 4 0.2345 0.6271 0.00 0.10 0.00 0.90
#> 1772082029_C09 2 0.4406 0.3584 0.00 0.70 0.00 0.30
#> 1772082029_C11 1 0.0707 0.9759 0.98 0.00 0.02 0.00
#> 1772082029_D01 2 0.1211 0.7618 0.00 0.96 0.04 0.00
#> 1772082029_D05 4 0.4977 0.1168 0.00 0.46 0.00 0.54
#> 1772082029_D06 4 0.4855 0.4797 0.00 0.40 0.00 0.60
#> 1772082029_D08 2 0.1211 0.7618 0.00 0.96 0.04 0.00
#> 1772082029_D09 2 0.1637 0.7599 0.00 0.94 0.06 0.00
#> 1772082029_D12 2 0.4134 0.5895 0.00 0.74 0.26 0.00
#> 1772082029_E02 1 0.0707 0.9757 0.98 0.00 0.00 0.02
#> 1772082029_E05 2 0.2011 0.7501 0.00 0.92 0.08 0.00
#> 1772082029_E07 2 0.2011 0.7147 0.00 0.92 0.00 0.08
#> 1772082029_E11 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772082029_F05 2 0.2706 0.7223 0.00 0.90 0.02 0.08
#> 1772082029_F06 3 0.4713 0.3948 0.00 0.36 0.64 0.00
#> 1772082029_F12 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772082029_G02 2 0.1211 0.7446 0.00 0.96 0.00 0.04
#> 1772082029_G05 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772082029_G09 4 0.9673 -0.0114 0.24 0.14 0.28 0.34
#> 1772082029_H03 2 0.1637 0.7326 0.00 0.94 0.00 0.06
#> 1772082029_H06 1 0.0707 0.9751 0.98 0.00 0.02 0.00
#> 1772082029_H07 4 0.3172 0.6078 0.00 0.16 0.00 0.84
#> 1772092002_B05 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772092277_A10 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772094143_E08 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772096093_B10 1 0.0000 0.9926 1.00 0.00 0.00 0.00
#> 1772096151_C04 2 0.1411 0.7556 0.00 0.96 0.02 0.02
#> 1772099008_A08 1 0.0000 0.9926 1.00 0.00 0.00 0.00
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)
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)
As soon as the classes for columns are determined, the signatures that are significantly different between subgroups can be looked for. Following are the heatmaps for signatures.
Signature heatmaps where rows are scaled:
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)
Compare the overlap of signatures from different k:
compare_signatures(res)
get_signature()
returns a data frame invisibly. To get the list of signatures, the function
call should be assigned to a variable explicitly. In following code, if plot
argument is set
to FALSE
, no heatmap is plotted while only the differential analysis is performed.
# code only for demonstration
tb = get_signature(res, k = ..., plot = FALSE)
An example of the output of tb
is:
#> which_row fdr mean_1 mean_2 scaled_mean_1 scaled_mean_2 km
#> 1 38 0.042760348 8.373488 9.131774 -0.5533452 0.5164555 1
#> 2 40 0.018707592 7.106213 8.469186 -0.6173731 0.5762149 1
#> 3 55 0.019134737 10.221463 11.207825 -0.6159697 0.5749050 1
#> 4 59 0.006059896 5.921854 7.869574 -0.6899429 0.6439467 1
#> 5 60 0.018055526 8.928898 10.211722 -0.6204761 0.5791110 1
#> 6 98 0.009384629 15.714769 14.887706 0.6635654 -0.6193277 2
...
The columns in tb
are:
which_row
: row indices corresponding to the input matrix.fdr
: FDR for the differential test. mean_x
: The mean value in group x.scaled_mean_x
: The mean value in group x after rows are scaled.km
: Row groups if k-means clustering is applied to rows (which is done by automatically selecting number of clusters).If there are too many signatures, top_signatures = ...
can be set to only show the
signatures with the highest FDRs:
# code only for demonstration
# e.g. to show the top 500 most significant rows
tb = get_signature(res, k = ..., top_signatures = 500)
If the signatures are defined as these which are uniquely high in current group, diff_method
argument
can be set to "uniquely_high_in_one_group"
:
# code only for demonstration
tb = get_signature(res, k = ..., diff_method = "uniquely_high_in_one_group")
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")
Following heatmap shows how subgroups are split when increasing k
:
collect_classes(res)
Test correlation between subgroups and known annotations. If the known annotation is numeric, one-way ANOVA test is applied, and if the known annotation is discrete, chi-squared contingency table test is applied.
test_to_known_factors(res)
#> n_sample Cell_type(p-value) k
#> ATC:skmeans 75 0.1712 2
#> ATC:skmeans 69 0.0225 3
#> ATC:skmeans 63 0.0893 4
If matrix rows can be associated to genes, consider to use functional_enrichment(res,
...)
to perform function enrichment for the signature genes. See this vignette for more detailed explanations.
sessionInfo()
#> R version 4.1.0 (2021-05-18)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: CentOS Linux 7 (Core)
#>
#> Matrix products: default
#> BLAS/LAPACK: /usr/lib64/libopenblas-r0.3.3.so
#>
#> locale:
#> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
#> [4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
#> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
#> [10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
#>
#> attached base packages:
#> [1] grid parallel stats4 stats graphics grDevices utils datasets methods
#> [10] base
#>
#> other attached packages:
#> [1] genefilter_1.74.0 ComplexHeatmap_2.8.0 markdown_1.1
#> [4] knitr_1.33 scRNAseq_2.6.1 SingleCellExperiment_1.14.1
#> [7] SummarizedExperiment_1.22.0 Biobase_2.52.0 GenomicRanges_1.44.0
#> [10] GenomeInfoDb_1.28.1 IRanges_2.26.0 S4Vectors_0.30.0
#> [13] BiocGenerics_0.38.0 MatrixGenerics_1.4.0 matrixStats_0.59.0
#> [16] cola_1.9.4
#>
#> loaded via a namespace (and not attached):
#> [1] circlize_0.4.13 AnnotationHub_3.0.1 BiocFileCache_2.0.0
#> [4] lazyeval_0.2.2 polylabelr_0.2.0 splines_4.1.0
#> [7] Polychrome_1.3.1 BiocParallel_1.26.1 ggplot2_3.3.5
#> [10] digest_0.6.27 foreach_1.5.1 ensembldb_2.16.3
#> [13] htmltools_0.5.1.1 viridis_0.6.1 fansi_0.5.0
#> [16] magrittr_2.0.1 memoise_2.0.0 cluster_2.1.2
#> [19] doParallel_1.0.16 Biostrings_2.60.1 annotate_1.70.0
#> [22] askpass_1.1 prettyunits_1.1.1 colorspace_2.0-2
#> [25] blob_1.2.1 rappdirs_0.3.3 xfun_0.24
#> [28] dplyr_1.0.7 crayon_1.4.1 RCurl_1.98-1.3
#> [31] microbenchmark_1.4-7 jsonlite_1.7.2 impute_1.66.0
#> [34] brew_1.0-6 survival_3.2-11 iterators_1.0.13
#> [37] glue_1.4.2 polyclip_1.10-0 gtable_0.3.0
#> [40] zlibbioc_1.38.0 XVector_0.32.0 GetoptLong_1.0.5
#> [43] DelayedArray_0.18.0 shape_1.4.6 scales_1.1.1
#> [46] data.tree_1.0.0 DBI_1.1.1 Rcpp_1.0.7
#> [49] viridisLite_0.4.0 xtable_1.8-4 progress_1.2.2
#> [52] clue_0.3-59 reticulate_1.20 bit_4.0.4
#> [55] mclust_5.4.7 umap_0.2.7.0 httr_1.4.2
#> [58] RColorBrewer_1.1-2 ellipsis_0.3.2 pkgconfig_2.0.3
#> [61] XML_3.99-0.6 dbplyr_2.1.1 utf8_1.2.1
#> [64] tidyselect_1.1.1 rlang_0.4.11 later_1.2.0
#> [67] AnnotationDbi_1.54.1 munsell_0.5.0 BiocVersion_3.13.1
#> [70] tools_4.1.0 cachem_1.0.5 generics_0.1.0
#> [73] RSQLite_2.2.7 ExperimentHub_2.0.0 evaluate_0.14
#> [76] stringr_1.4.0 fastmap_1.1.0 yaml_2.2.1
#> [79] bit64_4.0.5 purrr_0.3.4 dendextend_1.15.1
#> [82] KEGGREST_1.32.0 AnnotationFilter_1.16.0 mime_0.11
#> [85] slam_0.1-48 xml2_1.3.2 biomaRt_2.48.2
#> [88] compiler_4.1.0 rstudioapi_0.13 filelock_1.0.2
#> [91] curl_4.3.2 png_0.1-7 interactiveDisplayBase_1.30.0
#> [94] tibble_3.1.2 stringi_1.7.3 highr_0.9
#> [97] GenomicFeatures_1.44.0 RSpectra_0.16-0 lattice_0.20-44
#> [100] ProtGenerics_1.24.0 Matrix_1.3-4 vctrs_0.3.8
#> [103] pillar_1.6.1 lifecycle_1.0.0 BiocManager_1.30.16
#> [106] eulerr_6.1.0 GlobalOptions_0.1.2 bitops_1.0-7
#> [109] irlba_2.3.3 httpuv_1.6.1 rtracklayer_1.52.0
#> [112] R6_2.5.0 BiocIO_1.2.0 promises_1.2.0.1
#> [115] gridExtra_2.3 codetools_0.2-18 assertthat_0.2.1
#> [118] openssl_1.4.4 rjson_0.2.20 GenomicAlignments_1.28.0
#> [121] Rsamtools_2.8.0 GenomeInfoDbData_1.2.6 hms_1.1.0
#> [124] skmeans_0.2-13 Cairo_1.5-12.2 scatterplot3d_0.3-41
#> [127] shiny_1.6.0 restfulr_0.0.13