How to retain interactive plots from Glimma in R Markdown HTML Document
0
1
Entering edit mode
8 days ago
soullevram98 ▴ 10

I created an interactive volcano plot using the code below using glXYPlot function in Glimma. A separate HTML page is created; however, when I knit the R markdown document, the interactive plot is not displayed in the final HTML document. How can I retain the interactive plot in the final document?

{r eval = T, echo = T}
glXYPlot(x=fit.contrst$coefficients[,1], 
     y=fit.contrst$lods[,1],
     xlab="Log fold-change", 
     ylab="B", 
     main="CFVsNormal",
     counts=voom$E, 
     groups=group.data, 
     status=summary.data[,1],
     anno=fit.contrst$genes, 
     side.main="ENTREZID",
     folder = "volcano",
     ) 
R glimma markdown • 288 views
ADD COMMENT
1
Entering edit mode

Have you tried implicitly setting "html=NULL"?

Looking at the github for GlimmaV2, the internally called function glimmaXYWidget will return the widget without exporting it if html=NULL

glimmaXYWidget <- function(xData, width, height, html)
{
  widget <- htmlwidgets::createWidget(
    name = 'glimmaXY',
    xData,
    width = width,
    height = height,
    package = 'Glimma',
    elementId = NULL,
    sizingPolicy = htmlwidgets::sizingPolicy(defaultWidth=width, defaultHeight=height, browser.fill=TRUE, viewer.suppress=TRUE)
  )
  if (is.null(html))
  {
    return(widget)
  }
  else
  {
    message("Saving widget...")
    htmlwidgets::saveWidget(widget, file=html)
    message(html, " generated.")
  }
}
ADD REPLY
0
Entering edit mode

I'm trying to build the XYData, but I get the error "could not find function "buildXYData""

ADD REPLY
1
Entering edit mode

Sorry, I meant in your original example to explicitly state:

glXYPlot(x=fit.contrst$coefficients[,1], 
     y=fit.contrst$lods[,1],
     xlab="Log fold-change", 
     ylab="B", 
     main="CFVsNormal",
     counts=voom$E, 
     groups=group.data, 
     status=summary.data[,1],
     anno=fit.contrst$genes, 
     side.main="ENTREZID",
     folder = "volcano",
     html=NULL ### changed here
     ) 

Otherwise because these functions are internal Glimma functions if you want to edit the function you'll need to prepend them with Glimma:: or Glimma::: depending on whether it's an exported function or an internal one

ADD REPLY

Login before adding your answer.

Traffic: 2907 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6