question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Clustergram not reordering heat-map rows

See original GitHub issue

Describe the bug Clustergram is not using the order provided by the clustering method and dendrogram to display the heat-map.

To Reproduce Steps to reproduce the behavior:

import numpy as np
import dash_bio
from plotly.offline import iplot, init_notebook_mode

init_notebook_mode()
data = np.array([[1,1,1,1], 
        [3,3,3,3],
        [1,1,1,1],
        [3,3,3,3],
        [1,1,1,1],
        [3,3,3,3]])

iplot(dash_bio.Clustergram(
    data=np.array(data),
    center_values=False
))

Expected behavior A clear and concise description of what you expected to happen. Heat-map rows reordering based on the clustering result.

Screenshots If applicable, add screenshots to help explain the issue. image

Python version: [e.g., 3.7.2] 3.7.4 Python environment (all installed packages in your current environment):

Additional context Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mkcorcommented, Jan 4, 2020

I have finally found the bug, yay! Fixed in 611a1b358b66694a047e9ddafbf9ea7f9562eea1. PR coming soon…

1reaction
plplacommented, Dec 2, 2019

Hi @mkcor , I would expect the result to be highly similar to Searborn Clustermap since they are the same type of figure. Using the data from my very basic example, the rows with identical values (ones or threes) should be next to each other. See the example below.

import seaborn as sns
import numpy as np

data = np.array([[1,1,1,1], 
        [3,3,3,3],
        [1,1,1,1],
        [3,3,3,3],
        [1,1,1,1],
        [3,3,3,3]])

sns.clustermap(data, cmap="mako")

image

To be clear, the clusering in the Clustergram works as the dendrogram on the left side shows 2 groups. Although the rows in the heat-map are not reordered to represent these clusters. In the end, I would expect to get a block of red rows and a block of green rows.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Clusters and Heatmaps - Jeffrey C. Oliver
The dendrogram should be vertically stretched so each tip lines up with a row in the heatmap plot. Re-order heatmap rows to match...
Read more >
heatmap-suppress col reordering/dendrogram?
I want to make a heat map without row and column clustering to keep my row order as it is. It has ~8000genes....
Read more >
reordering dendrograms on a clustergram in matlab
About the main problem: Suppose you put your data in nx2 a matrix A then you can sort it according to a column...
Read more >
How can I rearrange columns for a HeatMap or Clustergram ...
My question is....see the x-axis? How can I re-arrange so that they are ordered, 1-6? I realize that this will inherently interfere with ......
Read more >
clustergram - MathWorks
The clustergram function creates a clustergram object. The object contains hierarchical clustering analysis data that you can view in a heatmap and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found