cola Report for Hierarchical Partitioning - 'TCGA_UVM_methylation'

Date: 2021-07-22 16:19:52 CEST, cola version: 1.9.4

Document is loading...


Summary

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 4 combinations of top-value methods and partitioning methods.
#>   On a matrix with 376006 rows and 80 columns.
#>   Performed in total 22400 partitions.
#>   There are 11 groups under the following parameters:
#>     - min_samples: 6
#>     - mean_silhouette_cutoff: 0.9
#>     - min_n_signatures: 1000 (signatures are selected based on:)
#>       - fdr_cutoff: 0.05
#>       - group_diff: 0.25
#> 
#> Hierarchy of the partition:
#>   0, 80 cols
#>   |-- 01, 24 cols, 4276 signatures
#>   |   |-- 011, 5 cols (b)
#>   |   |-- 012, 12 cols, 945 signatures (c)
#>   |   `-- 013, 7 cols (b)
#>   |-- 02, 35 cols, 4260 signatures
#>   |   |-- 021, 14 cols, 1491 signatures
#>   |   |   |-- 0211, 7 cols (b)
#>   |   |   |-- 0212, 5 cols (b)
#>   |   |   `-- 0213, 2 cols (b)
#>   |   |-- 022, 11 cols (b)
#>   |   `-- 023, 10 cols (b)
#>   |-- 03, 16 cols, 2201 signatures
#>   |   |-- 031, 11 cols (b)
#>   |   `-- 032, 5 cols (b)
#>   `-- 04, 5 cols (b)
#> 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 = mat, top_n = 1000, top_value_method = c("SD", "ATC"), 
#>     partition_method = c("kmeans", "skmeans"), subset = 500, group_diff = 0.25, min_n_signatures = 1000, 
#>     filter_fun = function(mat) {
#>         s = rowSds(mat)
#>         order(-s)[1:30000]
#>     }, max_k = 8, scale_rows = FALSE, cores = 4)

Dimension of the input matrix:

mat = get_matrix(res_rh)
dim(mat)
#> [1] 376006     80

All the methods that were tried:

res_rh@param$combination_method
#> [[1]]
#> [1] "SD"     "kmeans"
#> 
#> [[2]]
#> [1] "ATC"    "kmeans"
#> 
#> [[3]]
#> [1] "SD"      "skmeans"
#> 
#> [[4]]
#> [1] "ATC"     "skmeans"

Density distribution

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, ylab = "value", cluster_columns = TRUE, show_column_names = FALSE,
    mc.cores = 1)

plot of chunk density-heatmap

Some values about the hierarchy:

all_nodes(res_rh)
#>  [1] "0"    "01"   "011"  "012"  "013"  "02"   "021"  "0211" "0212" "0213" "022"  "023"  "03"  
#> [14] "031"  "032"  "04"
all_leaves(res_rh)
#>  [1] "011"  "012"  "013"  "0211" "0212" "0213" "022"  "023"  "031"  "032"  "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        80        22227      0.05911   FALSE
#> 2    01 ATC:skmeans     2      3        24         4276      0.01137   FALSE
#> 3   011 not applied     3     NA         5           NA           NA    TRUE
#> 4   012   SD:kmeans     3      2        12          945      0.00251    TRUE
#> 5   013 not applied     3     NA         7           NA           NA    TRUE
#> 6    02 ATC:skmeans     2      3        35         4260      0.01133   FALSE
#> 7   021   SD:kmeans     3      3        14         1491      0.00397   FALSE
#> 8  0211 not applied     4     NA         7           NA           NA    TRUE
#> 9  0212 not applied     4     NA         5           NA           NA    TRUE
#> 10 0213 not applied     4     NA         2           NA           NA    TRUE
#> 11  022 not applied     3     NA        11           NA           NA    TRUE
#> 12  023 not applied     3     NA        10           NA           NA    TRUE
#> 13   03  ATC:kmeans     2      2        16         2201      0.00585   FALSE
#> 14  031 not applied     3     NA        11           NA           NA    TRUE
#> 15  032 not applied     3     NA         5           NA           NA    TRUE
#> 16   04 not applied     2     NA         5           NA           NA    TRUE

In the output from node_info(), there are the following columns:

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.

Suggest the best k

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.99 0.99 80 **
Node01 ATC:skmeans 3 1.00 0.98 0.99 24 **
Node011-leaf not applied ✓ (b) 5
Node012-leaf SD:kmeans ✓ (c) 3 0.94 0.95 0.98 12 *
Node013-leaf not applied ✓ (b) 7
Node02 ATC:skmeans 2 1.00 1.00 1.00 35 **
Node021 SD:kmeans 3 1.00 0.99 1.00 14 **
Node0211-leaf not applied ✓ (b) 7
Node0212-leaf not applied ✓ (b) 5
Node0213-leaf not applied ✓ (b) 2
Node022-leaf not applied ✓ (b) 11
Node023-leaf not applied ✓ (b) 10
Node03 ATC:kmeans 2 1.00 1.00 1.00 16 **
Node031-leaf not applied ✓ (b) 11
Node032-leaf not applied ✓ (b) 5
Node04-leaf not applied ✓ (b) 5

Stop reason: b) Subgroup had too few columns. c) There were too few signatures.

**: 1-PAC > 0.95, *: 1-PAC > 0.9

Partition hierarchy

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 = 1491))

plot of chunk tab-collect-classes-from-hierarchical-partition-1

collect_classes(res_rh, merge_node = merge_node_param(min_n_signatures = 2201))

plot of chunk tab-collect-classes-from-hierarchical-partition-2

collect_classes(res_rh, merge_node = merge_node_param(min_n_signatures = 4260))

plot of chunk tab-collect-classes-from-hierarchical-partition-3

collect_classes(res_rh, merge_node = merge_node_param(min_n_signatures = 4276))

plot of chunk tab-collect-classes-from-hierarchical-partition-4

collect_classes(res_rh, merge_node = merge_node_param(min_n_signatures = 22227))

plot of chunk tab-collect-classes-from-hierarchical-partition-5

Following shows the table of the partitions (You need to click the show/hide code output link to see it).

show/hide code output

get_classes(res_rh, merge_node = merge_node_param(min_n_signatures = 1491))
#> TCGA.V4.A9EX.01 TCGA.V4.A9E5.01 TCGA.V4.A9EZ.01 TCGA.WC.A885.01 TCGA.V4.A9F3.01 TCGA.V4.A9EU.01 
#>           "011"            "04"           "023"          "0211"           "012"           "011" 
#> TCGA.V4.A9ET.01 TCGA.V4.A9F7.01 TCGA.V4.A9F1.01 TCGA.V4.A9F4.01 TCGA.YZ.A980.01 TCGA.VD.A8KJ.01 
#>          "0212"           "022"           "012"          "0212"           "031"           "022" 
#> TCGA.V3.A9ZX.01 TCGA.WC.AA9A.01 TCGA.VD.AA8T.01 TCGA.V4.A9EW.01 TCGA.WC.A880.01 TCGA.WC.A881.01 
#>           "013"           "031"           "032"           "023"           "022"          "0212" 
#> TCGA.V3.A9ZY.01 TCGA.WC.AA9E.01 TCGA.V4.A9EV.01 TCGA.V4.A9E9.01 TCGA.V4.A9E8.01 TCGA.VD.A8KB.01 
#>           "023"          "0212"           "012"          "0211"           "031"          "0212" 
#> TCGA.VD.A8KL.01 TCGA.VD.A8KG.01 TCGA.VD.AA8M.01 TCGA.WC.A882.01 TCGA.V4.A9EO.01 TCGA.VD.A8KI.01 
#>           "032"          "0211"           "022"            "04"           "031"           "013" 
#> TCGA.V4.A9F2.01 TCGA.V4.A9EQ.01 TCGA.VD.A8K8.01 TCGA.V4.A9EL.01 TCGA.V4.A9EI.01 TCGA.VD.AA8S.01 
#>            "04"           "012"           "012"           "013"           "011"           "022" 
#> TCGA.V4.A9EC.01 TCGA.V4.A9ED.01 TCGA.V4.A9ES.01 TCGA.YZ.A985.01 TCGA.V4.A9F0.01 TCGA.V4.A9E7.01 
#>           "022"           "031"           "031"           "032"           "012"           "013" 
#> TCGA.VD.A8KN.01 TCGA.VD.A8KK.01 TCGA.V4.A9EM.01 TCGA.VD.AA8Q.01 TCGA.VD.A8K9.01 TCGA.WC.A888.01 
#>           "031"           "031"            "04"           "022"          "0211"           "031" 
#> TCGA.VD.AA8R.01 TCGA.VD.A8KH.01 TCGA.RZ.AB0B.01 TCGA.V4.A9EJ.01 TCGA.VD.A8K7.01 TCGA.VD.AA8O.01 
#>           "023"           "023"           "013"          "0211"           "023"           "012" 
#> TCGA.VD.A8KA.01 TCGA.V4.A9EK.01 TCGA.V4.A9F8.01 TCGA.YZ.A984.01 TCGA.VD.A8KD.01 TCGA.YZ.A982.01 
#>          "0211"          "0213"           "031"           "032"           "012"          "0213" 
#> TCGA.WC.A88A.01 TCGA.WC.A87W.01 TCGA.V4.A9EH.01 TCGA.WC.A87U.01 TCGA.YZ.A983.01 TCGA.V4.A9EY.01 
#>           "011"            "04"           "023"           "023"           "022"           "022" 
#> TCGA.WC.A87T.01 TCGA.VD.AA8N.01 TCGA.VD.A8KM.01 TCGA.VD.AA8P.01 TCGA.V4.A9EF.01 TCGA.V4.A9EE.01 
#>           "023"           "013"           "012"           "032"           "012"           "013" 
#> TCGA.WC.A87Y.01 TCGA.VD.A8KE.01 TCGA.VD.A8KF.01 TCGA.VD.A8KO.01 TCGA.WC.A883.01 TCGA.V4.A9EA.01 
#>           "012"           "022"           "031"           "023"           "011"          "0211" 
#> TCGA.WC.A884.01 TCGA.V4.A9F5.01 
#>           "022"           "012"

show/hide code output

get_classes(res_rh, merge_node = merge_node_param(min_n_signatures = 2201))
#> TCGA.V4.A9EX.01 TCGA.V4.A9E5.01 TCGA.V4.A9EZ.01 TCGA.WC.A885.01 TCGA.V4.A9F3.01 TCGA.V4.A9EU.01 
#>           "011"            "04"           "023"           "021"           "012"           "011" 
#> TCGA.V4.A9ET.01 TCGA.V4.A9F7.01 TCGA.V4.A9F1.01 TCGA.V4.A9F4.01 TCGA.YZ.A980.01 TCGA.VD.A8KJ.01 
#>           "021"           "022"           "012"           "021"           "031"           "022" 
#> TCGA.V3.A9ZX.01 TCGA.WC.AA9A.01 TCGA.VD.AA8T.01 TCGA.V4.A9EW.01 TCGA.WC.A880.01 TCGA.WC.A881.01 
#>           "013"           "031"           "032"           "023"           "022"           "021" 
#> TCGA.V3.A9ZY.01 TCGA.WC.AA9E.01 TCGA.V4.A9EV.01 TCGA.V4.A9E9.01 TCGA.V4.A9E8.01 TCGA.VD.A8KB.01 
#>           "023"           "021"           "012"           "021"           "031"           "021" 
#> TCGA.VD.A8KL.01 TCGA.VD.A8KG.01 TCGA.VD.AA8M.01 TCGA.WC.A882.01 TCGA.V4.A9EO.01 TCGA.VD.A8KI.01 
#>           "032"           "021"           "022"            "04"           "031"           "013" 
#> TCGA.V4.A9F2.01 TCGA.V4.A9EQ.01 TCGA.VD.A8K8.01 TCGA.V4.A9EL.01 TCGA.V4.A9EI.01 TCGA.VD.AA8S.01 
#>            "04"           "012"           "012"           "013"           "011"           "022" 
#> TCGA.V4.A9EC.01 TCGA.V4.A9ED.01 TCGA.V4.A9ES.01 TCGA.YZ.A985.01 TCGA.V4.A9F0.01 TCGA.V4.A9E7.01 
#>           "022"           "031"           "031"           "032"           "012"           "013" 
#> TCGA.VD.A8KN.01 TCGA.VD.A8KK.01 TCGA.V4.A9EM.01 TCGA.VD.AA8Q.01 TCGA.VD.A8K9.01 TCGA.WC.A888.01 
#>           "031"           "031"            "04"           "022"           "021"           "031" 
#> TCGA.VD.AA8R.01 TCGA.VD.A8KH.01 TCGA.RZ.AB0B.01 TCGA.V4.A9EJ.01 TCGA.VD.A8K7.01 TCGA.VD.AA8O.01 
#>           "023"           "023"           "013"           "021"           "023"           "012" 
#> TCGA.VD.A8KA.01 TCGA.V4.A9EK.01 TCGA.V4.A9F8.01 TCGA.YZ.A984.01 TCGA.VD.A8KD.01 TCGA.YZ.A982.01 
#>           "021"           "021"           "031"           "032"           "012"           "021" 
#> TCGA.WC.A88A.01 TCGA.WC.A87W.01 TCGA.V4.A9EH.01 TCGA.WC.A87U.01 TCGA.YZ.A983.01 TCGA.V4.A9EY.01 
#>           "011"            "04"           "023"           "023"           "022"           "022" 
#> TCGA.WC.A87T.01 TCGA.VD.AA8N.01 TCGA.VD.A8KM.01 TCGA.VD.AA8P.01 TCGA.V4.A9EF.01 TCGA.V4.A9EE.01 
#>           "023"           "013"           "012"           "032"           "012"           "013" 
#> TCGA.WC.A87Y.01 TCGA.VD.A8KE.01 TCGA.VD.A8KF.01 TCGA.VD.A8KO.01 TCGA.WC.A883.01 TCGA.V4.A9EA.01 
#>           "012"           "022"           "031"           "023"           "011"           "021" 
#> TCGA.WC.A884.01 TCGA.V4.A9F5.01 
#>           "022"           "012"

show/hide code output

get_classes(res_rh, merge_node = merge_node_param(min_n_signatures = 4260))
#> TCGA.V4.A9EX.01 TCGA.V4.A9E5.01 TCGA.V4.A9EZ.01 TCGA.WC.A885.01 TCGA.V4.A9F3.01 TCGA.V4.A9EU.01 
#>           "011"            "04"           "023"           "021"           "012"           "011" 
#> TCGA.V4.A9ET.01 TCGA.V4.A9F7.01 TCGA.V4.A9F1.01 TCGA.V4.A9F4.01 TCGA.YZ.A980.01 TCGA.VD.A8KJ.01 
#>           "021"           "022"           "012"           "021"            "03"           "022" 
#> TCGA.V3.A9ZX.01 TCGA.WC.AA9A.01 TCGA.VD.AA8T.01 TCGA.V4.A9EW.01 TCGA.WC.A880.01 TCGA.WC.A881.01 
#>           "013"            "03"            "03"           "023"           "022"           "021" 
#> TCGA.V3.A9ZY.01 TCGA.WC.AA9E.01 TCGA.V4.A9EV.01 TCGA.V4.A9E9.01 TCGA.V4.A9E8.01 TCGA.VD.A8KB.01 
#>           "023"           "021"           "012"           "021"            "03"           "021" 
#> TCGA.VD.A8KL.01 TCGA.VD.A8KG.01 TCGA.VD.AA8M.01 TCGA.WC.A882.01 TCGA.V4.A9EO.01 TCGA.VD.A8KI.01 
#>            "03"           "021"           "022"            "04"            "03"           "013" 
#> TCGA.V4.A9F2.01 TCGA.V4.A9EQ.01 TCGA.VD.A8K8.01 TCGA.V4.A9EL.01 TCGA.V4.A9EI.01 TCGA.VD.AA8S.01 
#>            "04"           "012"           "012"           "013"           "011"           "022" 
#> TCGA.V4.A9EC.01 TCGA.V4.A9ED.01 TCGA.V4.A9ES.01 TCGA.YZ.A985.01 TCGA.V4.A9F0.01 TCGA.V4.A9E7.01 
#>           "022"            "03"            "03"            "03"           "012"           "013" 
#> TCGA.VD.A8KN.01 TCGA.VD.A8KK.01 TCGA.V4.A9EM.01 TCGA.VD.AA8Q.01 TCGA.VD.A8K9.01 TCGA.WC.A888.01 
#>            "03"            "03"            "04"           "022"           "021"            "03" 
#> TCGA.VD.AA8R.01 TCGA.VD.A8KH.01 TCGA.RZ.AB0B.01 TCGA.V4.A9EJ.01 TCGA.VD.A8K7.01 TCGA.VD.AA8O.01 
#>           "023"           "023"           "013"           "021"           "023"           "012" 
#> TCGA.VD.A8KA.01 TCGA.V4.A9EK.01 TCGA.V4.A9F8.01 TCGA.YZ.A984.01 TCGA.VD.A8KD.01 TCGA.YZ.A982.01 
#>           "021"           "021"            "03"            "03"           "012"           "021" 
#> TCGA.WC.A88A.01 TCGA.WC.A87W.01 TCGA.V4.A9EH.01 TCGA.WC.A87U.01 TCGA.YZ.A983.01 TCGA.V4.A9EY.01 
#>           "011"            "04"           "023"           "023"           "022"           "022" 
#> TCGA.WC.A87T.01 TCGA.VD.AA8N.01 TCGA.VD.A8KM.01 TCGA.VD.AA8P.01 TCGA.V4.A9EF.01 TCGA.V4.A9EE.01 
#>           "023"           "013"           "012"            "03"           "012"           "013" 
#> TCGA.WC.A87Y.01 TCGA.VD.A8KE.01 TCGA.VD.A8KF.01 TCGA.VD.A8KO.01 TCGA.WC.A883.01 TCGA.V4.A9EA.01 
#>           "012"           "022"            "03"           "023"           "011"           "021" 
#> TCGA.WC.A884.01 TCGA.V4.A9F5.01 
#>           "022"           "012"

show/hide code output

get_classes(res_rh, merge_node = merge_node_param(min_n_signatures = 4276))
#> TCGA.V4.A9EX.01 TCGA.V4.A9E5.01 TCGA.V4.A9EZ.01 TCGA.WC.A885.01 TCGA.V4.A9F3.01 TCGA.V4.A9EU.01 
#>           "011"            "04"            "02"            "02"           "012"           "011" 
#> TCGA.V4.A9ET.01 TCGA.V4.A9F7.01 TCGA.V4.A9F1.01 TCGA.V4.A9F4.01 TCGA.YZ.A980.01 TCGA.VD.A8KJ.01 
#>            "02"            "02"           "012"            "02"            "03"            "02" 
#> TCGA.V3.A9ZX.01 TCGA.WC.AA9A.01 TCGA.VD.AA8T.01 TCGA.V4.A9EW.01 TCGA.WC.A880.01 TCGA.WC.A881.01 
#>           "013"            "03"            "03"            "02"            "02"            "02" 
#> TCGA.V3.A9ZY.01 TCGA.WC.AA9E.01 TCGA.V4.A9EV.01 TCGA.V4.A9E9.01 TCGA.V4.A9E8.01 TCGA.VD.A8KB.01 
#>            "02"            "02"           "012"            "02"            "03"            "02" 
#> TCGA.VD.A8KL.01 TCGA.VD.A8KG.01 TCGA.VD.AA8M.01 TCGA.WC.A882.01 TCGA.V4.A9EO.01 TCGA.VD.A8KI.01 
#>            "03"            "02"            "02"            "04"            "03"           "013" 
#> TCGA.V4.A9F2.01 TCGA.V4.A9EQ.01 TCGA.VD.A8K8.01 TCGA.V4.A9EL.01 TCGA.V4.A9EI.01 TCGA.VD.AA8S.01 
#>            "04"           "012"           "012"           "013"           "011"            "02" 
#> TCGA.V4.A9EC.01 TCGA.V4.A9ED.01 TCGA.V4.A9ES.01 TCGA.YZ.A985.01 TCGA.V4.A9F0.01 TCGA.V4.A9E7.01 
#>            "02"            "03"            "03"            "03"           "012"           "013" 
#> TCGA.VD.A8KN.01 TCGA.VD.A8KK.01 TCGA.V4.A9EM.01 TCGA.VD.AA8Q.01 TCGA.VD.A8K9.01 TCGA.WC.A888.01 
#>            "03"            "03"            "04"            "02"            "02"            "03" 
#> TCGA.VD.AA8R.01 TCGA.VD.A8KH.01 TCGA.RZ.AB0B.01 TCGA.V4.A9EJ.01 TCGA.VD.A8K7.01 TCGA.VD.AA8O.01 
#>            "02"            "02"           "013"            "02"            "02"           "012" 
#> TCGA.VD.A8KA.01 TCGA.V4.A9EK.01 TCGA.V4.A9F8.01 TCGA.YZ.A984.01 TCGA.VD.A8KD.01 TCGA.YZ.A982.01 
#>            "02"            "02"            "03"            "03"           "012"            "02" 
#> TCGA.WC.A88A.01 TCGA.WC.A87W.01 TCGA.V4.A9EH.01 TCGA.WC.A87U.01 TCGA.YZ.A983.01 TCGA.V4.A9EY.01 
#>           "011"            "04"            "02"            "02"            "02"            "02" 
#> TCGA.WC.A87T.01 TCGA.VD.AA8N.01 TCGA.VD.A8KM.01 TCGA.VD.AA8P.01 TCGA.V4.A9EF.01 TCGA.V4.A9EE.01 
#>            "02"           "013"           "012"            "03"           "012"           "013" 
#> TCGA.WC.A87Y.01 TCGA.VD.A8KE.01 TCGA.VD.A8KF.01 TCGA.VD.A8KO.01 TCGA.WC.A883.01 TCGA.V4.A9EA.01 
#>           "012"            "02"            "03"            "02"           "011"            "02" 
#> TCGA.WC.A884.01 TCGA.V4.A9F5.01 
#>            "02"           "012"

show/hide code output

get_classes(res_rh, merge_node = merge_node_param(min_n_signatures = 22227))
#> TCGA.V4.A9EX.01 TCGA.V4.A9E5.01 TCGA.V4.A9EZ.01 TCGA.WC.A885.01 TCGA.V4.A9F3.01 TCGA.V4.A9EU.01 
#>            "01"            "04"            "02"            "02"            "01"            "01" 
#> TCGA.V4.A9ET.01 TCGA.V4.A9F7.01 TCGA.V4.A9F1.01 TCGA.V4.A9F4.01 TCGA.YZ.A980.01 TCGA.VD.A8KJ.01 
#>            "02"            "02"            "01"            "02"            "03"            "02" 
#> TCGA.V3.A9ZX.01 TCGA.WC.AA9A.01 TCGA.VD.AA8T.01 TCGA.V4.A9EW.01 TCGA.WC.A880.01 TCGA.WC.A881.01 
#>            "01"            "03"            "03"            "02"            "02"            "02" 
#> TCGA.V3.A9ZY.01 TCGA.WC.AA9E.01 TCGA.V4.A9EV.01 TCGA.V4.A9E9.01 TCGA.V4.A9E8.01 TCGA.VD.A8KB.01 
#>            "02"            "02"            "01"            "02"            "03"            "02" 
#> TCGA.VD.A8KL.01 TCGA.VD.A8KG.01 TCGA.VD.AA8M.01 TCGA.WC.A882.01 TCGA.V4.A9EO.01 TCGA.VD.A8KI.01 
#>            "03"            "02"            "02"            "04"            "03"            "01" 
#> TCGA.V4.A9F2.01 TCGA.V4.A9EQ.01 TCGA.VD.A8K8.01 TCGA.V4.A9EL.01 TCGA.V4.A9EI.01 TCGA.VD.AA8S.01 
#>            "04"            "01"            "01"            "01"            "01"            "02" 
#> TCGA.V4.A9EC.01 TCGA.V4.A9ED.01 TCGA.V4.A9ES.01 TCGA.YZ.A985.01 TCGA.V4.A9F0.01 TCGA.V4.A9E7.01 
#>            "02"            "03"            "03"            "03"            "01"            "01" 
#> TCGA.VD.A8KN.01 TCGA.VD.A8KK.01 TCGA.V4.A9EM.01 TCGA.VD.AA8Q.01 TCGA.VD.A8K9.01 TCGA.WC.A888.01 
#>            "03"            "03"            "04"            "02"            "02"            "03" 
#> TCGA.VD.AA8R.01 TCGA.VD.A8KH.01 TCGA.RZ.AB0B.01 TCGA.V4.A9EJ.01 TCGA.VD.A8K7.01 TCGA.VD.AA8O.01 
#>            "02"            "02"            "01"            "02"            "02"            "01" 
#> TCGA.VD.A8KA.01 TCGA.V4.A9EK.01 TCGA.V4.A9F8.01 TCGA.YZ.A984.01 TCGA.VD.A8KD.01 TCGA.YZ.A982.01 
#>            "02"            "02"            "03"            "03"            "01"            "02" 
#> TCGA.WC.A88A.01 TCGA.WC.A87W.01 TCGA.V4.A9EH.01 TCGA.WC.A87U.01 TCGA.YZ.A983.01 TCGA.V4.A9EY.01 
#>            "01"            "04"            "02"            "02"            "02"            "02" 
#> TCGA.WC.A87T.01 TCGA.VD.AA8N.01 TCGA.VD.A8KM.01 TCGA.VD.AA8P.01 TCGA.V4.A9EF.01 TCGA.V4.A9EE.01 
#>            "02"            "01"            "01"            "03"            "01"            "01" 
#> TCGA.WC.A87Y.01 TCGA.VD.A8KE.01 TCGA.VD.A8KF.01 TCGA.VD.A8KO.01 TCGA.WC.A883.01 TCGA.V4.A9EA.01 
#>            "01"            "02"            "03"            "02"            "01"            "02" 
#> TCGA.WC.A884.01 TCGA.V4.A9F5.01 
#>            "02"            "01"

Top rows heatmap

Heatmaps of the top rows:

top_rows_heatmap(res_rh)

plot of chunk top-rows-heatmap

#> Error in h(simpleError(msg, call)) : 
#>   error in evaluating the argument 'object' in selecting a method for function 'draw': no applicable method for 'height' applied to an object of class "list"

Top rows on each node:

top_rows_overlap(res_rh, method = "upset")

plot of chunk top-rows-overlap

UMAP plot

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 = 1491),
    method = "UMAP", top_value_method = "SD", top_n = 40000, scale_rows = FALSE)
dimension_reduction(res_rh, merge_node = merge_node_param(min_n_signatures = 1491),
    method = "UMAP", top_value_method = "ATC", top_n = 40000, scale_rows = TRUE)

plot of chunk tab-dimension-reduction-by-depth-1

par(mfrow = c(1, 2))
dimension_reduction(res_rh, merge_node = merge_node_param(min_n_signatures = 2201),
    method = "UMAP", top_value_method = "SD", top_n = 40000, scale_rows = FALSE)
dimension_reduction(res_rh, merge_node = merge_node_param(min_n_signatures = 2201),
    method = "UMAP", top_value_method = "ATC", top_n = 40000, scale_rows = TRUE)

plot of chunk tab-dimension-reduction-by-depth-2

par(mfrow = c(1, 2))
dimension_reduction(res_rh, merge_node = merge_node_param(min_n_signatures = 4260),
    method = "UMAP", top_value_method = "SD", top_n = 40000, scale_rows = FALSE)
dimension_reduction(res_rh, merge_node = merge_node_param(min_n_signatures = 4260),
    method = "UMAP", top_value_method = "ATC", top_n = 40000, scale_rows = TRUE)

plot of chunk tab-dimension-reduction-by-depth-3

par(mfrow = c(1, 2))
dimension_reduction(res_rh, merge_node = merge_node_param(min_n_signatures = 4276),
    method = "UMAP", top_value_method = "SD", top_n = 40000, scale_rows = FALSE)
dimension_reduction(res_rh, merge_node = merge_node_param(min_n_signatures = 4276),
    method = "UMAP", top_value_method = "ATC", top_n = 40000, scale_rows = TRUE)

plot of chunk tab-dimension-reduction-by-depth-4

par(mfrow = c(1, 2))
dimension_reduction(res_rh, merge_node = merge_node_param(min_n_signatures = 22227),
    method = "UMAP", top_value_method = "SD", top_n = 40000, scale_rows = FALSE)
dimension_reduction(res_rh, merge_node = merge_node_param(min_n_signatures = 22227),
    method = "UMAP", top_value_method = "ATC", top_n = 40000, scale_rows = TRUE)

plot of chunk tab-dimension-reduction-by-depth-5

Signature heatmap

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 = 1491))

plot of chunk tab-get-signatures-from-hierarchical-partition-1

get_signatures(res_rh, merge_node = merge_node_param(min_n_signatures = 2201))

plot of chunk tab-get-signatures-from-hierarchical-partition-2

get_signatures(res_rh, merge_node = merge_node_param(min_n_signatures = 4260))

plot of chunk tab-get-signatures-from-hierarchical-partition-3

get_signatures(res_rh, merge_node = merge_node_param(min_n_signatures = 4276))

plot of chunk tab-get-signatures-from-hierarchical-partition-4

get_signatures(res_rh, merge_node = merge_node_param(min_n_signatures = 22227))

plot of chunk tab-get-signatures-from-hierarchical-partition-5

Compare signatures from different nodes:

compare_signatures(res_rh, verbose = FALSE)

plot of chunk unnamed-chunk-24

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)

Results for each node


Node0

Child nodes: Node01 , Node02 , Node03 , 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, 5, 6, 7, 8.
#>   On a matrix with 30000 rows and 80 columns.
#>   Top rows (1000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 350 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)

plot of chunk node-0-collect-plots

The plots are:

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:

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)

plot of chunk node-0-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.5068 0.494   0.494
#> 3 3 1.000           0.985       0.995         0.2479 0.861   0.721
#> 4 4 1.000           0.986       0.992         0.0885 0.949   0.862
#> 5 5 0.827           0.714       0.873         0.0750 0.969   0.903
#> 6 6 0.826           0.797       0.878         0.0417 0.917   0.720
#> 7 7 0.833           0.785       0.881         0.0257 0.966   0.852
#> 8 8 0.809           0.750       0.874         0.0109 0.984   0.920

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>                 class entropy silhouette p1 p2
#> TCGA.V4.A9EX.01     1       0          1  1  0
#> TCGA.V4.A9E5.01     2       0          1  0  1
#> TCGA.V4.A9EZ.01     2       0          1  0  1
#> TCGA.WC.A885.01     2       0          1  0  1
#> TCGA.V4.A9F3.01     1       0          1  1  0
#> TCGA.V4.A9EU.01     1       0          1  1  0
#> TCGA.V4.A9ET.01     2       0          1  0  1
#> TCGA.V4.A9F7.01     2       0          1  0  1
#> TCGA.V4.A9F1.01     1       0          1  1  0
#> TCGA.V4.A9F4.01     2       0          1  0  1
#> TCGA.YZ.A980.01     1       0          1  1  0
#> TCGA.VD.A8KJ.01     2       0          1  0  1
#> TCGA.V3.A9ZX.01     1       0          1  1  0
#> TCGA.WC.AA9A.01     1       0          1  1  0
#> TCGA.VD.AA8T.01     1       0          1  1  0
#> TCGA.V4.A9EW.01     2       0          1  0  1
#> TCGA.WC.A880.01     2       0          1  0  1
#> TCGA.WC.A881.01     2       0          1  0  1
#> TCGA.V3.A9ZY.01     2       0          1  0  1
#> TCGA.WC.AA9E.01     2       0          1  0  1
#> TCGA.V4.A9EV.01     1       0          1  1  0
#> TCGA.V4.A9E9.01     2       0          1  0  1
#> TCGA.V4.A9E8.01     1       0          1  1  0
#> TCGA.VD.A8KB.01     2       0          1  0  1
#> TCGA.VD.A8KL.01     1       0          1  1  0
#> TCGA.VD.A8KG.01     2       0          1  0  1
#> TCGA.VD.AA8M.01     2       0          1  0  1
#> TCGA.WC.A882.01     2       0          1  0  1
#> TCGA.V4.A9EO.01     1       0          1  1  0
#> TCGA.VD.A8KI.01     1       0          1  1  0
#> TCGA.V4.A9F2.01     2       0          1  0  1
#> TCGA.V4.A9EQ.01     1       0          1  1  0
#> TCGA.VD.A8K8.01     1       0          1  1  0
#> TCGA.V4.A9EL.01     1       0          1  1  0
#> TCGA.V4.A9EI.01     1       0          1  1  0
#> TCGA.VD.AA8S.01     2       0          1  0  1
#> TCGA.V4.A9EC.01     2       0          1  0  1
#> TCGA.V4.A9ED.01     1       0          1  1  0
#> TCGA.V4.A9ES.01     1       0          1  1  0
#> TCGA.YZ.A985.01     1       0          1  1  0
#> TCGA.V4.A9F0.01     1       0          1  1  0
#> TCGA.V4.A9E7.01     1       0          1  1  0
#> TCGA.VD.A8KN.01     1       0          1  1  0
#> TCGA.VD.A8KK.01     1       0          1  1  0
#> TCGA.V4.A9EM.01     2       0          1  0  1
#> TCGA.VD.AA8Q.01     2       0          1  0  1
#> TCGA.VD.A8K9.01     2       0          1  0  1
#> TCGA.WC.A888.01     1       0          1  1  0
#> TCGA.VD.AA8R.01     2       0          1  0  1
#> TCGA.VD.A8KH.01     2       0          1  0  1
#> TCGA.RZ.AB0B.01     1       0          1  1  0
#> TCGA.V4.A9EJ.01     2       0          1  0  1
#> TCGA.VD.A8K7.01     2       0          1  0  1
#> TCGA.VD.AA8O.01     1       0          1  1  0
#> TCGA.VD.A8KA.01     2       0          1  0  1
#> TCGA.V4.A9EK.01     2       0          1  0  1
#> TCGA.V4.A9F8.01     1       0          1  1  0
#> TCGA.YZ.A984.01     1       0          1  1  0
#> TCGA.VD.A8KD.01     1       0          1  1  0
#> TCGA.YZ.A982.01     2       0          1  0  1
#> TCGA.WC.A88A.01     1       0          1  1  0
#> TCGA.WC.A87W.01     2       0          1  0  1
#> TCGA.V4.A9EH.01     2       0          1  0  1
#> TCGA.WC.A87U.01     2       0          1  0  1
#> TCGA.YZ.A983.01     2       0          1  0  1
#> TCGA.V4.A9EY.01     2       0          1  0  1
#> TCGA.WC.A87T.01     2       0          1  0  1
#> TCGA.VD.AA8N.01     1       0          1  1  0
#> TCGA.VD.A8KM.01     1       0          1  1  0
#> TCGA.VD.AA8P.01     1       0          1  1  0
#> TCGA.V4.A9EF.01     1       0          1  1  0
#> TCGA.V4.A9EE.01     1       0          1  1  0
#> TCGA.WC.A87Y.01     1       0          1  1  0
#> TCGA.VD.A8KE.01     2       0          1  0  1
#> TCGA.VD.A8KF.01     1       0          1  1  0
#> TCGA.VD.A8KO.01     2       0          1  0  1
#> TCGA.WC.A883.01     1       0          1  1  0
#> TCGA.V4.A9EA.01     2       0          1  0  1
#> TCGA.WC.A884.01     2       0          1  0  1
#> TCGA.V4.A9F5.01     1       0          1  1  0

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>                 class entropy silhouette   p1  p2   p3
#> TCGA.V4.A9EX.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.V4.A9E5.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.V4.A9EZ.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.WC.A885.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.V4.A9F3.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.V4.A9EU.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.V4.A9ET.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.V4.A9F7.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.V4.A9F1.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.V4.A9F4.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.YZ.A980.01     3   0.000      0.968 0.00 0.0 1.00
#> TCGA.VD.A8KJ.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.V3.A9ZX.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.WC.AA9A.01     3   0.000      0.968 0.00 0.0 1.00
#> TCGA.VD.AA8T.01     3   0.000      0.968 0.00 0.0 1.00
#> TCGA.V4.A9EW.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.WC.A880.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.WC.A881.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.V3.A9ZY.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.WC.AA9E.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.V4.A9EV.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.V4.A9E9.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.V4.A9E8.01     3   0.000      0.968 0.00 0.0 1.00
#> TCGA.VD.A8KB.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.VD.A8KL.01     3   0.000      0.968 0.00 0.0 1.00
#> TCGA.VD.A8KG.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.VD.AA8M.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.WC.A882.01     3   0.613      0.333 0.00 0.4 0.60
#> TCGA.V4.A9EO.01     3   0.000      0.968 0.00 0.0 1.00
#> TCGA.VD.A8KI.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.V4.A9F2.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.V4.A9EQ.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.VD.A8K8.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.V4.A9EL.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.V4.A9EI.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.VD.AA8S.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.V4.A9EC.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.V4.A9ED.01     3   0.000      0.968 0.00 0.0 1.00
#> TCGA.V4.A9ES.01     3   0.000      0.968 0.00 0.0 1.00
#> TCGA.YZ.A985.01     3   0.000      0.968 0.00 0.0 1.00
#> TCGA.V4.A9F0.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.V4.A9E7.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.VD.A8KN.01     3   0.000      0.968 0.00 0.0 1.00
#> TCGA.VD.A8KK.01     3   0.000      0.968 0.00 0.0 1.00
#> TCGA.V4.A9EM.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.VD.AA8Q.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.VD.A8K9.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.WC.A888.01     3   0.000      0.968 0.00 0.0 1.00
#> TCGA.VD.AA8R.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.VD.A8KH.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.RZ.AB0B.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.V4.A9EJ.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.VD.A8K7.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.VD.AA8O.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.VD.A8KA.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.V4.A9EK.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.V4.A9F8.01     3   0.153      0.931 0.04 0.0 0.96
#> TCGA.YZ.A984.01     3   0.000      0.968 0.00 0.0 1.00
#> TCGA.VD.A8KD.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.YZ.A982.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.WC.A88A.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.WC.A87W.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.V4.A9EH.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.WC.A87U.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.YZ.A983.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.V4.A9EY.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.WC.A87T.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.VD.AA8N.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.VD.A8KM.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.VD.AA8P.01     3   0.000      0.968 0.00 0.0 1.00
#> TCGA.V4.A9EF.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.V4.A9EE.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.WC.A87Y.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.VD.A8KE.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.VD.A8KF.01     3   0.000      0.968 0.00 0.0 1.00
#> TCGA.VD.A8KO.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.WC.A883.01     1   0.000      1.000 1.00 0.0 0.00
#> TCGA.V4.A9EA.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.WC.A884.01     2   0.000      1.000 0.00 1.0 0.00
#> TCGA.V4.A9F5.01     1   0.000      1.000 1.00 0.0 0.00

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>                 class entropy silhouette p1   p2 p3   p4
#> TCGA.V4.A9EX.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.V4.A9E5.01     4   0.000      1.000  0 0.00  0 1.00
#> TCGA.V4.A9EZ.01     2   0.265      0.885  0 0.88  0 0.12
#> TCGA.WC.A885.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.V4.A9F3.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.V4.A9EU.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.V4.A9ET.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.V4.A9F7.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.V4.A9F1.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.V4.A9F4.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.YZ.A980.01     3   0.000      1.000  0 0.00  1 0.00
#> TCGA.VD.A8KJ.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.V3.A9ZX.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.WC.AA9A.01     3   0.000      1.000  0 0.00  1 0.00
#> TCGA.VD.AA8T.01     3   0.000      1.000  0 0.00  1 0.00
#> TCGA.V4.A9EW.01     2   0.265      0.885  0 0.88  0 0.12
#> TCGA.WC.A880.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.WC.A881.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.V3.A9ZY.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.WC.AA9E.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.V4.A9EV.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.V4.A9E9.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.V4.A9E8.01     3   0.000      1.000  0 0.00  1 0.00
#> TCGA.VD.A8KB.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.VD.A8KL.01     3   0.000      1.000  0 0.00  1 0.00
#> TCGA.VD.A8KG.01     2   0.265      0.885  0 0.88  0 0.12
#> TCGA.VD.AA8M.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.WC.A882.01     4   0.000      1.000  0 0.00  0 1.00
#> TCGA.V4.A9EO.01     3   0.000      1.000  0 0.00  1 0.00
#> TCGA.VD.A8KI.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.V4.A9F2.01     4   0.000      1.000  0 0.00  0 1.00
#> TCGA.V4.A9EQ.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.VD.A8K8.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.V4.A9EL.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.V4.A9EI.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.VD.AA8S.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.V4.A9EC.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.V4.A9ED.01     3   0.000      1.000  0 0.00  1 0.00
#> TCGA.V4.A9ES.01     3   0.000      1.000  0 0.00  1 0.00
#> TCGA.YZ.A985.01     3   0.000      1.000  0 0.00  1 0.00
#> TCGA.V4.A9F0.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.V4.A9E7.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.VD.A8KN.01     3   0.000      1.000  0 0.00  1 0.00
#> TCGA.VD.A8KK.01     3   0.000      1.000  0 0.00  1 0.00
#> TCGA.V4.A9EM.01     4   0.000      1.000  0 0.00  0 1.00
#> TCGA.VD.AA8Q.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.VD.A8K9.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.WC.A888.01     3   0.000      1.000  0 0.00  1 0.00
#> TCGA.VD.AA8R.01     2   0.164      0.939  0 0.94  0 0.06
#> TCGA.VD.A8KH.01     2   0.265      0.885  0 0.88  0 0.12
#> TCGA.RZ.AB0B.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.V4.A9EJ.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.VD.A8K7.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.VD.AA8O.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.VD.A8KA.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.V4.A9EK.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.V4.A9F8.01     3   0.000      1.000  0 0.00  1 0.00
#> TCGA.YZ.A984.01     3   0.000      1.000  0 0.00  1 0.00
#> TCGA.VD.A8KD.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.YZ.A982.01     2   0.121      0.955  0 0.96  0 0.04
#> TCGA.WC.A88A.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.WC.A87W.01     4   0.000      1.000  0 0.00  0 1.00
#> TCGA.V4.A9EH.01     2   0.164      0.939  0 0.94  0 0.06
#> TCGA.WC.A87U.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.YZ.A983.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.V4.A9EY.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.WC.A87T.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.VD.AA8N.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.VD.A8KM.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.VD.AA8P.01     3   0.000      1.000  0 0.00  1 0.00
#> TCGA.V4.A9EF.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.V4.A9EE.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.WC.A87Y.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.VD.A8KE.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.VD.A8KF.01     3   0.000      1.000  0 0.00  1 0.00
#> TCGA.VD.A8KO.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.WC.A883.01     1   0.000      1.000  1 0.00  0 0.00
#> TCGA.V4.A9EA.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.WC.A884.01     2   0.000      0.981  0 1.00  0 0.00
#> TCGA.V4.A9F5.01     1   0.000      1.000  1 0.00  0 0.00

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>                 class entropy silhouette   p1   p2   p3   p4   p5
#> TCGA.V4.A9EX.01     1  0.0000    0.83564 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9E5.01     4  0.0000    0.90402 0.00 0.00 0.00 1.00 0.00
#> TCGA.V4.A9EZ.01     2  0.6530    0.25885 0.00 0.44 0.00 0.20 0.36
#> TCGA.WC.A885.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.V4.A9F3.01     1  0.4307   -0.00506 0.50 0.00 0.00 0.00 0.50
#> TCGA.V4.A9EU.01     1  0.0000    0.83564 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9ET.01     2  0.0609    0.87886 0.00 0.98 0.00 0.00 0.02
#> TCGA.V4.A9F7.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.V4.A9F1.01     1  0.4302    0.06266 0.52 0.00 0.00 0.00 0.48
#> TCGA.V4.A9F4.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.YZ.A980.01     3  0.0609    0.89735 0.00 0.00 0.98 0.00 0.02
#> TCGA.VD.A8KJ.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.V3.A9ZX.01     1  0.0000    0.83564 1.00 0.00 0.00 0.00 0.00
#> TCGA.WC.AA9A.01     3  0.2020    0.85960 0.00 0.00 0.90 0.00 0.10
#> TCGA.VD.AA8T.01     3  0.1732    0.88307 0.00 0.00 0.92 0.00 0.08
#> TCGA.V4.A9EW.01     2  0.6530    0.25885 0.00 0.44 0.00 0.20 0.36
#> TCGA.WC.A880.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.WC.A881.01     2  0.2280    0.82460 0.00 0.88 0.00 0.00 0.12
#> TCGA.V3.A9ZY.01     2  0.3274    0.74774 0.00 0.78 0.00 0.00 0.22
#> TCGA.WC.AA9E.01     2  0.0609    0.87921 0.00 0.98 0.00 0.00 0.02
#> TCGA.V4.A9EV.01     1  0.3796    0.50263 0.70 0.00 0.00 0.00 0.30
#> TCGA.V4.A9E9.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.V4.A9E8.01     3  0.0609    0.89735 0.00 0.00 0.98 0.00 0.02
#> TCGA.VD.A8KB.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.VD.A8KL.01     3  0.0609    0.90180 0.00 0.00 0.98 0.00 0.02
#> TCGA.VD.A8KG.01     5  0.6632   -0.39028 0.00 0.38 0.00 0.22 0.40
#> TCGA.VD.AA8M.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.WC.A882.01     4  0.2280    0.92917 0.00 0.00 0.00 0.88 0.12
#> TCGA.V4.A9EO.01     3  0.0000    0.90079 0.00 0.00 1.00 0.00 0.00
#> TCGA.VD.A8KI.01     1  0.0609    0.82310 0.98 0.00 0.00 0.00 0.02
#> TCGA.V4.A9F2.01     4  0.2516    0.92711 0.00 0.00 0.00 0.86 0.14
#> TCGA.V4.A9EQ.01     1  0.0000    0.83564 1.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8K8.01     1  0.4302    0.06266 0.52 0.00 0.00 0.00 0.48
#> TCGA.V4.A9EL.01     1  0.0000    0.83564 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EI.01     1  0.0000    0.83564 1.00 0.00 0.00 0.00 0.00
#> TCGA.VD.AA8S.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.V4.A9EC.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.V4.A9ED.01     3  0.0000    0.90079 0.00 0.00 1.00 0.00 0.00
#> TCGA.V4.A9ES.01     3  0.0609    0.89922 0.00 0.00 0.98 0.00 0.02
#> TCGA.YZ.A985.01     3  0.0000    0.90079 0.00 0.00 1.00 0.00 0.00
#> TCGA.V4.A9F0.01     1  0.0000    0.83564 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9E7.01     1  0.0000    0.83564 1.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KN.01     3  0.1043    0.89769 0.00 0.00 0.96 0.00 0.04
#> TCGA.VD.A8KK.01     3  0.1043    0.89769 0.00 0.00 0.96 0.00 0.04
#> TCGA.V4.A9EM.01     4  0.1410    0.87906 0.00 0.00 0.00 0.94 0.06
#> TCGA.VD.AA8Q.01     2  0.1043    0.86968 0.00 0.96 0.00 0.00 0.04
#> TCGA.VD.A8K9.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.WC.A888.01     5  0.5425   -0.31908 0.06 0.00 0.42 0.00 0.52
#> TCGA.VD.AA8R.01     2  0.5579    0.54115 0.00 0.60 0.00 0.10 0.30
#> TCGA.VD.A8KH.01     2  0.6498    0.29349 0.00 0.46 0.00 0.20 0.34
#> TCGA.RZ.AB0B.01     1  0.0000    0.83564 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EJ.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.VD.A8K7.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.VD.AA8O.01     1  0.2516    0.72400 0.86 0.00 0.00 0.00 0.14
#> TCGA.VD.A8KA.01     2  0.2732    0.79758 0.00 0.84 0.00 0.00 0.16
#> TCGA.V4.A9EK.01     2  0.3796    0.68077 0.00 0.70 0.00 0.00 0.30
#> TCGA.V4.A9F8.01     3  0.5425    0.29734 0.06 0.00 0.52 0.00 0.42
#> TCGA.YZ.A984.01     3  0.0000    0.90079 0.00 0.00 1.00 0.00 0.00
#> TCGA.VD.A8KD.01     5  0.4307   -0.28045 0.50 0.00 0.00 0.00 0.50
#> TCGA.YZ.A982.01     2  0.3983    0.63914 0.00 0.66 0.00 0.00 0.34
#> TCGA.WC.A88A.01     1  0.0000    0.83564 1.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A87W.01     4  0.2732    0.91632 0.00 0.00 0.00 0.84 0.16
#> TCGA.V4.A9EH.01     2  0.5659    0.51691 0.00 0.58 0.00 0.10 0.32
#> TCGA.WC.A87U.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.YZ.A983.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.V4.A9EY.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.WC.A87T.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.VD.AA8N.01     1  0.0000    0.83564 1.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KM.01     5  0.5173   -0.18442 0.46 0.00 0.04 0.00 0.50
#> TCGA.VD.AA8P.01     3  0.2020    0.87135 0.00 0.00 0.90 0.00 0.10
#> TCGA.V4.A9EF.01     1  0.2929    0.67662 0.82 0.00 0.00 0.00 0.18
#> TCGA.V4.A9EE.01     1  0.0000    0.83564 1.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A87Y.01     1  0.4307   -0.00506 0.50 0.00 0.00 0.00 0.50
#> TCGA.VD.A8KE.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.VD.A8KF.01     3  0.4227    0.44671 0.00 0.00 0.58 0.00 0.42
#> TCGA.VD.A8KO.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.WC.A883.01     1  0.0000    0.83564 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EA.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.WC.A884.01     2  0.0000    0.88843 0.00 1.00 0.00 0.00 0.00
#> TCGA.V4.A9F5.01     1  0.0000    0.83564 1.00 0.00 0.00 0.00 0.00

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>                 class entropy silhouette   p1   p2   p3   p4   p5   p6
#> TCGA.V4.A9EX.01     1  0.0000      0.937 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9E5.01     4  0.3819      0.809 0.00 0.00 0.00 0.70 0.02 0.28
#> TCGA.V4.A9EZ.01     6  0.2454      0.684 0.00 0.16 0.00 0.00 0.00 0.84
#> TCGA.WC.A885.01     2  0.0000      0.926 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9F3.01     5  0.3409      0.870 0.30 0.00 0.00 0.00 0.70 0.00
#> TCGA.V4.A9EU.01     1  0.0000      0.937 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9ET.01     2  0.0547      0.909 0.00 0.98 0.00 0.00 0.00 0.02
#> TCGA.V4.A9F7.01     2  0.0000      0.926 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9F1.01     5  0.3647      0.805 0.36 0.00 0.00 0.00 0.64 0.00
#> TCGA.V4.A9F4.01     2  0.0000      0.926 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.YZ.A980.01     3  0.2474      0.842 0.00 0.00 0.88 0.00 0.08 0.04
#> TCGA.VD.A8KJ.01     2  0.0000      0.926 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.V3.A9ZX.01     1  0.0000      0.937 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.AA9A.01     3  0.3258      0.825 0.00 0.00 0.84 0.02 0.10 0.04
#> TCGA.VD.AA8T.01     3  0.1480      0.875 0.00 0.00 0.94 0.02 0.04 0.00
#> TCGA.V4.A9EW.01     6  0.3156      0.698 0.00 0.18 0.00 0.02 0.00 0.80
#> TCGA.WC.A880.01     2  0.0000      0.926 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A881.01     2  0.2454      0.722 0.00 0.84 0.00 0.00 0.00 0.16
#> TCGA.V3.A9ZY.01     2  0.3851     -0.231 0.00 0.54 0.00 0.00 0.00 0.46
#> TCGA.WC.AA9E.01     2  0.0937      0.891 0.00 0.96 0.00 0.00 0.00 0.04
#> TCGA.V4.A9EV.01     1  0.3756     -0.129 0.60 0.00 0.00 0.00 0.40 0.00
#> TCGA.V4.A9E9.01     2  0.0000      0.926 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9E8.01     3  0.4088      0.774 0.00 0.00 0.78 0.02 0.10 0.10
#> TCGA.VD.A8KB.01     2  0.0000      0.926 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KL.01     3  0.0547      0.879 0.00 0.00 0.98 0.00 0.02 0.00
#> TCGA.VD.A8KG.01     6  0.4879      0.474 0.00 0.12 0.00 0.12 0.04 0.72
#> TCGA.VD.AA8M.01     2  0.0000      0.926 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A882.01     4  0.3647      0.822 0.00 0.00 0.00 0.64 0.00 0.36
#> TCGA.V4.A9EO.01     3  0.0547      0.879 0.00 0.00 0.98 0.00 0.02 0.00
#> TCGA.VD.A8KI.01     1  0.0000      0.937 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9F2.01     4  0.3706      0.817 0.00 0.00 0.00 0.62 0.00 0.38
#> TCGA.V4.A9EQ.01     1  0.0000      0.937 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8K8.01     5  0.3578      0.835 0.34 0.00 0.00 0.00 0.66 0.00
#> TCGA.V4.A9EL.01     1  0.0000      0.937 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EI.01     1  0.0000      0.937 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.AA8S.01     2  0.0000      0.926 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EC.01     2  0.0000      0.926 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9ED.01     3  0.0547      0.883 0.00 0.00 0.98 0.00 0.02 0.00
#> TCGA.V4.A9ES.01     3  0.1092      0.879 0.00 0.00 0.96 0.02 0.02 0.00
#> TCGA.YZ.A985.01     3  0.0547      0.879 0.00 0.00 0.98 0.00 0.02 0.00
#> TCGA.V4.A9F0.01     1  0.0000      0.937 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9E7.01     1  0.0000      0.937 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KN.01     3  0.0547      0.883 0.00 0.00 0.98 0.00 0.02 0.00
#> TCGA.VD.A8KK.01     3  0.0547      0.883 0.00 0.00 0.98 0.00 0.02 0.00
#> TCGA.V4.A9EM.01     4  0.3660      0.586 0.00 0.00 0.00 0.78 0.16 0.06
#> TCGA.VD.AA8Q.01     2  0.0547      0.908 0.00 0.98 0.00 0.00 0.00 0.02
#> TCGA.VD.A8K9.01     2  0.0547      0.909 0.00 0.98 0.00 0.00 0.00 0.02
#> TCGA.WC.A888.01     5  0.3711      0.371 0.02 0.00 0.26 0.00 0.72 0.00
#> TCGA.VD.AA8R.01     6  0.3647      0.671 0.00 0.36 0.00 0.00 0.00 0.64
#> TCGA.VD.A8KH.01     6  0.2793      0.715 0.00 0.20 0.00 0.00 0.00 0.80
#> TCGA.RZ.AB0B.01     1  0.0000      0.937 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EJ.01     2  0.0000      0.926 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8K7.01     2  0.0000      0.926 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.VD.AA8O.01     1  0.2631      0.674 0.82 0.00 0.00 0.00 0.18 0.00
#> TCGA.VD.A8KA.01     2  0.3309      0.465 0.00 0.72 0.00 0.00 0.00 0.28
#> TCGA.V4.A9EK.01     2  0.6274     -0.319 0.00 0.48 0.00 0.08 0.08 0.36
#> TCGA.V4.A9F8.01     3  0.4246      0.414 0.00 0.00 0.58 0.02 0.40 0.00
#> TCGA.YZ.A984.01     3  0.1092      0.874 0.00 0.00 0.96 0.00 0.02 0.02
#> TCGA.VD.A8KD.01     5  0.3409      0.870 0.30 0.00 0.00 0.00 0.70 0.00
#> TCGA.YZ.A982.01     6  0.6326      0.537 0.00 0.30 0.00 0.10 0.08 0.52
#> TCGA.WC.A88A.01     1  0.0000      0.937 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A87W.01     4  0.3756      0.799 0.00 0.00 0.00 0.60 0.00 0.40
#> TCGA.V4.A9EH.01     6  0.3578      0.688 0.00 0.34 0.00 0.00 0.00 0.66
#> TCGA.WC.A87U.01     2  0.0000      0.926 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.YZ.A983.01     2  0.0000      0.926 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EY.01     2  0.0000      0.926 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A87T.01     2  0.0000      0.926 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.VD.AA8N.01     1  0.0000      0.937 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KM.01     5  0.3309      0.869 0.28 0.00 0.00 0.00 0.72 0.00
#> TCGA.VD.AA8P.01     3  0.1480      0.875 0.00 0.00 0.94 0.02 0.04 0.00
#> TCGA.V4.A9EF.01     1  0.2454      0.711 0.84 0.00 0.00 0.00 0.16 0.00
#> TCGA.V4.A9EE.01     1  0.0000      0.937 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A87Y.01     5  0.3309      0.869 0.28 0.00 0.00 0.00 0.72 0.00
#> TCGA.VD.A8KE.01     2  0.0000      0.926 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KF.01     3  0.4328      0.251 0.00 0.00 0.52 0.02 0.46 0.00
#> TCGA.VD.A8KO.01     2  0.0000      0.926 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A883.01     1  0.0000      0.937 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EA.01     2  0.0000      0.926 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A884.01     2  0.0000      0.926 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9F5.01     1  0.0000      0.937 1.00 0.00 0.00 0.00 0.00 0.00

show/hide code output

cbind(get_classes(res, k = 7), get_membership(res, k = 7))
#>                 class entropy silhouette   p1   p2   p3   p4   p5   p6   p7
#> TCGA.V4.A9EX.01     1  0.0000      0.943 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9E5.01     4  0.4763      0.621 0.00 0.00 0.00 0.62 0.00 0.18 0.20
#> TCGA.V4.A9EZ.01     6  0.1363      0.450 0.00 0.04 0.00 0.00 0.00 0.94 0.02
#> TCGA.WC.A885.01     2  0.0000      0.973 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9F3.01     5  0.1671      0.795 0.10 0.00 0.00 0.00 0.90 0.00 0.00
#> TCGA.V4.A9EU.01     1  0.0000      0.943 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9ET.01     2  0.0504      0.957 0.00 0.98 0.00 0.00 0.00 0.00 0.02
#> TCGA.V4.A9F7.01     2  0.0000      0.973 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9F1.01     5  0.2708      0.690 0.22 0.00 0.00 0.00 0.78 0.00 0.00
#> TCGA.V4.A9F4.01     2  0.0000      0.973 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.YZ.A980.01     3  0.4763      0.597 0.00 0.00 0.62 0.00 0.20 0.00 0.18
#> TCGA.VD.A8KJ.01     2  0.0000      0.973 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V3.A9ZX.01     1  0.0000      0.943 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.AA9A.01     3  0.5115      0.250 0.00 0.00 0.48 0.00 0.38 0.00 0.14
#> TCGA.VD.AA8T.01     3  0.2572      0.727 0.00 0.00 0.80 0.00 0.20 0.00 0.00
#> TCGA.V4.A9EW.01     6  0.1166      0.487 0.00 0.06 0.00 0.00 0.00 0.94 0.00
#> TCGA.WC.A880.01     2  0.0000      0.973 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A881.01     2  0.2313      0.840 0.00 0.88 0.00 0.00 0.00 0.06 0.06
#> TCGA.V3.A9ZY.01     6  0.3496      0.427 0.00 0.42 0.00 0.00 0.00 0.58 0.00
#> TCGA.WC.AA9E.01     2  0.1166      0.917 0.00 0.94 0.00 0.00 0.00 0.00 0.06
#> TCGA.V4.A9EV.01     1  0.3294      0.490 0.66 0.00 0.00 0.00 0.34 0.00 0.00
#> TCGA.V4.A9E9.01     2  0.0000      0.973 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9E8.01     3  0.4175      0.542 0.00 0.00 0.58 0.00 0.04 0.00 0.38
#> TCGA.VD.A8KB.01     2  0.0000      0.973 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KL.01     3  0.0504      0.839 0.00 0.00 0.98 0.00 0.02 0.00 0.00
#> TCGA.VD.A8KG.01     6  0.4536      0.320 0.00 0.06 0.00 0.08 0.00 0.72 0.14
#> TCGA.VD.AA8M.01     2  0.0000      0.973 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A882.01     4  0.3496      0.673 0.00 0.00 0.00 0.58 0.00 0.42 0.00
#> TCGA.V4.A9EO.01     3  0.0504      0.838 0.00 0.00 0.98 0.00 0.00 0.00 0.02
#> TCGA.VD.A8KI.01     1  0.1166      0.911 0.94 0.00 0.00 0.00 0.06 0.00 0.00
#> TCGA.V4.A9F2.01     4  0.3985      0.654 0.00 0.00 0.00 0.52 0.00 0.46 0.02
#> TCGA.V4.A9EQ.01     1  0.0000      0.943 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8K8.01     5  0.2081      0.770 0.14 0.00 0.00 0.00 0.86 0.00 0.00
#> TCGA.V4.A9EL.01     1  0.0000      0.943 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EI.01     1  0.0000      0.943 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.AA8S.01     2  0.0000      0.973 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EC.01     2  0.0000      0.973 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9ED.01     3  0.1006      0.839 0.00 0.00 0.96 0.00 0.02 0.00 0.02
#> TCGA.V4.A9ES.01     3  0.1928      0.836 0.00 0.00 0.90 0.00 0.08 0.00 0.02
#> TCGA.YZ.A985.01     3  0.0504      0.838 0.00 0.00 0.98 0.00 0.00 0.00 0.02
#> TCGA.V4.A9F0.01     1  0.0504      0.934 0.98 0.00 0.00 0.00 0.02 0.00 0.00
#> TCGA.V4.A9E7.01     1  0.0000      0.943 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KN.01     3  0.1433      0.825 0.00 0.00 0.92 0.00 0.08 0.00 0.00
#> TCGA.VD.A8KK.01     3  0.1166      0.832 0.00 0.00 0.94 0.00 0.06 0.00 0.00
#> TCGA.V4.A9EM.01     4  0.3011      0.476 0.00 0.00 0.00 0.82 0.06 0.00 0.12
#> TCGA.VD.AA8Q.01     2  0.0504      0.957 0.00 0.98 0.00 0.00 0.00 0.02 0.00
#> TCGA.VD.A8K9.01     2  0.0000      0.973 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A888.01     5  0.1166      0.711 0.00 0.00 0.06 0.00 0.94 0.00 0.00
#> TCGA.VD.AA8R.01     6  0.2708      0.561 0.00 0.22 0.00 0.00 0.00 0.78 0.00
#> TCGA.VD.A8KH.01     6  0.1433      0.505 0.00 0.08 0.00 0.00 0.00 0.92 0.00
#> TCGA.RZ.AB0B.01     1  0.0000      0.943 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EJ.01     2  0.0000      0.973 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8K7.01     2  0.0504      0.957 0.00 0.98 0.00 0.00 0.00 0.02 0.00
#> TCGA.VD.AA8O.01     1  0.2572      0.747 0.80 0.00 0.00 0.00 0.20 0.00 0.00
#> TCGA.VD.A8KA.01     2  0.3637      0.514 0.00 0.72 0.00 0.00 0.00 0.24 0.04
#> TCGA.V4.A9EK.01     6  0.6022      0.354 0.00 0.30 0.00 0.02 0.00 0.36 0.32
#> TCGA.V4.A9F8.01     5  0.3909      0.216 0.02 0.00 0.40 0.00 0.58 0.00 0.00
#> TCGA.YZ.A984.01     3  0.1166      0.827 0.00 0.00 0.94 0.00 0.00 0.00 0.06
#> TCGA.VD.A8KD.01     5  0.1671      0.795 0.10 0.00 0.00 0.00 0.90 0.00 0.00
#> TCGA.YZ.A982.01     6  0.6046      0.334 0.00 0.20 0.00 0.04 0.00 0.44 0.32
#> TCGA.WC.A88A.01     1  0.0000      0.943 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A87W.01     4  0.3994      0.641 0.00 0.00 0.00 0.50 0.00 0.48 0.02
#> TCGA.V4.A9EH.01     6  0.2708      0.564 0.00 0.22 0.00 0.00 0.00 0.78 0.00
#> TCGA.WC.A87U.01     2  0.0504      0.957 0.00 0.98 0.00 0.00 0.00 0.02 0.00
#> TCGA.YZ.A983.01     2  0.0000      0.973 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EY.01     2  0.0000      0.973 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A87T.01     2  0.0000      0.973 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.AA8N.01     1  0.0000      0.943 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KM.01     5  0.1671      0.795 0.10 0.00 0.00 0.00 0.90 0.00 0.00
#> TCGA.VD.AA8P.01     3  0.1671      0.822 0.00 0.00 0.90 0.00 0.10 0.00 0.00
#> TCGA.V4.A9EF.01     1  0.2422      0.788 0.82 0.00 0.00 0.00 0.18 0.00 0.00
#> TCGA.V4.A9EE.01     1  0.1166      0.909 0.94 0.00 0.00 0.00 0.06 0.00 0.00
#> TCGA.WC.A87Y.01     5  0.1671      0.795 0.10 0.00 0.00 0.00 0.90 0.00 0.00
#> TCGA.VD.A8KE.01     2  0.0000      0.973 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KF.01     5  0.3562     -0.132 0.00 0.00 0.50 0.00 0.50 0.00 0.00
#> TCGA.VD.A8KO.01     2  0.0000      0.973 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A883.01     1  0.0000      0.943 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EA.01     2  0.0000      0.973 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A884.01     2  0.0000      0.973 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9F5.01     1  0.0504      0.934 0.98 0.00 0.00 0.00 0.02 0.00 0.00

show/hide code output

cbind(get_classes(res, k = 8), get_membership(res, k = 8))
#>                 class entropy silhouette   p1   p2   p3   p4   p5   p6   p7   p8
#> TCGA.V4.A9EX.01     1  0.0000     0.9061 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9E5.01     4  0.3131     0.1497 0.00 0.00 0.00 0.84 0.04 0.06 0.04 0.02
#> TCGA.V4.A9EZ.01     6  0.0941     0.5473 0.00 0.02 0.00 0.02 0.00 0.96 0.00 0.00
#> TCGA.WC.A885.01     2  0.0000     0.9734 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9F3.01     5  0.1804     0.8140 0.08 0.00 0.00 0.00 0.90 0.00 0.00 0.02
#> TCGA.V4.A9EU.01     1  0.0000     0.9061 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9ET.01     2  0.0808     0.9411 0.00 0.96 0.00 0.00 0.00 0.00 0.00 0.04
#> TCGA.V4.A9F7.01     2  0.0000     0.9734 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9F1.01     5  0.2534     0.7152 0.22 0.00 0.00 0.00 0.78 0.00 0.00 0.00
#> TCGA.V4.A9F4.01     2  0.0000     0.9734 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.YZ.A980.01     3  0.5591     0.4750 0.00 0.00 0.56 0.04 0.26 0.00 0.04 0.10
#> TCGA.VD.A8KJ.01     2  0.0000     0.9734 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V3.A9ZX.01     1  0.0000     0.9061 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.AA9A.01     3  0.5999     0.4200 0.00 0.00 0.50 0.02 0.30 0.02 0.04 0.12
#> TCGA.VD.AA8T.01     3  0.2807     0.7627 0.00 0.00 0.84 0.00 0.10 0.00 0.04 0.02
#> TCGA.V4.A9EW.01     6  0.0808     0.5789 0.00 0.04 0.00 0.00 0.00 0.96 0.00 0.00
#> TCGA.WC.A880.01     2  0.0000     0.9734 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A881.01     2  0.2862     0.7749 0.00 0.82 0.00 0.00 0.00 0.10 0.00 0.08
#> TCGA.V3.A9ZY.01     6  0.3729     0.1740 0.00 0.46 0.00 0.00 0.00 0.52 0.00 0.02
#> TCGA.WC.AA9E.01     2  0.2025     0.8562 0.00 0.88 0.00 0.00 0.00 0.02 0.00 0.10
#> TCGA.V4.A9EV.01     1  0.3299     0.1999 0.56 0.00 0.00 0.00 0.44 0.00 0.00 0.00
#> TCGA.V4.A9E9.01     2  0.0000     0.9734 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9E8.01     8  0.6775    -0.2605 0.00 0.00 0.34 0.06 0.10 0.00 0.14 0.36
#> TCGA.VD.A8KB.01     2  0.0000     0.9734 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KL.01     3  0.1275     0.8035 0.00 0.00 0.94 0.00 0.00 0.00 0.04 0.02
#> TCGA.VD.A8KG.01     6  0.3601     0.3268 0.00 0.02 0.00 0.06 0.00 0.76 0.00 0.16
#> TCGA.VD.AA8M.01     2  0.0000     0.9734 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A882.01     4  0.4642     0.6691 0.00 0.00 0.00 0.60 0.00 0.30 0.06 0.04
#> TCGA.V4.A9EO.01     3  0.2204     0.7746 0.00 0.00 0.90 0.02 0.02 0.00 0.04 0.02
#> TCGA.VD.A8KI.01     1  0.1765     0.8162 0.88 0.00 0.00 0.00 0.12 0.00 0.00 0.00
#> TCGA.V4.A9F2.01     4  0.3907     0.7166 0.00 0.00 0.00 0.58 0.00 0.38 0.00 0.04
#> TCGA.V4.A9EQ.01     1  0.0471     0.8989 0.98 0.00 0.00 0.00 0.02 0.00 0.00 0.00
#> TCGA.VD.A8K8.01     5  0.2114     0.7879 0.16 0.00 0.00 0.00 0.84 0.00 0.00 0.00
#> TCGA.V4.A9EL.01     1  0.0000     0.9061 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EI.01     1  0.0000     0.9061 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.AA8S.01     2  0.0000     0.9734 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EC.01     2  0.0000     0.9734 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9ED.01     3  0.0471     0.8055 0.00 0.00 0.98 0.00 0.00 0.00 0.00 0.02
#> TCGA.V4.A9ES.01     3  0.2204     0.8011 0.00 0.00 0.90 0.02 0.04 0.00 0.02 0.02
#> TCGA.YZ.A985.01     3  0.1275     0.8008 0.00 0.00 0.94 0.00 0.04 0.00 0.00 0.02
#> TCGA.V4.A9F0.01     1  0.1275     0.8774 0.94 0.00 0.00 0.00 0.04 0.00 0.02 0.00
#> TCGA.V4.A9E7.01     1  0.0000     0.9061 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KN.01     3  0.1741     0.8053 0.00 0.00 0.92 0.00 0.04 0.00 0.02 0.02
#> TCGA.VD.A8KK.01     3  0.2071     0.8000 0.00 0.00 0.90 0.00 0.04 0.00 0.02 0.04
#> TCGA.V4.A9EM.01     7  0.2267     0.0000 0.00 0.00 0.00 0.18 0.00 0.00 0.82 0.00
#> TCGA.VD.AA8Q.01     2  0.0941     0.9391 0.00 0.96 0.00 0.00 0.00 0.02 0.00 0.02
#> TCGA.VD.A8K9.01     2  0.0471     0.9573 0.00 0.98 0.00 0.00 0.00 0.00 0.00 0.02
#> TCGA.WC.A888.01     5  0.2020     0.7416 0.02 0.00 0.06 0.00 0.90 0.00 0.00 0.02
#> TCGA.VD.AA8R.01     6  0.2719     0.5777 0.00 0.18 0.00 0.00 0.00 0.80 0.00 0.02
#> TCGA.VD.A8KH.01     6  0.1874     0.5262 0.00 0.02 0.00 0.02 0.00 0.92 0.02 0.02
#> TCGA.RZ.AB0B.01     1  0.0000     0.9061 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EJ.01     2  0.0000     0.9734 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8K7.01     2  0.0000     0.9734 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.AA8O.01     1  0.4375     0.5269 0.66 0.00 0.02 0.00 0.26 0.00 0.04 0.02
#> TCGA.VD.A8KA.01     2  0.2818     0.7709 0.00 0.82 0.00 0.00 0.00 0.12 0.00 0.06
#> TCGA.V4.A9EK.01     8  0.5450     0.3178 0.00 0.24 0.00 0.04 0.00 0.20 0.00 0.52
#> TCGA.V4.A9F8.01     5  0.4358     0.0982 0.00 0.00 0.40 0.00 0.54 0.00 0.04 0.02
#> TCGA.YZ.A984.01     3  0.2532     0.7631 0.00 0.00 0.88 0.02 0.04 0.00 0.04 0.02
#> TCGA.VD.A8KD.01     5  0.1765     0.8179 0.12 0.00 0.00 0.00 0.88 0.00 0.00 0.00
#> TCGA.YZ.A982.01     8  0.5469     0.2984 0.00 0.16 0.00 0.06 0.00 0.24 0.00 0.54
#> TCGA.WC.A88A.01     1  0.0000     0.9061 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A87W.01     4  0.3971     0.6896 0.00 0.00 0.00 0.54 0.00 0.42 0.00 0.04
#> TCGA.V4.A9EH.01     6  0.2719     0.5819 0.00 0.18 0.00 0.00 0.00 0.80 0.00 0.02
#> TCGA.WC.A87U.01     2  0.0000     0.9734 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.YZ.A983.01     2  0.0000     0.9734 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EY.01     2  0.0000     0.9734 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A87T.01     2  0.0000     0.9734 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.AA8N.01     1  0.0000     0.9061 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KM.01     5  0.1804     0.8140 0.08 0.00 0.00 0.00 0.90 0.00 0.00 0.02
#> TCGA.VD.AA8P.01     3  0.1741     0.8060 0.00 0.00 0.92 0.00 0.04 0.00 0.02 0.02
#> TCGA.V4.A9EF.01     1  0.5024     0.5151 0.64 0.00 0.10 0.00 0.20 0.00 0.04 0.02
#> TCGA.V4.A9EE.01     1  0.1563     0.8469 0.90 0.00 0.00 0.00 0.10 0.00 0.00 0.00
#> TCGA.WC.A87Y.01     5  0.1563     0.8224 0.10 0.00 0.00 0.00 0.90 0.00 0.00 0.00
#> TCGA.VD.A8KE.01     2  0.0000     0.9734 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KF.01     3  0.3943     0.3041 0.00 0.00 0.56 0.00 0.40 0.00 0.00 0.04
#> TCGA.VD.A8KO.01     2  0.0000     0.9734 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A883.01     1  0.0000     0.9061 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EA.01     2  0.0000     0.9734 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A884.01     2  0.0000     0.9734 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9F5.01     1  0.0471     0.8989 0.98 0.00 0.00 0.00 0.02 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)

plot of chunk tab-node-0-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-node-0-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-node-0-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-node-0-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-node-0-consensus-heatmap-5

consensus_heatmap(res, k = 7)

plot of chunk tab-node-0-consensus-heatmap-6

consensus_heatmap(res, k = 8)

plot of chunk tab-node-0-consensus-heatmap-7

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-node-0-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-node-0-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-node-0-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-node-0-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-node-0-membership-heatmap-5

membership_heatmap(res, k = 7)

plot of chunk tab-node-0-membership-heatmap-6

membership_heatmap(res, k = 8)

plot of chunk tab-node-0-membership-heatmap-7

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.

get_signatures(res, k = 2)

plot of chunk tab-node-0-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-node-0-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-node-0-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-node-0-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-node-0-get-signatures-5

get_signatures(res, k = 7)

plot of chunk tab-node-0-get-signatures-6

get_signatures(res, k = 8)

plot of chunk tab-node-0-get-signatures-7

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk node-0-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-node-0-dimension-reduction-1

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

plot of chunk tab-node-0-dimension-reduction-2

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

plot of chunk tab-node-0-dimension-reduction-3

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

plot of chunk tab-node-0-dimension-reduction-4

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

plot of chunk tab-node-0-dimension-reduction-5

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

plot of chunk tab-node-0-dimension-reduction-6

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

plot of chunk tab-node-0-dimension-reduction-7

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk node-0-collect-classes

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.


Node01

Parent node: Node0. Child nodes: Node011-leaf , Node012-leaf , Node013-leaf , Node021 , Node022-leaf , Node023-leaf , Node031-leaf , Node032-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, 5, 6, 7, 8.
#>   On a matrix with 30000 rows and 24 columns.
#>   Top rows (1000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 350 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)

plot of chunk node-01-collect-plots

The plots are:

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:

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)

plot of chunk node-01-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.3449 0.656   0.656
#> 3 3 1.000           0.977       0.988         0.8588 0.696   0.536
#> 4 4 0.848           0.825       0.937         0.0330 0.978   0.938
#> 5 5 0.762           0.743       0.906         0.0277 0.982   0.945
#> 6 6 0.766           0.707       0.887         0.0419 1.000   1.000
#> 7 7 0.775           0.649       0.875         0.0372 0.946   0.826
#> 8 8 0.772           0.532       0.858         0.0393 0.986   0.944

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>                 class entropy silhouette p1 p2
#> TCGA.V4.A9EX.01     1       0          1  1  0
#> TCGA.V4.A9F3.01     2       0          1  0  1
#> TCGA.V4.A9EU.01     1       0          1  1  0
#> TCGA.V4.A9F1.01     2       0          1  0  1
#> TCGA.V3.A9ZX.01     2       0          1  0  1
#> TCGA.V4.A9EV.01     2       0          1  0  1
#> TCGA.VD.A8KI.01     2       0          1  0  1
#> TCGA.V4.A9EQ.01     2       0          1  0  1
#> TCGA.VD.A8K8.01     2       0          1  0  1
#> TCGA.V4.A9EL.01     2       0          1  0  1
#> TCGA.V4.A9EI.01     1       0          1  1  0
#> TCGA.V4.A9F0.01     2       0          1  0  1
#> TCGA.V4.A9E7.01     2       0          1  0  1
#> TCGA.RZ.AB0B.01     2       0          1  0  1
#> TCGA.VD.AA8O.01     2       0          1  0  1
#> TCGA.VD.A8KD.01     2       0          1  0  1
#> TCGA.WC.A88A.01     1       0          1  1  0
#> TCGA.VD.AA8N.01     2       0          1  0  1
#> TCGA.VD.A8KM.01     2       0          1  0  1
#> TCGA.V4.A9EF.01     2       0          1  0  1
#> TCGA.V4.A9EE.01     2       0          1  0  1
#> TCGA.WC.A87Y.01     2       0          1  0  1
#> TCGA.WC.A883.01     1       0          1  1  0
#> TCGA.V4.A9F5.01     2       0          1  0  1

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>                 class entropy silhouette p1   p2   p3
#> TCGA.V4.A9EX.01     1   0.000      1.000  1 0.00 0.00
#> TCGA.V4.A9F3.01     2   0.000      1.000  0 1.00 0.00
#> TCGA.V4.A9EU.01     1   0.000      1.000  1 0.00 0.00
#> TCGA.V4.A9F1.01     2   0.000      1.000  0 1.00 0.00
#> TCGA.V3.A9ZX.01     3   0.000      0.939  0 0.00 1.00
#> TCGA.V4.A9EV.01     2   0.000      1.000  0 1.00 0.00
#> TCGA.VD.A8KI.01     3   0.000      0.939  0 0.00 1.00
#> TCGA.V4.A9EQ.01     2   0.000      1.000  0 1.00 0.00
#> TCGA.VD.A8K8.01     2   0.000      1.000  0 1.00 0.00
#> TCGA.V4.A9EL.01     3   0.000      0.939  0 0.00 1.00
#> TCGA.V4.A9EI.01     1   0.000      1.000  1 0.00 0.00
#> TCGA.V4.A9F0.01     2   0.000      1.000  0 1.00 0.00
#> TCGA.V4.A9E7.01     3   0.153      0.942  0 0.04 0.96
#> TCGA.RZ.AB0B.01     3   0.400      0.825  0 0.16 0.84
#> TCGA.VD.AA8O.01     2   0.000      1.000  0 1.00 0.00
#> TCGA.VD.A8KD.01     2   0.000      1.000  0 1.00 0.00
#> TCGA.WC.A88A.01     1   0.000      1.000  1 0.00 0.00
#> TCGA.VD.AA8N.01     3   0.153      0.941  0 0.04 0.96
#> TCGA.VD.A8KM.01     2   0.000      1.000  0 1.00 0.00
#> TCGA.V4.A9EF.01     2   0.000      1.000  0 1.00 0.00
#> TCGA.V4.A9EE.01     3   0.207      0.931  0 0.06 0.94
#> TCGA.WC.A87Y.01     2   0.000      1.000  0 1.00 0.00
#> TCGA.WC.A883.01     1   0.000      1.000  1 0.00 0.00
#> TCGA.V4.A9F5.01     2   0.000      1.000  0 1.00 0.00

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>                 class entropy silhouette   p1   p2   p3   p4
#> TCGA.V4.A9EX.01     1  0.0000      0.991 1.00 0.00 0.00 0.00
#> TCGA.V4.A9F3.01     2  0.0000      0.994 0.00 1.00 0.00 0.00
#> TCGA.V4.A9EU.01     1  0.0000      0.991 1.00 0.00 0.00 0.00
#> TCGA.V4.A9F1.01     2  0.0000      0.994 0.00 1.00 0.00 0.00
#> TCGA.V3.A9ZX.01     3  0.4977      0.508 0.00 0.00 0.54 0.46
#> TCGA.V4.A9EV.01     2  0.0000      0.994 0.00 1.00 0.00 0.00
#> TCGA.VD.A8KI.01     3  0.5062      0.613 0.00 0.02 0.68 0.30
#> TCGA.V4.A9EQ.01     2  0.0000      0.994 0.00 1.00 0.00 0.00
#> TCGA.VD.A8K8.01     2  0.0000      0.994 0.00 1.00 0.00 0.00
#> TCGA.V4.A9EL.01     4  0.1211      0.000 0.00 0.00 0.04 0.96
#> TCGA.V4.A9EI.01     1  0.0000      0.991 1.00 0.00 0.00 0.00
#> TCGA.V4.A9F0.01     2  0.0000      0.994 0.00 1.00 0.00 0.00
#> TCGA.V4.A9E7.01     3  0.0707      0.302 0.00 0.00 0.98 0.02
#> TCGA.RZ.AB0B.01     3  0.7674      0.380 0.00 0.26 0.46 0.28
#> TCGA.VD.AA8O.01     2  0.0000      0.994 0.00 1.00 0.00 0.00
#> TCGA.VD.A8KD.01     2  0.0000      0.994 0.00 1.00 0.00 0.00
#> TCGA.WC.A88A.01     1  0.0000      0.991 1.00 0.00 0.00 0.00
#> TCGA.VD.AA8N.01     3  0.5915      0.605 0.00 0.04 0.56 0.40
#> TCGA.VD.A8KM.01     2  0.1637      0.928 0.00 0.94 0.06 0.00
#> TCGA.V4.A9EF.01     2  0.0000      0.994 0.00 1.00 0.00 0.00
#> TCGA.V4.A9EE.01     3  0.6649      0.601 0.00 0.10 0.56 0.34
#> TCGA.WC.A87Y.01     2  0.0000      0.994 0.00 1.00 0.00 0.00
#> TCGA.WC.A883.01     1  0.1211      0.965 0.96 0.00 0.00 0.04
#> TCGA.V4.A9F5.01     2  0.0000      0.994 0.00 1.00 0.00 0.00

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>                 class entropy silhouette   p1   p2   p3   p4   p5
#> TCGA.V4.A9EX.01     1   0.000      0.934 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9F3.01     2   0.000      0.976 0.00 1.00 0.00 0.00 0.00
#> TCGA.V4.A9EU.01     1   0.244      0.880 0.90 0.00 0.00 0.04 0.06
#> TCGA.V4.A9F1.01     2   0.000      0.976 0.00 1.00 0.00 0.00 0.00
#> TCGA.V3.A9ZX.01     3   0.293      0.451 0.00 0.02 0.88 0.08 0.02
#> TCGA.V4.A9EV.01     2   0.000      0.976 0.00 1.00 0.00 0.00 0.00
#> TCGA.VD.A8KI.01     3   0.487      0.175 0.00 0.00 0.72 0.12 0.16
#> TCGA.V4.A9EQ.01     2   0.000      0.976 0.00 1.00 0.00 0.00 0.00
#> TCGA.VD.A8K8.01     2   0.000      0.976 0.00 1.00 0.00 0.00 0.00
#> TCGA.V4.A9EL.01     4   0.327      0.000 0.00 0.00 0.22 0.78 0.00
#> TCGA.V4.A9EI.01     1   0.000      0.934 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9F0.01     2   0.000      0.976 0.00 1.00 0.00 0.00 0.00
#> TCGA.V4.A9E7.01     5   0.413      0.000 0.00 0.00 0.38 0.00 0.62
#> TCGA.RZ.AB0B.01     3   0.553      0.270 0.00 0.36 0.58 0.04 0.02
#> TCGA.VD.AA8O.01     2   0.233      0.888 0.00 0.90 0.00 0.08 0.02
#> TCGA.VD.A8KD.01     2   0.000      0.976 0.00 1.00 0.00 0.00 0.00
#> TCGA.WC.A88A.01     1   0.000      0.934 1.00 0.00 0.00 0.00 0.00
#> TCGA.VD.AA8N.01     3   0.311      0.487 0.00 0.08 0.86 0.00 0.06
#> TCGA.VD.A8KM.01     2   0.287      0.815 0.00 0.86 0.12 0.02 0.00
#> TCGA.V4.A9EF.01     2   0.000      0.976 0.00 1.00 0.00 0.00 0.00
#> TCGA.V4.A9EE.01     3   0.412      0.499 0.00 0.08 0.82 0.06 0.04
#> TCGA.WC.A87Y.01     2   0.000      0.976 0.00 1.00 0.00 0.00 0.00
#> TCGA.WC.A883.01     1   0.293      0.813 0.82 0.00 0.00 0.00 0.18
#> TCGA.V4.A9F5.01     2   0.000      0.976 0.00 1.00 0.00 0.00 0.00

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>                 class entropy silhouette   p1   p2   p3   p4   p5   p6
#> TCGA.V4.A9EX.01     1  0.0000      0.882 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9F3.01     2  0.0000      0.941 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EU.01     1  0.2454      0.798 0.84 0.00 0.16 0.00 0.00 0.00
#> TCGA.V4.A9F1.01     2  0.0000      0.941 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.V3.A9ZX.01     6  0.4887      0.444 0.00 0.02 0.08 0.22 0.00 0.68
#> TCGA.V4.A9EV.01     2  0.0547      0.937 0.00 0.98 0.02 0.00 0.00 0.00
#> TCGA.VD.A8KI.01     6  0.4989      0.338 0.00 0.00 0.22 0.00 0.14 0.64
#> TCGA.V4.A9EQ.01     2  0.0547      0.937 0.00 0.98 0.02 0.00 0.00 0.00
#> TCGA.VD.A8K8.01     2  0.0000      0.941 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EL.01     4  0.0547      0.000 0.00 0.00 0.00 0.98 0.00 0.02
#> TCGA.V4.A9EI.01     1  0.0000      0.882 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9F0.01     2  0.1556      0.899 0.00 0.92 0.08 0.00 0.00 0.00
#> TCGA.V4.A9E7.01     5  0.2048      0.000 0.00 0.00 0.00 0.00 0.88 0.12
#> TCGA.RZ.AB0B.01     6  0.4002      0.372 0.00 0.32 0.00 0.02 0.00 0.66
#> TCGA.VD.AA8O.01     2  0.4002      0.581 0.00 0.66 0.32 0.00 0.00 0.02
#> TCGA.VD.A8KD.01     2  0.0000      0.941 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A88A.01     1  0.0547      0.879 0.98 0.00 0.00 0.00 0.02 0.00
#> TCGA.VD.AA8N.01     6  0.5177      0.453 0.00 0.02 0.06 0.06 0.14 0.72
#> TCGA.VD.A8KM.01     2  0.2260      0.795 0.00 0.86 0.00 0.00 0.00 0.14
#> TCGA.V4.A9EF.01     2  0.0547      0.937 0.00 0.98 0.02 0.00 0.00 0.00
#> TCGA.V4.A9EE.01     6  0.3007      0.547 0.00 0.08 0.04 0.02 0.00 0.86
#> TCGA.WC.A87Y.01     2  0.0000      0.941 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A883.01     1  0.4608      0.648 0.68 0.00 0.22 0.00 0.10 0.00
#> TCGA.V4.A9F5.01     2  0.0000      0.941 0.00 1.00 0.00 0.00 0.00 0.00

show/hide code output

cbind(get_classes(res, k = 7), get_membership(res, k = 7))
#>                 class entropy silhouette   p1   p2   p3   p4   p5   p6   p7
#> TCGA.V4.A9EX.01     1  0.0000      0.869 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9F3.01     2  0.0000      0.942 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EU.01     1  0.2803      0.743 0.84 0.00 0.06 0.00 0.00 0.00 0.10
#> TCGA.V4.A9F1.01     2  0.0000      0.942 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V3.A9ZX.01     6  0.4644      0.487 0.00 0.02 0.12 0.18 0.00 0.68 0.00
#> TCGA.V4.A9EV.01     2  0.0000      0.942 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KI.01     6  0.6216      0.296 0.00 0.00 0.20 0.00 0.12 0.52 0.16
#> TCGA.V4.A9EQ.01     2  0.0504      0.916 0.00 0.98 0.02 0.00 0.00 0.00 0.00
#> TCGA.VD.A8K8.01     2  0.0000      0.942 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EL.01     4  0.0000      0.000 0.00 0.00 0.00 1.00 0.00 0.00 0.00
#> TCGA.V4.A9EI.01     1  0.0504      0.873 0.98 0.00 0.00 0.00 0.00 0.00 0.02
#> TCGA.V4.A9F0.01     2  0.1928      0.792 0.00 0.90 0.08 0.00 0.00 0.02 0.00
#> TCGA.V4.A9E7.01     5  0.0504      0.000 0.00 0.00 0.00 0.00 0.98 0.02 0.00
#> TCGA.RZ.AB0B.01     6  0.4335      0.512 0.00 0.20 0.02 0.04 0.02 0.72 0.00
#> TCGA.VD.AA8O.01     3  0.3459      0.000 0.00 0.40 0.60 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KD.01     2  0.0000      0.942 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A88A.01     1  0.1166      0.836 0.94 0.00 0.00 0.00 0.00 0.00 0.06
#> TCGA.VD.AA8N.01     6  0.4418      0.600 0.00 0.08 0.00 0.08 0.06 0.76 0.02
#> TCGA.VD.A8KM.01     2  0.2572      0.541 0.00 0.80 0.00 0.00 0.00 0.20 0.00
#> TCGA.V4.A9EF.01     2  0.0000      0.942 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EE.01     6  0.3257      0.582 0.00 0.02 0.04 0.00 0.02 0.84 0.08
#> TCGA.WC.A87Y.01     2  0.0000      0.942 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A883.01     7  0.3496      0.000 0.42 0.00 0.00 0.00 0.00 0.00 0.58
#> TCGA.V4.A9F5.01     2  0.0000      0.942 0.00 1.00 0.00 0.00 0.00 0.00 0.00

show/hide code output

cbind(get_classes(res, k = 8), get_membership(res, k = 8))
#>                 class entropy silhouette   p1   p2   p3   p4   p5   p6   p7   p8
#> TCGA.V4.A9EX.01     1  0.0000      0.761 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9F3.01     2  0.0471      0.913 0.00 0.98 0.00 0.00 0.00 0.00 0.00 0.02
#> TCGA.V4.A9EU.01     1  0.5715      0.274 0.50 0.00 0.10 0.02 0.00 0.00 0.32 0.06
#> TCGA.V4.A9F1.01     2  0.0000      0.917 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V3.A9ZX.01     6  0.1408      0.308 0.00 0.00 0.02 0.02 0.00 0.94 0.00 0.02
#> TCGA.V4.A9EV.01     2  0.0471      0.913 0.00 0.98 0.00 0.00 0.00 0.00 0.00 0.02
#> TCGA.VD.A8KI.01     8  0.3434      0.000 0.00 0.00 0.00 0.00 0.14 0.10 0.00 0.76
#> TCGA.V4.A9EQ.01     2  0.0808      0.897 0.00 0.96 0.04 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8K8.01     2  0.0000      0.917 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EL.01     4  0.0471      0.000 0.00 0.00 0.00 0.98 0.00 0.02 0.00 0.00
#> TCGA.V4.A9EI.01     1  0.0000      0.761 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9F0.01     2  0.3714      0.718 0.00 0.80 0.10 0.00 0.04 0.02 0.02 0.02
#> TCGA.V4.A9E7.01     5  0.0000      0.000 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00
#> TCGA.RZ.AB0B.01     6  0.7070      0.109 0.00 0.30 0.04 0.00 0.08 0.34 0.02 0.22
#> TCGA.VD.AA8O.01     3  0.3021      0.000 0.00 0.16 0.80 0.00 0.02 0.02 0.00 0.00
#> TCGA.VD.A8KD.01     2  0.0000      0.917 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A88A.01     1  0.0471      0.757 0.98 0.00 0.00 0.00 0.00 0.00 0.02 0.00
#> TCGA.VD.AA8N.01     6  0.5589      0.168 0.00 0.00 0.04 0.02 0.18 0.56 0.00 0.20
#> TCGA.VD.A8KM.01     2  0.4806      0.421 0.00 0.64 0.02 0.00 0.02 0.26 0.02 0.04
#> TCGA.V4.A9EF.01     2  0.0471      0.908 0.00 0.98 0.02 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EE.01     6  0.5403      0.287 0.00 0.02 0.06 0.00 0.06 0.62 0.02 0.22
#> TCGA.WC.A87Y.01     2  0.0471      0.913 0.00 0.98 0.00 0.00 0.00 0.00 0.00 0.02
#> TCGA.WC.A883.01     7  0.2938      0.000 0.30 0.00 0.00 0.00 0.00 0.00 0.70 0.00
#> TCGA.V4.A9F5.01     2  0.0000      0.917 0.00 1.00 0.00 0.00 0.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)

plot of chunk tab-node-01-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-node-01-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-node-01-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-node-01-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-node-01-consensus-heatmap-5

consensus_heatmap(res, k = 7)

plot of chunk tab-node-01-consensus-heatmap-6

consensus_heatmap(res, k = 8)

plot of chunk tab-node-01-consensus-heatmap-7

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-node-01-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-node-01-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-node-01-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-node-01-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-node-01-membership-heatmap-5

membership_heatmap(res, k = 7)

plot of chunk tab-node-01-membership-heatmap-6

membership_heatmap(res, k = 8)

plot of chunk tab-node-01-membership-heatmap-7

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.

get_signatures(res, k = 2)

plot of chunk tab-node-01-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-node-01-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-node-01-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-node-01-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-node-01-get-signatures-5

get_signatures(res, k = 7)

plot of chunk tab-node-01-get-signatures-6

get_signatures(res, k = 8)

plot of chunk tab-node-01-get-signatures-7

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk node-01-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-node-01-dimension-reduction-1

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

plot of chunk tab-node-01-dimension-reduction-2

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

plot of chunk tab-node-01-dimension-reduction-3

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

plot of chunk tab-node-01-dimension-reduction-4

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

plot of chunk tab-node-01-dimension-reduction-5

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

plot of chunk tab-node-01-dimension-reduction-6

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

plot of chunk tab-node-01-dimension-reduction-7

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk node-01-collect-classes

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.


Node02

Parent node: Node0. Child nodes: Node011-leaf , Node012-leaf , Node013-leaf , Node021 , Node022-leaf , Node023-leaf , Node031-leaf , Node032-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, 5, 6, 7, 8.
#>   On a matrix with 30000 rows and 35 columns.
#>   Top rows (1000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'skmeans' method.
#>   Performed in total 350 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)

plot of chunk node-02-collect-plots

The plots are:

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:

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)

plot of chunk node-02-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.4946 0.506   0.506
#> 3 3 0.898           0.953       0.966         0.3658 0.815   0.635
#> 4 4 0.814           0.878       0.927         0.1065 0.919   0.749
#> 5 5 0.786           0.803       0.895         0.0441 0.973   0.888
#> 6 6 0.775           0.703       0.864         0.0307 0.914   0.646
#> 7 7 0.752           0.634       0.851         0.0168 0.988   0.937
#> 8 8 0.794           0.652       0.835         0.0207 0.992   0.954

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>                 class entropy silhouette p1 p2
#> TCGA.V4.A9EZ.01     2       0          1  0  1
#> TCGA.WC.A885.01     1       0          1  1  0
#> TCGA.V4.A9ET.01     1       0          1  1  0
#> TCGA.V4.A9F7.01     2       0          1  0  1
#> TCGA.V4.A9F4.01     1       0          1  1  0
#> TCGA.VD.A8KJ.01     2       0          1  0  1
#> TCGA.V4.A9EW.01     2       0          1  0  1
#> TCGA.WC.A880.01     2       0          1  0  1
#> TCGA.WC.A881.01     1       0          1  1  0
#> TCGA.V3.A9ZY.01     2       0          1  0  1
#> TCGA.WC.AA9E.01     1       0          1  1  0
#> TCGA.V4.A9E9.01     1       0          1  1  0
#> TCGA.VD.A8KB.01     1       0          1  1  0
#> TCGA.VD.A8KG.01     1       0          1  1  0
#> TCGA.VD.AA8M.01     2       0          1  0  1
#> TCGA.VD.AA8S.01     2       0          1  0  1
#> TCGA.V4.A9EC.01     2       0          1  0  1
#> TCGA.VD.AA8Q.01     2       0          1  0  1
#> TCGA.VD.A8K9.01     1       0          1  1  0
#> TCGA.VD.AA8R.01     2       0          1  0  1
#> TCGA.VD.A8KH.01     2       0          1  0  1
#> TCGA.V4.A9EJ.01     1       0          1  1  0
#> TCGA.VD.A8K7.01     2       0          1  0  1
#> TCGA.VD.A8KA.01     1       0          1  1  0
#> TCGA.V4.A9EK.01     1       0          1  1  0
#> TCGA.YZ.A982.01     1       0          1  1  0
#> TCGA.V4.A9EH.01     2       0          1  0  1
#> TCGA.WC.A87U.01     2       0          1  0  1
#> TCGA.YZ.A983.01     2       0          1  0  1
#> TCGA.V4.A9EY.01     2       0          1  0  1
#> TCGA.WC.A87T.01     2       0          1  0  1
#> TCGA.VD.A8KE.01     2       0          1  0  1
#> TCGA.VD.A8KO.01     2       0          1  0  1
#> TCGA.V4.A9EA.01     1       0          1  1  0
#> TCGA.WC.A884.01     2       0          1  0  1

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>                 class entropy silhouette   p1   p2   p3
#> TCGA.V4.A9EZ.01     3  0.0000      1.000 0.00 0.00 1.00
#> TCGA.WC.A885.01     1  0.0000      0.984 1.00 0.00 0.00
#> TCGA.V4.A9ET.01     1  0.0892      0.985 0.98 0.02 0.00
#> TCGA.V4.A9F7.01     2  0.0892      0.923 0.00 0.98 0.02
#> TCGA.V4.A9F4.01     1  0.0892      0.985 0.98 0.02 0.00
#> TCGA.VD.A8KJ.01     2  0.0892      0.923 0.00 0.98 0.02
#> TCGA.V4.A9EW.01     3  0.0000      1.000 0.00 0.00 1.00
#> TCGA.WC.A880.01     2  0.0892      0.923 0.00 0.98 0.02
#> TCGA.WC.A881.01     1  0.0892      0.985 0.98 0.02 0.00
#> TCGA.V3.A9ZY.01     3  0.0000      1.000 0.00 0.00 1.00
#> TCGA.WC.AA9E.01     1  0.0892      0.985 0.98 0.02 0.00
#> TCGA.V4.A9E9.01     1  0.0000      0.984 1.00 0.00 0.00
#> TCGA.VD.A8KB.01     1  0.0000      0.984 1.00 0.00 0.00
#> TCGA.VD.A8KG.01     1  0.0892      0.985 0.98 0.02 0.00
#> TCGA.VD.AA8M.01     2  0.0892      0.923 0.00 0.98 0.02
#> TCGA.VD.AA8S.01     2  0.0892      0.923 0.00 0.98 0.02
#> TCGA.V4.A9EC.01     2  0.4796      0.798 0.00 0.78 0.22
#> TCGA.VD.AA8Q.01     2  0.5560      0.684 0.00 0.70 0.30
#> TCGA.VD.A8K9.01     1  0.0000      0.984 1.00 0.00 0.00
#> TCGA.VD.AA8R.01     3  0.0000      1.000 0.00 0.00 1.00
#> TCGA.VD.A8KH.01     3  0.0000      1.000 0.00 0.00 1.00
#> TCGA.V4.A9EJ.01     1  0.0000      0.984 1.00 0.00 0.00
#> TCGA.VD.A8K7.01     3  0.0000      1.000 0.00 0.00 1.00
#> TCGA.VD.A8KA.01     1  0.0000      0.984 1.00 0.00 0.00
#> TCGA.V4.A9EK.01     1  0.0892      0.985 0.98 0.02 0.00
#> TCGA.YZ.A982.01     1  0.0892      0.985 0.98 0.02 0.00
#> TCGA.V4.A9EH.01     3  0.0000      1.000 0.00 0.00 1.00
#> TCGA.WC.A87U.01     3  0.0000      1.000 0.00 0.00 1.00
#> TCGA.YZ.A983.01     2  0.0892      0.923 0.00 0.98 0.02
#> TCGA.V4.A9EY.01     2  0.4002      0.855 0.00 0.84 0.16
#> TCGA.WC.A87T.01     3  0.0000      1.000 0.00 0.00 1.00
#> TCGA.VD.A8KE.01     2  0.3686      0.868 0.00 0.86 0.14
#> TCGA.VD.A8KO.01     3  0.0000      1.000 0.00 0.00 1.00
#> TCGA.V4.A9EA.01     1  0.2959      0.894 0.90 0.10 0.00
#> TCGA.WC.A884.01     2  0.0892      0.923 0.00 0.98 0.02

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>                 class entropy silhouette   p1   p2   p3   p4
#> TCGA.V4.A9EZ.01     3   0.304      0.907 0.00 0.02 0.88 0.10
#> TCGA.WC.A885.01     1   0.000      0.912 1.00 0.00 0.00 0.00
#> TCGA.V4.A9ET.01     4   0.441      0.758 0.30 0.00 0.00 0.70
#> TCGA.V4.A9F7.01     2   0.000      0.934 0.00 1.00 0.00 0.00
#> TCGA.V4.A9F4.01     1   0.380      0.661 0.78 0.00 0.00 0.22
#> TCGA.VD.A8KJ.01     2   0.000      0.934 0.00 1.00 0.00 0.00
#> TCGA.V4.A9EW.01     3   0.234      0.922 0.00 0.00 0.90 0.10
#> TCGA.WC.A880.01     2   0.000      0.934 0.00 1.00 0.00 0.00
#> TCGA.WC.A881.01     4   0.491      0.540 0.42 0.00 0.00 0.58
#> TCGA.V3.A9ZY.01     3   0.000      0.980 0.00 0.00 1.00 0.00
#> TCGA.WC.AA9E.01     4   0.441      0.758 0.30 0.00 0.00 0.70
#> TCGA.V4.A9E9.01     1   0.000      0.912 1.00 0.00 0.00 0.00
#> TCGA.VD.A8KB.01     1   0.234      0.853 0.90 0.00 0.00 0.10
#> TCGA.VD.A8KG.01     4   0.234      0.809 0.10 0.00 0.00 0.90
#> TCGA.VD.AA8M.01     2   0.000      0.934 0.00 1.00 0.00 0.00
#> TCGA.VD.AA8S.01     2   0.000      0.934 0.00 1.00 0.00 0.00
#> TCGA.V4.A9EC.01     2   0.380      0.733 0.00 0.78 0.22 0.00
#> TCGA.VD.AA8Q.01     2   0.452      0.569 0.00 0.68 0.32 0.00
#> TCGA.VD.A8K9.01     1   0.000      0.912 1.00 0.00 0.00 0.00
#> TCGA.VD.AA8R.01     3   0.000      0.980 0.00 0.00 1.00 0.00
#> TCGA.VD.A8KH.01     3   0.000      0.980 0.00 0.00 1.00 0.00
#> TCGA.V4.A9EJ.01     1   0.000      0.912 1.00 0.00 0.00 0.00
#> TCGA.VD.A8K7.01     3   0.000      0.980 0.00 0.00 1.00 0.00
#> TCGA.VD.A8KA.01     1   0.265      0.833 0.88 0.00 0.00 0.12
#> TCGA.V4.A9EK.01     4   0.234      0.809 0.10 0.00 0.00 0.90
#> TCGA.YZ.A982.01     4   0.234      0.809 0.10 0.00 0.00 0.90
#> TCGA.V4.A9EH.01     3   0.000      0.980 0.00 0.00 1.00 0.00
#> TCGA.WC.A87U.01     3   0.000      0.980 0.00 0.00 1.00 0.00
#> TCGA.YZ.A983.01     2   0.000      0.934 0.00 1.00 0.00 0.00
#> TCGA.V4.A9EY.01     2   0.121      0.908 0.00 0.96 0.04 0.00
#> TCGA.WC.A87T.01     3   0.000      0.980 0.00 0.00 1.00 0.00
#> TCGA.VD.A8KE.01     2   0.000      0.934 0.00 1.00 0.00 0.00
#> TCGA.VD.A8KO.01     3   0.000      0.980 0.00 0.00 1.00 0.00
#> TCGA.V4.A9EA.01     1   0.000      0.912 1.00 0.00 0.00 0.00
#> TCGA.WC.A884.01     2   0.000      0.934 0.00 1.00 0.00 0.00

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>                 class entropy silhouette   p1   p2   p3   p4   p5
#> TCGA.V4.A9EZ.01     5   0.311      0.744 0.00 0.02 0.14 0.00 0.84
#> TCGA.WC.A885.01     1   0.000      0.856 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9ET.01     4   0.273      0.682 0.16 0.00 0.00 0.84 0.00
#> TCGA.V4.A9F7.01     2   0.000      0.868 0.00 1.00 0.00 0.00 0.00
#> TCGA.V4.A9F4.01     1   0.413      0.459 0.62 0.00 0.00 0.38 0.00
#> TCGA.VD.A8KJ.01     2   0.000      0.868 0.00 1.00 0.00 0.00 0.00
#> TCGA.V4.A9EW.01     5   0.398      0.698 0.00 0.00 0.34 0.00 0.66
#> TCGA.WC.A880.01     2   0.000      0.868 0.00 1.00 0.00 0.00 0.00
#> TCGA.WC.A881.01     4   0.380      0.499 0.30 0.00 0.00 0.70 0.00
#> TCGA.V3.A9ZY.01     3   0.000      1.000 0.00 0.00 1.00 0.00 0.00
#> TCGA.WC.AA9E.01     4   0.342      0.608 0.24 0.00 0.00 0.76 0.00
#> TCGA.V4.A9E9.01     1   0.000      0.856 1.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KB.01     1   0.425      0.625 0.70 0.00 0.00 0.28 0.02
#> TCGA.VD.A8KG.01     4   0.373      0.709 0.04 0.00 0.00 0.80 0.16
#> TCGA.VD.AA8M.01     2   0.000      0.868 0.00 1.00 0.00 0.00 0.00
#> TCGA.VD.AA8S.01     2   0.000      0.868 0.00 1.00 0.00 0.00 0.00
#> TCGA.V4.A9EC.01     2   0.464      0.663 0.00 0.74 0.10 0.00 0.16
#> TCGA.VD.AA8Q.01     2   0.418      0.432 0.00 0.60 0.40 0.00 0.00
#> TCGA.VD.A8K9.01     1   0.141      0.834 0.94 0.00 0.00 0.06 0.00
#> TCGA.VD.AA8R.01     3   0.000      1.000 0.00 0.00 1.00 0.00 0.00
#> TCGA.VD.A8KH.01     3   0.000      1.000 0.00 0.00 1.00 0.00 0.00
#> TCGA.V4.A9EJ.01     1   0.000      0.856 1.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8K7.01     3   0.000      1.000 0.00 0.00 1.00 0.00 0.00
#> TCGA.VD.A8KA.01     1   0.262      0.810 0.88 0.00 0.00 0.10 0.02
#> TCGA.V4.A9EK.01     4   0.273      0.704 0.00 0.00 0.00 0.84 0.16
#> TCGA.YZ.A982.01     4   0.273      0.704 0.00 0.00 0.00 0.84 0.16
#> TCGA.V4.A9EH.01     3   0.000      1.000 0.00 0.00 1.00 0.00 0.00
#> TCGA.WC.A87U.01     3   0.000      1.000 0.00 0.00 1.00 0.00 0.00
#> TCGA.YZ.A983.01     2   0.000      0.868 0.00 1.00 0.00 0.00 0.00
#> TCGA.V4.A9EY.01     2   0.356      0.668 0.00 0.74 0.26 0.00 0.00
#> TCGA.WC.A87T.01     3   0.000      1.000 0.00 0.00 1.00 0.00 0.00
#> TCGA.VD.A8KE.01     2   0.293      0.752 0.00 0.82 0.18 0.00 0.00
#> TCGA.VD.A8KO.01     3   0.000      1.000 0.00 0.00 1.00 0.00 0.00
#> TCGA.V4.A9EA.01     1   0.000      0.856 1.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A884.01     2   0.000      0.868 0.00 1.00 0.00 0.00 0.00

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>                 class entropy silhouette   p1   p2   p3   p4   p5   p6
#> TCGA.V4.A9EZ.01     5  0.0547     0.5957 0.00 0.00 0.02 0.00 0.98 0.00
#> TCGA.WC.A885.01     1  0.1556     0.8273 0.92 0.00 0.00 0.08 0.00 0.00
#> TCGA.V4.A9ET.01     4  0.4067     0.4941 0.04 0.00 0.00 0.70 0.00 0.26
#> TCGA.V4.A9F7.01     2  0.0000     0.8296 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9F4.01     4  0.3982     0.6479 0.20 0.00 0.00 0.74 0.00 0.06
#> TCGA.VD.A8KJ.01     2  0.0547     0.8177 0.00 0.98 0.00 0.00 0.02 0.00
#> TCGA.V4.A9EW.01     5  0.3711     0.6237 0.02 0.00 0.26 0.00 0.72 0.00
#> TCGA.WC.A880.01     2  0.0000     0.8296 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A881.01     4  0.1556     0.6515 0.00 0.00 0.00 0.92 0.00 0.08
#> TCGA.V3.A9ZY.01     3  0.0000     0.9097 0.00 0.00 1.00 0.00 0.00 0.00
#> TCGA.WC.AA9E.01     4  0.3351     0.6125 0.04 0.00 0.00 0.80 0.00 0.16
#> TCGA.V4.A9E9.01     1  0.2793     0.7980 0.80 0.00 0.00 0.20 0.00 0.00
#> TCGA.VD.A8KB.01     4  0.3156     0.5855 0.18 0.00 0.00 0.80 0.00 0.02
#> TCGA.VD.A8KG.01     6  0.4810     0.5513 0.22 0.00 0.00 0.12 0.00 0.66
#> TCGA.VD.AA8M.01     2  0.0000     0.8296 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.VD.AA8S.01     2  0.0000     0.8296 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EC.01     2  0.5364     0.3428 0.00 0.56 0.14 0.00 0.30 0.00
#> TCGA.VD.AA8Q.01     3  0.3828    -0.0112 0.00 0.44 0.56 0.00 0.00 0.00
#> TCGA.VD.A8K9.01     1  0.3821     0.6832 0.74 0.00 0.00 0.22 0.00 0.04
#> TCGA.VD.AA8R.01     3  0.0000     0.9097 0.00 0.00 1.00 0.00 0.00 0.00
#> TCGA.VD.A8KH.01     3  0.0547     0.8872 0.00 0.00 0.98 0.00 0.02 0.00
#> TCGA.V4.A9EJ.01     1  0.1814     0.8297 0.90 0.00 0.00 0.10 0.00 0.00
#> TCGA.VD.A8K7.01     3  0.0000     0.9097 0.00 0.00 1.00 0.00 0.00 0.00
#> TCGA.VD.A8KA.01     4  0.4575     0.1832 0.34 0.00 0.00 0.62 0.02 0.02
#> TCGA.V4.A9EK.01     6  0.2094     0.7774 0.02 0.00 0.00 0.08 0.00 0.90
#> TCGA.YZ.A982.01     6  0.1556     0.7822 0.00 0.00 0.00 0.08 0.00 0.92
#> TCGA.V4.A9EH.01     3  0.0000     0.9097 0.00 0.00 1.00 0.00 0.00 0.00
#> TCGA.WC.A87U.01     3  0.0000     0.9097 0.00 0.00 1.00 0.00 0.00 0.00
#> TCGA.YZ.A983.01     2  0.0000     0.8296 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EY.01     2  0.3756     0.3737 0.00 0.60 0.40 0.00 0.00 0.00
#> TCGA.WC.A87T.01     3  0.0000     0.9097 0.00 0.00 1.00 0.00 0.00 0.00
#> TCGA.VD.A8KE.01     2  0.3706     0.4183 0.00 0.62 0.38 0.00 0.00 0.00
#> TCGA.VD.A8KO.01     3  0.0000     0.9097 0.00 0.00 1.00 0.00 0.00 0.00
#> TCGA.V4.A9EA.01     1  0.2631     0.7973 0.82 0.00 0.00 0.18 0.00 0.00
#> TCGA.WC.A884.01     2  0.0000     0.8296 0.00 1.00 0.00 0.00 0.00 0.00

show/hide code output

cbind(get_classes(res, k = 7), get_membership(res, k = 7))
#>                 class entropy silhouette   p1   p2   p3   p4   p5   p6   p7
#> TCGA.V4.A9EZ.01     5  0.0000     0.4345 0.00 0.00 0.00 0.00 1.00 0.00 0.00
#> TCGA.WC.A885.01     1  0.2016     0.5998 0.90 0.00 0.00 0.06 0.00 0.00 0.04
#> TCGA.V4.A9ET.01     4  0.5046     0.6166 0.10 0.00 0.00 0.66 0.00 0.18 0.06
#> TCGA.V4.A9F7.01     2  0.0504     0.8224 0.00 0.98 0.00 0.00 0.00 0.00 0.02
#> TCGA.V4.A9F4.01     4  0.1928     0.8011 0.08 0.00 0.00 0.90 0.00 0.02 0.00
#> TCGA.VD.A8KJ.01     2  0.2422     0.6980 0.00 0.82 0.00 0.00 0.00 0.00 0.18
#> TCGA.V4.A9EW.01     5  0.3685     0.4964 0.02 0.00 0.32 0.00 0.66 0.00 0.00
#> TCGA.WC.A880.01     2  0.0000     0.8243 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A881.01     4  0.0504     0.7894 0.00 0.00 0.00 0.98 0.00 0.00 0.02
#> TCGA.V3.A9ZY.01     3  0.0000     0.9126 0.00 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.WC.AA9E.01     4  0.2769     0.7779 0.08 0.00 0.00 0.86 0.00 0.04 0.02
#> TCGA.V4.A9E9.01     1  0.5002    -0.0427 0.48 0.00 0.00 0.12 0.00 0.00 0.40
#> TCGA.VD.A8KB.01     4  0.1664     0.7769 0.06 0.00 0.00 0.92 0.00 0.00 0.02
#> TCGA.VD.A8KG.01     7  0.6118    -0.2883 0.26 0.00 0.00 0.04 0.00 0.26 0.44
#> TCGA.VD.AA8M.01     2  0.0504     0.8184 0.00 0.98 0.00 0.00 0.00 0.00 0.02
#> TCGA.VD.AA8S.01     2  0.0000     0.8243 0.00 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EC.01     2  0.5708     0.5002 0.02 0.60 0.14 0.00 0.20 0.00 0.04
#> TCGA.VD.AA8Q.01     3  0.3943     0.0132 0.00 0.42 0.56 0.00 0.00 0.00 0.02
#> TCGA.VD.A8K9.01     1  0.3086     0.4900 0.80 0.00 0.00 0.16 0.00 0.00 0.04
#> TCGA.VD.AA8R.01     3  0.0000     0.9126 0.00 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KH.01     3  0.0000     0.9126 0.00 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EJ.01     1  0.0504     0.5834 0.98 0.00 0.00 0.02 0.00 0.00 0.00
#> TCGA.VD.A8K7.01     3  0.0000     0.9126 0.00 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KA.01     4  0.5166     0.5357 0.20 0.00 0.00 0.66 0.04 0.02 0.08
#> TCGA.V4.A9EK.01     6  0.2512     0.8401 0.10 0.00 0.00 0.04 0.00 0.86 0.00
#> TCGA.YZ.A982.01     6  0.0504     0.8463 0.00 0.00 0.00 0.02 0.00 0.98 0.00
#> TCGA.V4.A9EH.01     3  0.0000     0.9126 0.00 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A87U.01     3  0.0000     0.9126 0.00 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.YZ.A983.01     2  0.0504     0.8224 0.00 0.98 0.00 0.00 0.00 0.00 0.02
#> TCGA.V4.A9EY.01     2  0.3909     0.3575 0.00 0.58 0.40 0.00 0.00 0.00 0.02
#> TCGA.WC.A87T.01     3  0.0000     0.9126 0.00 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KE.01     2  0.3517     0.5919 0.00 0.70 0.28 0.00 0.00 0.00 0.02
#> TCGA.VD.A8KO.01     3  0.0000     0.9126 0.00 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EA.01     7  0.4505    -0.4806 0.44 0.00 0.00 0.06 0.00 0.00 0.50
#> TCGA.WC.A884.01     2  0.0000     0.8243 0.00 1.00 0.00 0.00 0.00 0.00 0.00

show/hide code output

cbind(get_classes(res, k = 8), get_membership(res, k = 8))
#>                 class entropy silhouette   p1   p2   p3   p4   p5   p6   p7   p8
#> TCGA.V4.A9EZ.01     5  0.0000      0.339 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00
#> TCGA.WC.A885.01     1  0.0941      0.690 0.96 0.00 0.02 0.02 0.00 0.00 0.00 0.00
#> TCGA.V4.A9ET.01     4  0.4355      0.549 0.02 0.00 0.04 0.72 0.00 0.16 0.06 0.00
#> TCGA.V4.A9F7.01     2  0.0471      0.783 0.00 0.98 0.02 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9F4.01     4  0.0471      0.723 0.02 0.00 0.00 0.98 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KJ.01     2  0.2719      0.667 0.00 0.80 0.18 0.00 0.00 0.00 0.02 0.00
#> TCGA.V4.A9EW.01     5  0.5600      0.394 0.00 0.00 0.22 0.00 0.48 0.00 0.04 0.26
#> TCGA.WC.A880.01     2  0.0000      0.782 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A881.01     4  0.2994      0.696 0.00 0.00 0.14 0.80 0.00 0.00 0.06 0.00
#> TCGA.V3.A9ZY.01     8  0.0000      0.877 0.00 0.00 0.00 0.00 0.00 0.00 0.00 1.00
#> TCGA.WC.AA9E.01     4  0.2071      0.706 0.00 0.00 0.04 0.90 0.00 0.04 0.02 0.00
#> TCGA.V4.A9E9.01     1  0.3514      0.617 0.64 0.00 0.34 0.02 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KB.01     4  0.3744      0.652 0.02 0.00 0.18 0.74 0.00 0.00 0.06 0.00
#> TCGA.VD.A8KG.01     7  0.4061      0.000 0.12 0.00 0.00 0.02 0.00 0.14 0.72 0.00
#> TCGA.VD.AA8M.01     2  0.0471      0.778 0.00 0.98 0.02 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.AA8S.01     2  0.0471      0.781 0.00 0.98 0.02 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EC.01     2  0.6468      0.311 0.00 0.46 0.12 0.00 0.26 0.00 0.04 0.12
#> TCGA.VD.AA8Q.01     8  0.4953      0.206 0.00 0.32 0.12 0.00 0.00 0.00 0.02 0.54
#> TCGA.VD.A8K9.01     1  0.3454      0.540 0.80 0.00 0.02 0.12 0.00 0.02 0.04 0.00
#> TCGA.VD.AA8R.01     8  0.0000      0.877 0.00 0.00 0.00 0.00 0.00 0.00 0.00 1.00
#> TCGA.VD.A8KH.01     8  0.0808      0.843 0.00 0.00 0.04 0.00 0.00 0.00 0.00 0.96
#> TCGA.V4.A9EJ.01     1  0.0941      0.678 0.96 0.00 0.00 0.02 0.00 0.00 0.02 0.00
#> TCGA.VD.A8K7.01     8  0.0000      0.877 0.00 0.00 0.00 0.00 0.00 0.00 0.00 1.00
#> TCGA.VD.A8KA.01     4  0.5933      0.342 0.24 0.00 0.10 0.48 0.00 0.00 0.18 0.00
#> TCGA.V4.A9EK.01     6  0.2071      0.873 0.02 0.00 0.00 0.04 0.00 0.90 0.04 0.00
#> TCGA.YZ.A982.01     6  0.0000      0.876 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00
#> TCGA.V4.A9EH.01     8  0.0000      0.877 0.00 0.00 0.00 0.00 0.00 0.00 0.00 1.00
#> TCGA.WC.A87U.01     8  0.1804      0.840 0.00 0.00 0.08 0.00 0.00 0.00 0.02 0.90
#> TCGA.YZ.A983.01     2  0.0471      0.783 0.00 0.98 0.02 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EY.01     2  0.4848      0.347 0.00 0.54 0.10 0.00 0.00 0.00 0.02 0.34
#> TCGA.WC.A87T.01     8  0.1341      0.855 0.00 0.00 0.08 0.00 0.00 0.00 0.00 0.92
#> TCGA.VD.A8KE.01     2  0.4740      0.431 0.00 0.58 0.10 0.00 0.00 0.00 0.02 0.30
#> TCGA.VD.A8KO.01     8  0.1091      0.864 0.00 0.00 0.06 0.00 0.00 0.00 0.00 0.94
#> TCGA.V4.A9EA.01     1  0.3658      0.578 0.58 0.00 0.40 0.02 0.00 0.00 0.00 0.00
#> TCGA.WC.A884.01     2  0.0471      0.781 0.00 0.98 0.02 0.00 0.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)

plot of chunk tab-node-02-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-node-02-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-node-02-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-node-02-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-node-02-consensus-heatmap-5

consensus_heatmap(res, k = 7)

plot of chunk tab-node-02-consensus-heatmap-6

consensus_heatmap(res, k = 8)

plot of chunk tab-node-02-consensus-heatmap-7

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-node-02-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-node-02-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-node-02-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-node-02-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-node-02-membership-heatmap-5

membership_heatmap(res, k = 7)

plot of chunk tab-node-02-membership-heatmap-6

membership_heatmap(res, k = 8)

plot of chunk tab-node-02-membership-heatmap-7

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.

get_signatures(res, k = 2)

plot of chunk tab-node-02-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-node-02-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-node-02-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-node-02-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-node-02-get-signatures-5

get_signatures(res, k = 7)

plot of chunk tab-node-02-get-signatures-6

get_signatures(res, k = 8)

plot of chunk tab-node-02-get-signatures-7

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk node-02-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-node-02-dimension-reduction-1

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

plot of chunk tab-node-02-dimension-reduction-2

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

plot of chunk tab-node-02-dimension-reduction-3

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

plot of chunk tab-node-02-dimension-reduction-4

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

plot of chunk tab-node-02-dimension-reduction-5

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

plot of chunk tab-node-02-dimension-reduction-6

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

plot of chunk tab-node-02-dimension-reduction-7

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk node-02-collect-classes

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.


Node021

Parent node: Node02. Child nodes: Node0211-leaf , Node0212-leaf , Node0213-leaf .

The object with results only for a single top-value method and a single partitioning method can be extracted as:

res = res_rh["021"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6, 7, 8.
#>   On a matrix with 30000 rows and 14 columns.
#>   Top rows (1000) are extracted by 'SD' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 350 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)

plot of chunk node-021-collect-plots

The plots are:

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:

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)

plot of chunk node-021-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 0.242           0.699       0.866         0.5236 0.462   0.462
#> 3 3 1.000           0.991       0.996         0.2413 0.890   0.762
#> 4 4 0.670           0.788       0.861         0.1722 0.890   0.688
#> 5 5 0.692           0.492       0.797         0.0851 0.824   0.429
#> 6 6 0.747           0.347       0.696         0.0616 0.802   0.250
#> 7 7 0.747           0.384       0.761         0.0228 0.879   0.312
#> 8 8 0.802           0.531       0.741         0.0281 0.945   0.500

suggest_best_k() suggests the best \(k\) based on these statistics. The rules are as follows:

suggest_best_k(res)
#> [1] 3

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>                 class entropy silhouette   p1   p2
#> TCGA.WC.A885.01     1   0.000      0.855 1.00 0.00
#> TCGA.V4.A9ET.01     2   0.000      0.724 0.00 1.00
#> TCGA.V4.A9F4.01     2   0.529      0.754 0.12 0.88
#> TCGA.WC.A881.01     2   0.529      0.754 0.12 0.88
#> TCGA.WC.AA9E.01     2   0.529      0.754 0.12 0.88
#> TCGA.V4.A9E9.01     1   0.795      0.645 0.76 0.24
#> TCGA.VD.A8KB.01     2   0.990      0.153 0.44 0.56
#> TCGA.VD.A8KG.01     1   0.529      0.729 0.88 0.12
#> TCGA.VD.A8K9.01     1   0.000      0.855 1.00 0.00
#> TCGA.V4.A9EJ.01     1   0.000      0.855 1.00 0.00
#> TCGA.VD.A8KA.01     1   0.000      0.855 1.00 0.00
#> TCGA.V4.A9EK.01     2   0.795      0.604 0.24 0.76
#> TCGA.YZ.A982.01     2   0.795      0.604 0.24 0.76
#> TCGA.V4.A9EA.01     1   0.795      0.645 0.76 0.24

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>                 class entropy silhouette   p1   p2   p3
#> TCGA.WC.A885.01     1  0.0000      0.993 1.00 0.00 0.00
#> TCGA.V4.A9ET.01     2  0.0892      0.977 0.00 0.98 0.02
#> TCGA.V4.A9F4.01     2  0.0000      0.994 0.00 1.00 0.00
#> TCGA.WC.A881.01     2  0.0000      0.994 0.00 1.00 0.00
#> TCGA.WC.AA9E.01     2  0.0000      0.994 0.00 1.00 0.00
#> TCGA.V4.A9E9.01     1  0.0000      0.993 1.00 0.00 0.00
#> TCGA.VD.A8KB.01     2  0.0000      0.994 0.00 1.00 0.00
#> TCGA.VD.A8KG.01     1  0.0892      0.980 0.98 0.00 0.02
#> TCGA.VD.A8K9.01     1  0.0000      0.993 1.00 0.00 0.00
#> TCGA.V4.A9EJ.01     1  0.0000      0.993 1.00 0.00 0.00
#> TCGA.VD.A8KA.01     1  0.0892      0.979 0.98 0.02 0.00
#> TCGA.V4.A9EK.01     3  0.0000      1.000 0.00 0.00 1.00
#> TCGA.YZ.A982.01     3  0.0000      1.000 0.00 0.00 1.00
#> TCGA.V4.A9EA.01     1  0.0000      0.993 1.00 0.00 0.00

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>                 class entropy silhouette   p1   p2 p3   p4
#> TCGA.WC.A885.01     1  0.4977      0.301 0.54 0.00  0 0.46
#> TCGA.V4.A9ET.01     2  0.3606      0.829 0.14 0.84  0 0.02
#> TCGA.V4.A9F4.01     2  0.1211      0.854 0.00 0.96  0 0.04
#> TCGA.WC.A881.01     2  0.3335      0.836 0.02 0.86  0 0.12
#> TCGA.WC.AA9E.01     2  0.2647      0.833 0.00 0.88  0 0.12
#> TCGA.V4.A9E9.01     4  0.2647      1.000 0.12 0.00  0 0.88
#> TCGA.VD.A8KB.01     2  0.4332      0.820 0.16 0.80  0 0.04
#> TCGA.VD.A8KG.01     1  0.0000      0.635 1.00 0.00  0 0.00
#> TCGA.VD.A8K9.01     1  0.4277      0.654 0.72 0.00  0 0.28
#> TCGA.V4.A9EJ.01     1  0.4277      0.654 0.72 0.00  0 0.28
#> TCGA.VD.A8KA.01     1  0.0707      0.621 0.98 0.02  0 0.00
#> TCGA.V4.A9EK.01     3  0.0000      1.000 0.00 0.00  1 0.00
#> TCGA.YZ.A982.01     3  0.0000      1.000 0.00 0.00  1 0.00
#> TCGA.V4.A9EA.01     4  0.2647      1.000 0.12 0.00  0 0.88

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>                 class entropy silhouette   p1   p2   p3   p4   p5
#> TCGA.WC.A885.01     4  0.5834      0.600 0.16 0.02 0.00 0.66 0.16
#> TCGA.V4.A9ET.01     2  0.4527      0.417 0.12 0.78 0.02 0.00 0.08
#> TCGA.V4.A9F4.01     2  0.4613      0.150 0.00 0.62 0.00 0.02 0.36
#> TCGA.WC.A881.01     2  0.4798     -0.327 0.02 0.54 0.00 0.00 0.44
#> TCGA.WC.AA9E.01     5  0.2929      0.000 0.00 0.18 0.00 0.00 0.82
#> TCGA.V4.A9E9.01     4  0.0000      0.600 0.00 0.00 0.00 1.00 0.00
#> TCGA.VD.A8KB.01     2  0.0609      0.440 0.00 0.98 0.00 0.02 0.00
#> TCGA.VD.A8KG.01     1  0.0609      0.681 0.98 0.00 0.00 0.02 0.00
#> TCGA.VD.A8K9.01     4  0.6184      0.520 0.38 0.00 0.00 0.48 0.14
#> TCGA.V4.A9EJ.01     4  0.6184      0.520 0.38 0.00 0.00 0.48 0.14
#> TCGA.VD.A8KA.01     1  0.4825      0.694 0.72 0.22 0.00 0.04 0.02
#> TCGA.V4.A9EK.01     3  0.0000      1.000 0.00 0.00 1.00 0.00 0.00
#> TCGA.YZ.A982.01     3  0.0000      1.000 0.00 0.00 1.00 0.00 0.00
#> TCGA.V4.A9EA.01     4  0.0609      0.589 0.00 0.02 0.00 0.98 0.00

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>                 class entropy silhouette   p1   p2   p3   p4   p5   p6
#> TCGA.WC.A885.01     6  0.6175     0.0000 0.08 0.04 0.00 0.32 0.02 0.54
#> TCGA.V4.A9ET.01     2  0.6138     0.3772 0.12 0.60 0.00 0.00 0.10 0.18
#> TCGA.V4.A9F4.01     5  0.3828    -0.1171 0.00 0.44 0.00 0.00 0.56 0.00
#> TCGA.WC.A881.01     5  0.5802     0.0136 0.00 0.40 0.00 0.00 0.42 0.18
#> TCGA.WC.AA9E.01     5  0.0937     0.3448 0.00 0.04 0.00 0.00 0.96 0.00
#> TCGA.V4.A9E9.01     4  0.0000     0.8947 0.00 0.00 0.00 1.00 0.00 0.00
#> TCGA.VD.A8KB.01     2  0.0000     0.4035 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8KG.01     1  0.0000     0.1856 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8K9.01     1  0.5698     0.0166 0.44 0.00 0.00 0.16 0.00 0.40
#> TCGA.V4.A9EJ.01     1  0.5698     0.0166 0.44 0.00 0.00 0.16 0.00 0.40
#> TCGA.VD.A8KA.01     1  0.5682    -0.0776 0.46 0.38 0.00 0.00 0.00 0.16
#> TCGA.V4.A9EK.01     3  0.0000     0.9546 0.00 0.00 1.00 0.00 0.00 0.00
#> TCGA.YZ.A982.01     3  0.1480     0.9546 0.00 0.00 0.94 0.00 0.02 0.04
#> TCGA.V4.A9EA.01     4  0.1267     0.8974 0.00 0.06 0.00 0.94 0.00 0.00

show/hide code output

cbind(get_classes(res, k = 7), get_membership(res, k = 7))
#>                 class entropy silhouette   p1   p2   p3   p4   p5   p6   p7
#> TCGA.WC.A885.01     6  0.4889      0.117 0.00 0.12 0.00 0.22 0.00 0.64 0.02
#> TCGA.V4.A9ET.01     2  0.4882      0.000 0.04 0.56 0.00 0.00 0.36 0.00 0.04
#> TCGA.V4.A9F4.01     5  0.0000      0.172 0.00 0.00 0.00 0.00 1.00 0.00 0.00
#> TCGA.WC.A881.01     7  0.0504      0.000 0.00 0.00 0.00 0.00 0.02 0.00 0.98
#> TCGA.WC.AA9E.01     5  0.4348      0.200 0.00 0.18 0.00 0.00 0.68 0.00 0.14
#> TCGA.V4.A9E9.01     4  0.2163      0.821 0.00 0.02 0.00 0.88 0.00 0.10 0.00
#> TCGA.VD.A8KB.01     5  0.7322     -0.496 0.00 0.28 0.00 0.10 0.34 0.04 0.24
#> TCGA.VD.A8KG.01     1  0.0000      0.379 1.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.A8K9.01     6  0.4998      0.640 0.32 0.00 0.00 0.14 0.00 0.54 0.00
#> TCGA.V4.A9EJ.01     6  0.4998      0.640 0.32 0.00 0.00 0.14 0.00 0.54 0.00
#> TCGA.VD.A8KA.01     1  0.6719      0.379 0.52 0.08 0.00 0.08 0.00 0.22 0.10
#> TCGA.V4.A9EK.01     3  0.0000      0.847 0.00 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.YZ.A982.01     3  0.3011      0.847 0.00 0.06 0.82 0.00 0.00 0.12 0.00
#> TCGA.V4.A9EA.01     4  0.0000      0.832 0.00 0.00 0.00 1.00 0.00 0.00 0.00

show/hide code output

cbind(get_classes(res, k = 8), get_membership(res, k = 8))
#>                 class entropy silhouette   p1   p2  p3   p4   p5   p6   p7   p8
#> TCGA.WC.A885.01     8  0.0471      0.000 0.00 0.00 0.0 0.02 0.00 0.00 0.00 0.98
#> TCGA.V4.A9ET.01     2  0.0000      0.410 0.00 1.00 0.0 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9F4.01     5  0.3551      0.590 0.06 0.22 0.0 0.00 0.72 0.00 0.00 0.00
#> TCGA.WC.A881.01     7  0.0808      0.000 0.00 0.04 0.0 0.00 0.00 0.00 0.96 0.00
#> TCGA.WC.AA9E.01     5  0.1765      0.621 0.00 0.00 0.0 0.00 0.88 0.00 0.12 0.00
#> TCGA.V4.A9E9.01     4  0.1341      0.734 0.00 0.00 0.0 0.92 0.00 0.00 0.00 0.08
#> TCGA.VD.A8KB.01     2  0.5273      0.376 0.34 0.50 0.0 0.04 0.00 0.00 0.12 0.00
#> TCGA.VD.A8KG.01     1  0.3690      0.256 0.56 0.02 0.0 0.00 0.00 0.42 0.00 0.00
#> TCGA.VD.A8K9.01     6  0.2756      1.000 0.00 0.00 0.0 0.00 0.00 0.74 0.00 0.26
#> TCGA.V4.A9EJ.01     6  0.2756      1.000 0.00 0.00 0.0 0.00 0.00 0.74 0.00 0.26
#> TCGA.VD.A8KA.01     1  0.3320      0.243 0.80 0.00 0.0 0.04 0.00 0.00 0.04 0.12
#> TCGA.V4.A9EK.01     3  0.5087      0.733 0.06 0.00 0.7 0.04 0.08 0.10 0.00 0.02
#> TCGA.YZ.A982.01     3  0.0000      0.733 0.00 0.00 1.0 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EA.01     4  0.3897      0.745 0.10 0.00 0.0 0.78 0.04 0.04 0.04 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)

plot of chunk tab-node-021-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-node-021-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-node-021-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-node-021-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-node-021-consensus-heatmap-5

consensus_heatmap(res, k = 7)

plot of chunk tab-node-021-consensus-heatmap-6

consensus_heatmap(res, k = 8)

plot of chunk tab-node-021-consensus-heatmap-7

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-node-021-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-node-021-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-node-021-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-node-021-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-node-021-membership-heatmap-5

membership_heatmap(res, k = 7)

plot of chunk tab-node-021-membership-heatmap-6

membership_heatmap(res, k = 8)

plot of chunk tab-node-021-membership-heatmap-7

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.

get_signatures(res, k = 2)

plot of chunk tab-node-021-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-node-021-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-node-021-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-node-021-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-node-021-get-signatures-5

get_signatures(res, k = 7)

plot of chunk tab-node-021-get-signatures-6

get_signatures(res, k = 8)

plot of chunk tab-node-021-get-signatures-7

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk node-021-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-node-021-dimension-reduction-1

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

plot of chunk tab-node-021-dimension-reduction-2

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

plot of chunk tab-node-021-dimension-reduction-3

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

plot of chunk tab-node-021-dimension-reduction-4

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

plot of chunk tab-node-021-dimension-reduction-5

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

plot of chunk tab-node-021-dimension-reduction-6

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

plot of chunk tab-node-021-dimension-reduction-7

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk node-021-collect-classes

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.


Node03

Parent node: Node0. Child nodes: Node011-leaf , Node012-leaf , Node013-leaf , Node021 , Node022-leaf , Node023-leaf , Node031-leaf , Node032-leaf .

The object with results only for a single top-value method and a single partitioning method can be extracted as:

res = res_rh["03"]

A summary of res and all the functions that can be applied to it:

res
#> A 'ConsensusPartition' object with k = 2, 3, 4, 5, 6, 7, 8.
#>   On a matrix with 30000 rows and 16 columns.
#>   Top rows (1000) are extracted by 'ATC' method.
#>   Subgroups are detected by 'kmeans' method.
#>   Performed in total 350 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)

plot of chunk node-03-collect-plots

The plots are:

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:

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)

plot of chunk node-03-select-partition-number

The numeric values for all these statistics can be obtained by get_stats().

get_stats(res)
#>   k 1-PAC mean_silhouette concordance area_increased  Rand Jaccard
#> 2 2 1.000           1.000       1.000         0.4589 0.542   0.542
#> 3 3 0.608           0.376       0.831         0.3489 0.917   0.846
#> 4 4 0.675           0.578       0.756         0.1467 0.800   0.586
#> 5 5 0.650           0.743       0.772         0.0974 0.892   0.649
#> 6 6 0.708           0.743       0.833         0.0477 0.950   0.750
#> 7 7 0.800           0.741       0.863         0.0537 1.000   1.000
#> 8 8 0.875           0.584       0.833         0.0365 0.967   0.778

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.

show/hide code output

cbind(get_classes(res, k = 2), get_membership(res, k = 2))
#>                 class entropy silhouette p1 p2
#> TCGA.YZ.A980.01     1       0          1  1  0
#> TCGA.WC.AA9A.01     1       0          1  1  0
#> TCGA.VD.AA8T.01     2       0          1  0  1
#> TCGA.V4.A9E8.01     1       0          1  1  0
#> TCGA.VD.A8KL.01     2       0          1  0  1
#> TCGA.V4.A9EO.01     1       0          1  1  0
#> TCGA.V4.A9ED.01     1       0          1  1  0
#> TCGA.V4.A9ES.01     1       0          1  1  0
#> TCGA.YZ.A985.01     2       0          1  0  1
#> TCGA.VD.A8KN.01     1       0          1  1  0
#> TCGA.VD.A8KK.01     1       0          1  1  0
#> TCGA.WC.A888.01     1       0          1  1  0
#> TCGA.V4.A9F8.01     1       0          1  1  0
#> TCGA.YZ.A984.01     2       0          1  0  1
#> TCGA.VD.AA8P.01     2       0          1  0  1
#> TCGA.VD.A8KF.01     1       0          1  1  0

show/hide code output

cbind(get_classes(res, k = 3), get_membership(res, k = 3))
#>                 class entropy silhouette   p1   p2   p3
#> TCGA.YZ.A980.01     1   0.619     -0.717 0.58 0.00 0.42
#> TCGA.WC.AA9A.01     1   0.619     -0.717 0.58 0.00 0.42
#> TCGA.VD.AA8T.01     2   0.429      0.897 0.00 0.82 0.18
#> TCGA.V4.A9E8.01     1   0.556      0.379 0.70 0.00 0.30
#> TCGA.VD.A8KL.01     2   0.000      0.933 0.00 1.00 0.00
#> TCGA.V4.A9EO.01     1   0.000      0.564 1.00 0.00 0.00
#> TCGA.V4.A9ED.01     1   0.000      0.564 1.00 0.00 0.00
#> TCGA.V4.A9ES.01     3   0.630      0.000 0.48 0.00 0.52
#> TCGA.YZ.A985.01     2   0.000      0.933 0.00 1.00 0.00
#> TCGA.VD.A8KN.01     1   0.556      0.379 0.70 0.00 0.30
#> TCGA.VD.A8KK.01     1   0.000      0.564 1.00 0.00 0.00
#> TCGA.WC.A888.01     1   0.000      0.564 1.00 0.00 0.00
#> TCGA.V4.A9F8.01     1   0.000      0.564 1.00 0.00 0.00
#> TCGA.YZ.A984.01     2   0.000      0.933 0.00 1.00 0.00
#> TCGA.VD.AA8P.01     2   0.429      0.897 0.00 0.82 0.18
#> TCGA.VD.A8KF.01     1   0.619     -0.717 0.58 0.00 0.42

show/hide code output

cbind(get_classes(res, k = 4), get_membership(res, k = 4))
#>                 class entropy silhouette   p1   p2   p3   p4
#> TCGA.YZ.A980.01     4  0.4790     0.0153 0.38 0.00 0.00 0.62
#> TCGA.WC.AA9A.01     4  0.2011     0.6075 0.08 0.00 0.00 0.92
#> TCGA.VD.AA8T.01     2  0.0707     0.8273 0.00 0.98 0.00 0.02
#> TCGA.V4.A9E8.01     1  0.4406     0.2514 0.70 0.00 0.30 0.00
#> TCGA.VD.A8KL.01     2  0.4939     0.8789 0.00 0.74 0.22 0.04
#> TCGA.V4.A9EO.01     1  0.4406     0.6050 0.70 0.00 0.00 0.30
#> TCGA.V4.A9ED.01     1  0.4406     0.6050 0.70 0.00 0.00 0.30
#> TCGA.V4.A9ES.01     4  0.6299     0.3751 0.06 0.00 0.42 0.52
#> TCGA.YZ.A985.01     2  0.4134     0.8827 0.00 0.74 0.26 0.00
#> TCGA.VD.A8KN.01     1  0.4406     0.2514 0.70 0.00 0.30 0.00
#> TCGA.VD.A8KK.01     1  0.4406     0.6050 0.70 0.00 0.00 0.30
#> TCGA.WC.A888.01     1  0.4855     0.4624 0.60 0.00 0.00 0.40
#> TCGA.V4.A9F8.01     1  0.4624     0.5660 0.66 0.00 0.00 0.34
#> TCGA.YZ.A984.01     2  0.4134     0.8827 0.00 0.74 0.26 0.00
#> TCGA.VD.AA8P.01     2  0.0707     0.8273 0.00 0.98 0.02 0.00
#> TCGA.VD.A8KF.01     4  0.2011     0.6075 0.08 0.00 0.00 0.92

show/hide code output

cbind(get_classes(res, k = 5), get_membership(res, k = 5))
#>                 class entropy silhouette   p1   p2   p3   p4   p5
#> TCGA.YZ.A980.01     4  0.3983      0.633 0.34 0.00 0.00 0.66 0.00
#> TCGA.WC.AA9A.01     4  0.2732      0.791 0.16 0.00 0.00 0.84 0.00
#> TCGA.VD.AA8T.01     2  0.6813      0.569 0.00 0.46 0.36 0.02 0.16
#> TCGA.V4.A9E8.01     5  0.3424      0.985 0.24 0.00 0.00 0.00 0.76
#> TCGA.VD.A8KL.01     2  0.2797      0.690 0.00 0.88 0.00 0.06 0.06
#> TCGA.V4.A9EO.01     1  0.0609      0.908 0.98 0.00 0.02 0.00 0.00
#> TCGA.V4.A9ED.01     1  0.0000      0.919 1.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9ES.01     3  0.5607      0.000 0.08 0.00 0.54 0.38 0.00
#> TCGA.YZ.A985.01     2  0.0609      0.706 0.00 0.98 0.00 0.00 0.02
#> TCGA.VD.A8KN.01     5  0.3999      0.985 0.24 0.00 0.02 0.00 0.74
#> TCGA.VD.A8KK.01     1  0.0000      0.919 1.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A888.01     1  0.2280      0.832 0.88 0.00 0.00 0.12 0.00
#> TCGA.V4.A9F8.01     1  0.1732      0.882 0.92 0.00 0.00 0.08 0.00
#> TCGA.YZ.A984.01     2  0.0000      0.707 0.00 1.00 0.00 0.00 0.00
#> TCGA.VD.AA8P.01     2  0.6064      0.569 0.00 0.46 0.42 0.00 0.12
#> TCGA.VD.A8KF.01     4  0.2732      0.791 0.16 0.00 0.00 0.84 0.00

show/hide code output

cbind(get_classes(res, k = 6), get_membership(res, k = 6))
#>                 class entropy silhouette   p1   p2   p3   p4   p5   p6
#> TCGA.YZ.A980.01     4  0.5235      0.419 0.38 0.00 0.00 0.52 0.00 0.10
#> TCGA.WC.AA9A.01     4  0.2260      0.677 0.14 0.00 0.00 0.86 0.00 0.00
#> TCGA.VD.AA8T.01     6  0.3321      0.915 0.00 0.10 0.08 0.00 0.00 0.82
#> TCGA.V4.A9E8.01     5  0.4221      0.868 0.04 0.08 0.06 0.02 0.80 0.00
#> TCGA.VD.A8KL.01     2  0.7034      0.658 0.00 0.52 0.12 0.12 0.02 0.22
#> TCGA.V4.A9EO.01     1  0.2790      0.785 0.84 0.14 0.02 0.00 0.00 0.00
#> TCGA.V4.A9ED.01     1  0.0000      0.903 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9ES.01     3  0.4503      0.000 0.08 0.00 0.68 0.24 0.00 0.00
#> TCGA.YZ.A985.01     2  0.4334      0.804 0.00 0.72 0.04 0.00 0.02 0.22
#> TCGA.VD.A8KN.01     5  0.0937      0.868 0.04 0.00 0.00 0.00 0.96 0.00
#> TCGA.VD.A8KK.01     1  0.0000      0.903 1.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.WC.A888.01     1  0.2728      0.796 0.86 0.00 0.00 0.04 0.00 0.10
#> TCGA.V4.A9F8.01     1  0.0547      0.897 0.98 0.00 0.00 0.02 0.00 0.00
#> TCGA.YZ.A984.01     2  0.2941      0.810 0.00 0.78 0.00 0.00 0.00 0.22
#> TCGA.VD.AA8P.01     6  0.1814      0.915 0.00 0.10 0.00 0.00 0.00 0.90
#> TCGA.VD.A8KF.01     4  0.2260      0.677 0.14 0.00 0.00 0.86 0.00 0.00

show/hide code output

cbind(get_classes(res, k = 7), get_membership(res, k = 7))
#>                 class entropy silhouette   p1   p2   p3   p4  p5   p6   p7
#> TCGA.YZ.A980.01     4  0.5229      0.640 0.18 0.00 0.00 0.64 0.0 0.06 0.12
#> TCGA.WC.AA9A.01     4  0.1166      0.825 0.00 0.00 0.00 0.94 0.0 0.00 0.06
#> TCGA.VD.AA8T.01     6  0.2259      0.898 0.00 0.16 0.00 0.00 0.0 0.84 0.00
#> TCGA.V4.A9E8.01     5  0.0000      0.732 0.00 0.00 0.00 0.00 1.0 0.00 0.00
#> TCGA.VD.A8KL.01     2  0.3047      0.698 0.28 0.72 0.00 0.00 0.0 0.00 0.00
#> TCGA.V4.A9EO.01     7  0.3047      0.663 0.28 0.00 0.00 0.00 0.0 0.00 0.72
#> TCGA.V4.A9ED.01     7  0.0000      0.856 0.00 0.00 0.00 0.00 0.0 0.00 1.00
#> TCGA.V4.A9ES.01     3  0.1664      0.000 0.00 0.00 0.92 0.06 0.0 0.00 0.02
#> TCGA.YZ.A985.01     2  0.0504      0.838 0.02 0.98 0.00 0.00 0.0 0.00 0.00
#> TCGA.VD.A8KN.01     5  0.4569      0.732 0.18 0.00 0.04 0.00 0.7 0.08 0.00
#> TCGA.VD.A8KK.01     7  0.0000      0.856 0.00 0.00 0.00 0.00 0.0 0.00 1.00
#> TCGA.WC.A888.01     7  0.3770      0.699 0.18 0.00 0.00 0.00 0.0 0.08 0.74
#> TCGA.V4.A9F8.01     7  0.0863      0.848 0.04 0.00 0.00 0.00 0.0 0.00 0.96
#> TCGA.YZ.A984.01     2  0.0504      0.843 0.00 0.98 0.00 0.02 0.0 0.00 0.00
#> TCGA.VD.AA8P.01     6  0.4707      0.898 0.04 0.16 0.04 0.04 0.0 0.72 0.00
#> TCGA.VD.A8KF.01     4  0.1166      0.825 0.00 0.00 0.00 0.94 0.0 0.00 0.06

show/hide code output

cbind(get_classes(res, k = 8), get_membership(res, k = 8))
#>                 class entropy silhouette   p1   p2   p3   p4   p5   p6   p7   p8
#> TCGA.YZ.A980.01     4  0.5183      0.437 0.00 0.00 0.34 0.52 0.00 0.00 0.06 0.08
#> TCGA.WC.AA9A.01     4  0.0000      0.707 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00
#> TCGA.VD.AA8T.01     6  0.4937      0.752 0.08 0.18 0.00 0.00 0.00 0.64 0.00 0.10
#> TCGA.V4.A9E8.01     5  0.0000      0.770 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00
#> TCGA.VD.A8KL.01     1  0.3237      0.594 0.60 0.40 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.V4.A9EO.01     8  0.3318      0.000 0.00 0.00 0.00 0.00 0.00 0.00 0.46 0.54
#> TCGA.V4.A9ED.01     7  0.0000      0.711 0.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00
#> TCGA.V4.A9ES.01     3  0.3808      0.000 0.00 0.34 0.62 0.04 0.00 0.00 0.00 0.00
#> TCGA.YZ.A985.01     1  0.2071      0.768 0.90 0.02 0.04 0.00 0.00 0.00 0.00 0.04
#> TCGA.VD.A8KN.01     5  0.4019      0.770 0.00 0.06 0.00 0.00 0.74 0.06 0.00 0.14
#> TCGA.VD.A8KK.01     7  0.0000      0.711 0.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00
#> TCGA.WC.A888.01     7  0.4480      0.187 0.00 0.00 0.30 0.00 0.00 0.00 0.58 0.12
#> TCGA.V4.A9F8.01     7  0.0471      0.701 0.00 0.00 0.00 0.00 0.00 0.02 0.98 0.00
#> TCGA.YZ.A984.01     1  0.0000      0.773 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
#> TCGA.VD.AA8P.01     6  0.1341      0.752 0.08 0.00 0.00 0.00 0.00 0.92 0.00 0.00
#> TCGA.VD.A8KF.01     4  0.1091      0.707 0.00 0.00 0.00 0.94 0.00 0.00 0.00 0.06

Heatmaps for the consensus matrix. It visualizes the probability of two samples to be in a same group.

consensus_heatmap(res, k = 2)

plot of chunk tab-node-03-consensus-heatmap-1

consensus_heatmap(res, k = 3)

plot of chunk tab-node-03-consensus-heatmap-2

consensus_heatmap(res, k = 4)

plot of chunk tab-node-03-consensus-heatmap-3

consensus_heatmap(res, k = 5)

plot of chunk tab-node-03-consensus-heatmap-4

consensus_heatmap(res, k = 6)

plot of chunk tab-node-03-consensus-heatmap-5

consensus_heatmap(res, k = 7)

plot of chunk tab-node-03-consensus-heatmap-6

consensus_heatmap(res, k = 8)

plot of chunk tab-node-03-consensus-heatmap-7

Heatmaps for the membership of samples in all partitions to see how consistent they are:

membership_heatmap(res, k = 2)

plot of chunk tab-node-03-membership-heatmap-1

membership_heatmap(res, k = 3)

plot of chunk tab-node-03-membership-heatmap-2

membership_heatmap(res, k = 4)

plot of chunk tab-node-03-membership-heatmap-3

membership_heatmap(res, k = 5)

plot of chunk tab-node-03-membership-heatmap-4

membership_heatmap(res, k = 6)

plot of chunk tab-node-03-membership-heatmap-5

membership_heatmap(res, k = 7)

plot of chunk tab-node-03-membership-heatmap-6

membership_heatmap(res, k = 8)

plot of chunk tab-node-03-membership-heatmap-7

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.

get_signatures(res, k = 2)

plot of chunk tab-node-03-get-signatures-1

get_signatures(res, k = 3)

plot of chunk tab-node-03-get-signatures-2

get_signatures(res, k = 4)

plot of chunk tab-node-03-get-signatures-3

get_signatures(res, k = 5)

plot of chunk tab-node-03-get-signatures-4

get_signatures(res, k = 6)

plot of chunk tab-node-03-get-signatures-5

get_signatures(res, k = 7)

plot of chunk tab-node-03-get-signatures-6

get_signatures(res, k = 8)

plot of chunk tab-node-03-get-signatures-7

Compare the overlap of signatures from different k:

compare_signatures(res)

plot of chunk node-03-signature_compare

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:

  1. which_row: row indices corresponding to the input matrix.
  2. fdr: FDR for the differential test.
  3. mean_x: The mean value in group x.
  4. scaled_mean_x: The mean value in group x after rows are scaled.
  5. 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")

plot of chunk tab-node-03-dimension-reduction-1

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

plot of chunk tab-node-03-dimension-reduction-2

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

plot of chunk tab-node-03-dimension-reduction-3

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

plot of chunk tab-node-03-dimension-reduction-4

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

plot of chunk tab-node-03-dimension-reduction-5

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

plot of chunk tab-node-03-dimension-reduction-6

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

plot of chunk tab-node-03-dimension-reduction-7

Following heatmap shows how subgroups are split when increasing k:

collect_classes(res)

plot of chunk node-03-collect-classes

If matrix rows can be associated to genes, consider to use functional_enrichment(res, ...) to perform function enrichment for the signature genes. See this vignette for more detailed explanations.

Session info

sessionInfo()
#> R version 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      stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] genefilter_1.74.0    ComplexHeatmap_2.8.0 markdown_1.1         knitr_1.33          
#> [5] matrixStats_0.59.0   cola_1.9.4          
#> 
#> loaded via a namespace (and not attached):
#>   [1] bitops_1.0-7           bit64_4.0.5            doParallel_1.0.16      RColorBrewer_1.1-2    
#>   [5] httr_1.4.2             GenomeInfoDb_1.28.1    data.tree_1.0.0        tools_4.1.0           
#>   [9] utf8_1.2.1             R6_2.5.0               irlba_2.3.3            DBI_1.1.1             
#>  [13] BiocGenerics_0.38.0    colorspace_2.0-2       GetoptLong_1.0.5       gridExtra_2.3         
#>  [17] tidyselect_1.1.1       bit_4.0.4              compiler_4.1.0         Biobase_2.52.0        
#>  [21] Cairo_1.5-12.2         xml2_1.3.2             microbenchmark_1.4-7   slam_0.1-48           
#>  [25] scales_1.1.1           askpass_1.1            stringr_1.4.0          digest_0.6.27         
#>  [29] XVector_0.32.0         pkgconfig_2.0.3        umap_0.2.7.0           fastmap_1.1.0         
#>  [33] highr_0.9              rlang_0.4.11           GlobalOptions_0.1.2    rstudioapi_0.13       
#>  [37] RSQLite_2.2.7          impute_1.66.0          generics_0.1.0         shape_1.4.6           
#>  [41] jsonlite_1.7.2         mclust_5.4.7           dplyr_1.0.7            dendextend_1.15.1     
#>  [45] RCurl_1.98-1.3         magrittr_2.0.1         GenomeInfoDbData_1.2.6 Matrix_1.3-4          
#>  [49] fansi_0.5.0            Rcpp_1.0.7             munsell_0.5.0          S4Vectors_0.30.0      
#>  [53] viridis_0.6.1          reticulate_1.20        lifecycle_1.0.0        scatterplot3d_0.3-41  
#>  [57] stringi_1.7.3          zlibbioc_1.38.0        blob_1.2.1             parallel_4.1.0        
#>  [61] crayon_1.4.1           lattice_0.20-44        Biostrings_2.60.1      splines_4.1.0         
#>  [65] annotate_1.70.0        circlize_0.4.13        KEGGREST_1.32.0        polylabelr_0.2.0      
#>  [69] pillar_1.6.1           rjson_0.2.20           codetools_0.2-18       stats4_4.1.0          
#>  [73] XML_3.99-0.6           glue_1.4.2             evaluate_0.14          png_0.1-7             
#>  [77] vctrs_0.3.8            foreach_1.5.1          polyclip_1.10-0        purrr_0.3.4           
#>  [81] gtable_0.3.0           openssl_1.4.4          assertthat_0.2.1       clue_0.3-59           
#>  [85] cachem_1.0.5           ggplot2_3.3.5          xfun_0.24              eulerr_6.1.0          
#>  [89] xtable_1.8-4           skmeans_0.2-13         RSpectra_0.16-0        viridisLite_0.4.0     
#>  [93] survival_3.2-11        tibble_3.1.2           Polychrome_1.3.1       iterators_1.0.13      
#>  [97] AnnotationDbi_1.54.1   memoise_2.0.0          IRanges_2.26.0         cluster_2.1.2         
#> [101] ellipsis_0.3.2         brew_1.0-6