ropensci / iheatmapr

Complex, interactive heatmaps in R
https://docs.ropensci.org/iheatmapr
Other
267 stars 35 forks source link

Column annotation label disappeared #79

Open shreyagupta0909 opened 3 years ago

shreyagupta0909 commented 3 years ago

Hi ,

We are using this package and suddenly with below code Column annotation labels have disappeared. Is there any way to get it back? Below is the dummy code. This is a bit urgent mat <- matrix(rnorm(24), ncol = 6) annotation <- data.frame(gender = c(rep("M", 3),rep("F",3)), age = c(20,34,27,19,23,30)) hm <- main_heatmap(mat) %>% add_col_annotation(annotation) %>% add_col_labels() %>% add_row_labels()

Thanks, Shreya

AliciaSchep commented 3 years ago

What version of the code are you using? And can you clarify exactly what result you're getting and what you're expecting to get?

shreyagupta0909 commented 3 years ago

I am using 0.5.0 version. I have attached the expected result (result_expected.png) Result_expected

and result I am getting (result_getting.png) Result_getting

shreyagupta0909 commented 3 years ago

What version of the code are you using? And can you clarify exactly what result you're getting and what you're expecting to get?

Hello, I am using version 0.5.0. I have also attached the screenshots in below message. Could you please help me find the solution to this?

Thanks, Shreya

halhen commented 3 years ago

I poked around a bit and haven't quite gotten to the bottom of it, but here is what I found. Hope it helps.

Generating plots in 0.4.12 and 0.5.1 with the code below. I too get not annotation labels in 0.5.1.

set.seed(1)
mat <- matrix(rnorm(24), ncol = 6)
annotation <- data.frame(gender = c(rep("M", 3),rep("F",3)),
                         age = c(20,34,27,19,23,30))
p <- main_heatmap(mat) %>% add_col_annotation(annotation, show_colorbar = TRUE) %>% add_col_labels() %>%
  add_row_labels() 
to_plotly_json(p)

Diffing the two generated plotly jsons give only a small diff:

$ diff /tmp/0.5.1.json /tmp/0.4.12.json                
201a202
> 
224,226c225
<       "y": [
<         1
<       ],
---
>       "y": 1,
298,300c297
<       "y": [
<         1
<       ],
---
>       "y": 1,

It looks like there has been some changes in how lists are handled. For 0.5.1, the screenshot below shows that the trace is marked as AsIs (I(somevalue)). It looks like these values shouldn't be unboxed: https://github.com/jeroen/jsonlite/issues/78 . Maybe the new list handling accidentally does this?

Screenshot from 2020-07-28 22-27-50

That's how far I got down the rabbit hole before I need to get away from the computer. Hope it is useful to track things down; sorry if it leads you astray.

(Unfortunately no workaround to offer).

JSON output: json.zip

AliciaSchep commented 3 years ago

Thanks for your investigation @halhen -- think it revealed the source of the bug that got introduced in an effort to fix another bug (#78 ). Will put in a fix.

shreyagupta0909 commented 3 years ago

Thanks for your investigation @halhen -- think it revealed the source of the bug that got introduced in an effort to fix another bug (#78 ). Will put in a fix.

Hi @AliciaSchep

Is this bug fixed? Will I have to use an updated version for the package now?

AliciaSchep commented 3 years ago

@shreyagupta0909 It should be fixed in the latest version on Github which can be installed via devtools::install_github (but has not yet been submitted to CRAN).

shreyagupta0909 commented 3 years ago

@shreyagupta0909 It should be fixed in the latest version on Github which can be installed via devtools::install_github (but has not yet been submitted to CRAN).

@AliciaSchep till when would this package be available on CRAN?

halhen commented 3 years ago

Ping on this. When could we hope to get 0.5.1 to CRAN?

AliciaSchep commented 3 years ago

Aiming to submit it some time this week.