作者:Zuguang Gu8
    编译:Steven Shen
    原文:Get orders and dendrograms


    row_order(), column_order(), row_dend() and column_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 by draw().

    1. ht1 = Heatmap(mat1, name = "rnorm", col = col_rnorm)
    2. ht2 = Heatmap(mat2, name = "runif", col = col_runif)
    3. ht_list = ht1 + ht2
    4. ht_list = draw(ht_list)
    5. row_order(ht_list)
    6. ## [1] 9 2 10 8 6 11 5 7 12 4 1 3
    7. column_order(ht_list)
    8. ## $rnorm
    9. ## [1] 5 2 7 6 10 1 9 8 4 3
    10. ##
    11. ## $runif
    12. ## [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.

    1. ht1 = Heatmap(mat1, name = "rnorm", col = col_rnorm)
    2. ht2 = Heatmap(mat2, name = "runif", col = col_runif, column_km = 2)
    3. ht_list = ht1 + ht2
    4. ht_list = draw(ht_list, row_km = 2)
    5. row_order(ht_list)
    6. ## $`1`
    7. ## [1] 12 4 1 3
    8. ##
    9. ## $`2`
    10. ## [1] 9 2 10 8 6 11 5 7
    11. column_order(ht_list)
    12. ## $rnorm
    13. ## $rnorm[[1]]
    14. ## [1] 5 2 7 6 10 1 9 8 4 3
    15. ##
    16. ##
    17. ## $runif
    18. ## $runif$`1`
    19. ## [1] 7 6 1 3 8 9
    20. ##
    21. ## $runif$`2`
    22. ## [1] 4 10 2 5

    You can specify a certain heatmap for the column order.

    1. column_order(ht_list, name = "runif")
    2. ## $`1`
    3. ## [1] 7 6 1 3 8 9
    4. ##
    5. ## $`2`
    6. ## [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.