Code Monkey home page Code Monkey logo

Comments (4)

jokergoo avatar jokergoo commented on May 22, 2024

That is a nice suggestion! I will support it in the next version. Thanks!

from complexheatmap.

schelhorn avatar schelhorn commented on May 22, 2024

That seems to do the trick (replacing the prior part in Heatmap-class.R, starting line 649):

                } else {
                    if(is.numeric(mat)) {
                        require(gclus)
                        hclust_d = get_dist(submat, distance)
                        c = hclust(hclust_d, method = method)
                        c = gclus::reorder.hclust(c, hclust_d)
                        row_hclust_list[[i]] = c
                        row_order_list[[i]] = row_order_list[[i]][ get_hclust_order(row_hclust_list[[i]]) ]
                    }
                }

from complexheatmap.

jokergoo avatar jokergoo commented on May 22, 2024

Thanks a lot for the suggestion. I used a little bit different solution. Actually there are two ways:

  1. if you only want to re-order rows based on a hclust object but don't want to draw the tree, you can set the order through row_order option in Heatmap(). Then you can split the rows in the normal way.
hc = hclust(dist(mat))
Heatmap(mat, cluster_rows = FALSE, row_order = hc$order, split = ...)
  1. if you also want to keep the tree, is this case, split can only be set as a single number indicating how many sub-trees that are cut from the big tree.
Heatmap(mat, cluster_rows = hc, split = 2)

So in the following two figures, the second heatmap are splitted into two halves:

download1
download2

This new feature are supported from version 1.2.2.

from complexheatmap.

schelhorn avatar schelhorn commented on May 22, 2024

Thanks, that's excellent and also more flexible than my solution.

from complexheatmap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.