biolab / orange3

🍊 :bar_chart: :bulb: Orange: Interactive data analysis
https://orangedatamining.com
Other
4.85k stars 1.01k forks source link

Heatmap colour annotation not updating #4766

Closed Hrovatin closed 4 years ago

Hrovatin commented 4 years ago

Latest master: When I use heatmap colour annotations and I try to switch between categorical features the heatmap is not updated. Example: I start with categorical_A as annotation -> The heatmap displays annotation and the annotation selection menu is set to categorical_A. Then I switch to categorical_B. - > The annotation selection menu changes to categorical_B, but the heatmap still displays categorical_A. I can only set the categoricalB to be displayed in the heatmap by first setting the colour annotation (None)_ and then switching to categorical_B. The same bug is present in Split by.

ajdapretnar commented 4 years ago

I cannot reproduce on the latest master. 🤷

Hrovatin commented 4 years ago

It seems to be data instance specific. When I saved heatmap input data with header annotations and loaded it again this did not happen anymore. I can no longer switch between categorical after Merge Data (1), but before it I have only 1 categorical variable so I can not test if this happens due to the Merge Data. Screenshot from 2020-05-15 14-44-07 Example of the error: Screenshot from 2020-05-15 14-46-20

ajdapretnar commented 4 years ago

It is very hard to debug such a complex workflow. Any chance to reproduce this on a smaller one?

I have tried with Merge Data and everything works fine. (in a simple workflow)

ales-erjavec commented 4 years ago

A simpler case: Screen Shot 2020-05-15 at 16 13 08

The error is that domain["Cluster"] == domain["Cluster New"] which shortcircuts the update in https://github.com/biolab/orange3/blob/24a49675f3cf8df90babb95397050cfe225925b1/Orange/widgets/visualize/owheatmap.py#L992-L994

ajdapretnar commented 4 years ago

Thanks @ales-erjavec for this example! I think this is way beyond just calling update() at the right time. Probably @janezd has to have a say in this, because it most likely goes all the way to __eq__.

janezd commented 4 years ago

I don't have anything to say. I don't think we can change __eq__.

__eq__ is quite imperfect, but still better than Variable.make. We have different levels of equality, and this example would require a stricter one than most other contexts.

ajdapretnar commented 4 years ago

My dumbass fix would be if self.annotation_color_var.name != var.name.... But I suppose this could lead to other sorts of problems.

ales-erjavec commented 4 years ago

On a related note, this is a problem:

>>> domain["Cluster"] == domain["Cluster New"]
True
>>> hash(domain["Cluster"]) == hash(domain["Cluster New"])
False
Hrovatin commented 4 years ago

The same issue happens in other widgets, like Venn Diagram.

Screenshot from 2020-05-26 13-15-04

Here I have two tables - one of them has a column Gene and the other does not have it, so I had changed one of the columns to Gene with Edit Domain. When I try to compare them in Venn Diagram I can not select the column Gene for matching, as it thinks it is missing from one of the tables. If I change the column names in the file before loading data into the Orange the Venn Diagram matching works as expected.