作者:Zuguang Gu8
编译:Steven Shen
原文:Get orders and dendrograms
row_order()
,column_order()
,row_dend()
andcolumn_dend()
can be used to retrieve corresponding information from the heatmap list. The usage is straightforward by following examples. But remember you need to apply these functions on the object returned bydraw()
.
ht1 = Heatmap(mat1, name = "rnorm", col = col_rnorm)
ht2 = Heatmap(mat2, name = "runif", col = col_runif)
ht_list = ht1 + ht2
ht_list = draw(ht_list)
row_order(ht_list)
## [1] 9 2 10 8 6 11 5 7 12 4 1 3
column_order(ht_list)
## $rnorm
## [1] 5 2 7 6 10 1 9 8 4 3
##
## $runif
## [1] 4 10 2 5 7 6 1 3 8 9
If rows or columns are split, the returned values will also be a list.
ht1 = Heatmap(mat1, name = "rnorm", col = col_rnorm)
ht2 = Heatmap(mat2, name = "runif", col = col_runif, column_km = 2)
ht_list = ht1 + ht2
ht_list = draw(ht_list, row_km = 2)
row_order(ht_list)
## $`1`
## [1] 12 4 1 3
##
## $`2`
## [1] 9 2 10 8 6 11 5 7
column_order(ht_list)
## $rnorm
## $rnorm[[1]]
## [1] 5 2 7 6 10 1 9 8 4 3
##
##
## $runif
## $runif$`1`
## [1] 7 6 1 3 8 9
##
## $runif$`2`
## [1] 4 10 2 5
You can specify a certain heatmap for the column order.
column_order(ht_list, name = "runif")
## $`1`
## [1] 7 6 1 3 8 9
##
## $`2`
## [1] 4 10 2 5
The logic is the same for extracting dendrograms and also the same for vertical heatmap list, so we don’t show more examples here.