hasaru-k / GlimmaV2

interactive plots for differential expression analysis
GNU Lesser General Public License v3.0
25 stars 8 forks source link

Rendering Glimma plots after knitting #77

Closed joseale2310 closed 10 months ago

joseale2310 commented 3 years ago

Hi!

I am trying to create an html report using knit from RStudio. The plot works completely fine in the Rmarkdown, but when trying to knit the document, the plot loses several features, like the table and count plot (although the document leaves the space necessary for the table). I can still hover the genes and check their values, but clicking does not do anything.

image

These are my markdown options

--- 
knit: (function(inputFile, encoding) { 
      rmarkdown::render(inputFile,
                        encoding=encoding,
                        output_format='all',
                        output_dir='./reports/')})
output:
  # To create PDF report, uncomment below
  #pdf_document:
  #  toc: yes
  html_document:
    number_sections: yes
    theme: yeti
    toc: yes
    toc_float: yes
    df_print: paged
    dev: png
---

I am not sure if there is some option that I am missing or how I could recover all the functionality of the plot! Thank you!

danphillips28 commented 3 years ago

I am having the exact same issue for glimmaVolcano, eagerly awaiting a fix! Thanks, Dan

PeteHaitch commented 2 years ago

Can you create and provide a small example that reproduces the behaviour you're seeing? Please also provide the output of BiocManager::valid() and your RStudio version. That will really help people debug the issue.

hasaru-k commented 1 year ago

Howdy @joseale2310 and @danphillips28,

I've managed to reproduce the issue with the markdown options you provided.

Screen Shot 2022-12-08 at 10 06 35 pm

It looks like Glimma's JS is interfering with the table of contents installation. Do the plots render if you disable the toc as below?

--- 
...
output:
  html_document:
    number_sections: yes
    theme: yeti
    # toc: yes
    # toc_float: yes
    df_print: paged
    dev: png
---
joseale2310 commented 1 year ago

Hi, yes that seems to be the issue. I have removed the toc and the toc_float and it works fine. Weird interaction. Any chances it can be fixed? I rather prefer having the table of contents. It makes it easier for my colleagues to follow the reports I give them about their data. It would be super appreciated!

hasaru-k commented 1 year ago

Yes, we're looking into a fix for this interaction as a priority

hasaru-k commented 1 year ago

hey @joseale2310, I've pushed up a fix on a separate branch. Could you please try the following:

remove.packages("Glimma")

then:

devtools::install_github("hasaru-k/GlimmaV2@hasaru-fixTocJqueryInteraction")

And then try knitting a document with a Glimma plot. On my machine, this harmonises the interaction between the TOC installation and Glimma:

Screenshot 2022-12-10 at 8 46 44 pm

Please let me know if knitting Glimma plots with the toc + toc_float works after this.

If so, we'll endeavour to merge this fix into the main branch (after doing some further testing, as the changes involve some rearranging and updating of dependencies, which have the potential to break things).

joseale2310 commented 1 year ago

Edit: I deleted completely the answer. I was too dumb to put any titles to any sections.

So it turns out it does seem to work very well with the fix! Thanks!!