stemangiola / tidyHeatmap

Draw heatmap simply using a tidy data frame
https://stemangiola.github.io/tidyHeatmap/
320 stars 23 forks source link

retrieve data after producing heatmap #134

Open Ollipolli1909 opened 1 month ago

Ollipolli1909 commented 1 month ago

Hi, I am looking for a way to retrieve the ordered data after generating the heatmap. Just producing a heatmap without being able to also get the data in the same order is pretty useless. Am I missing something ? I like tidyHeatmap, but wihtout being able to do this I will have to go back to ComplexHeatmaps - and even there it is a pain.

stemangiola commented 1 month ago

Can you please make a practical example of what retrieving the "ordered data" would look like, from input to output?

Ollipolli1909 commented 1 month ago

I would like to retrieve a data frame that has the same order (rows/columns) as shown in the heatmap after clustering etc (i.e. I cannot find where the order etc is stored in the object)

stemangiola commented 3 days ago

Sorry for the delay, few deadlines are accumulating. I will attend this asap.

Ollipolli1909 commented 3 days ago

Thanks Stefano ! :)

stemangiola commented 3 days ago

Actually, I think you can use

... |> as_ComplexHeatmap()

And extract your data from the ComplexHeatmap object. If you have doubts have a look to ComplexHeatmap documentation.

If you manage to extract you data in this way, please update README.Rmd and Vignettes with your example. It will be helpful for others in the future!

Ollipolli1909 commented 3 days ago

I know how to extract what I want from Complexheatmap objects, and there are countless treads on this on biostars etc how to do it via complex for loops or similar. I just wish there was a simple solution/function implemented into the package itself, given it is a necessary output for any downstream analyses. But i can't complain, you are putting in the effort for everyone ! :)

stemangiola commented 2 days ago

The dendrogram, is calculated by ComplexHeatmap, so that information is created after tidyHeatmap takes care of interpreting your commands. So tidyHeatmaps does not know of what the dendrogram will be.

Nonetheless, we could create wrappers to extract some info from the resulting object.

Let's keep into the to-do list. If you know how to extract, you could even implement it yourself pretty easily, and add that function to tidyHeatmap. Very happy to review the code!