lianos / multiGSEA

NOTE: This package has been renamed to sparrow and will be submitted to Bioconductor 3.14. Please use that package instead. This is kept here for posterity.
https://lianos.github.io/multiGSEA/
MIT License
21 stars 2 forks source link

Hard to debug error #3

Closed mukhyala closed 6 years ago

mukhyala commented 6 years ago

Hi Steve,

We deployed the in-house shiny app for multiGSEA (EPMultiGSEA) on R 3.4.3 / Bioc 3.6 and the app started crashing with a stack trace pointing at multiGSEA (see below) - ` Listening on http://127.0.0.1:53405

Warning: Error in [.data.frame: undefined columns selected Stack trace (innermost first): 98: [.data.frame 97: [ 96: mode 95: attr.all.equal 94: all.equal.character 93: all.equal 92: isTRUE 91: eval [/tmp/RtmpXPJG27/file112f7100472ae/multiGSEA/R/MultiGSEAResult-methods.R#285] 90: eval 89: eval 88: eval 87: eval.parent 86: local 85: result [/tmp/RtmpXPJG27/file112f7100472ae/multiGSEA/R/MultiGSEAResult-methods.R#283] 84: FUN [/tmp/RtmpXPJG27/file112f7100472ae/multiGSEA/R/MultiGSEAResult-methods.R#391] 83: lapply 82: tabulateResults [/tmp/RtmpXPJG27/file112f7100472ae/multiGSEA/R/MultiGSEAResult-methods.R#390] 81: summaryHTMLTable.multiGSEA [/tmp/RtmpXPJG27/file112f7100472ae/multiGSEA/R/shiny-utils.R#253] 80: tagList `

Its been hard to debug for me so far. Any ideas what's going on or how best to debug further? Thanks!

lianos commented 6 years ago

This will be a bit hard to debug "from the outside" without some example data, but the first thing it seems you need to do is update the versions of mulitGSEA you are depending on. There is no shiny-utils.R file in the multiGSEA package anymore. All of the shiny stuff has been moved to the multiGSEA.shiny package.

You can use the following commands to update to the latest packages:

library(remotes)
install_github("lianos/multiGSEA")
install_github("lianos/multiGSEA.shiny")
install_github("lianos/GeneSetDb.MSigDB.Hsapiens.v61")
install_github("lianos/GeneSetDb.MSigDB.Mmusculus.v61")

and then try again?

After you do that. If you are still getting an error, please let me know if this error is happening when the application simply starts up, or when you direct it to load a MultiGSEAResult on startup. Depending on what has changed in the EP version of the app, you should be able to load the shiny app without having it try to load a MultiGSEAResult at startup by not providing any of the GET url parameters.

Once that loads OK, you can just upload a result into the application to explore.

If the error is happening when you try to load a MultiGSEAResult object (which I suspect), could you try to create a new MultiGSEAResult object with the latest multiGSEA stack and try to view that one just to test your application.

Recall that given a MultiGSEAResult object named mg, you can fire up a "local" shiny app to explore it within your R session by:

library(multiGSEA.shiny)
explore(mg)

That will test "the bits" that I'm responsible for (ie. the non-Genentech specific parts). So after you upgrade to the latest versions of the packages, just try that first in an R session using the MultiGSEAResult object that is currently giving you problems.

If that works, your EP version of the app should work as it should simply be reusing the shiny modules provided by the multiGSEA.shiny package (with a few tweaks for URL parsing and re-routing it's load function on startup to get results off of the rescomp file system).

If after all that you are still having problems with some MultiGSEAResult object, could you please provide some more details and, perhaps, send me over the offending object (after you bluesheet it, of course ;-)

mukhyala commented 6 years ago

Thanks Steve! I've made some progress. There were multiple issues happening.

After a fresh install and deploy,


I am now faced with another error:

`Listening on http://127.0.0.1:50053

Warning in origRenderFunc() : Ignoring explicitly provided widget ID "3955582a95f3"; Shiny doesn't use them Warning in origRenderFunc() : Ignoring explicitly provided widget ID "3955408f13b7"; Shiny doesn't use them Warning: Error in : is(x, "data.table") is not TRUE Stack trace (innermost first): 84: stopifnot 83: renderFeatureStatsDataTable 82: exprFunc [/gnet/truncated.../multiGSEA/ShinyExpressionPlotMultiGSEA/shiny/server.R#104] 81: widgetFunc 80: func 79: origRenderFunc 78: renderFunc 77: origRenderFunc 76: output$dge_volcano_genestats 1: runApp `

lianos commented 6 years ago

I'm happy to hear that you folks have been able to make some progress.

Still, what I need to know is if this is happening because of something in multiGSEA.shiny (which I can do something about) or only in ShinyExpressionPlotMultiGSEA (which I can't).

Can you please get something like the following code to work with the MultiGSEAResult object that you are trying to explore?

library(multiGSEA)
library(multiGSEA.shiny)
mg <- readRDS("path/to/the/MultiGSEAResultObject.rds")
explore(mg)

Does that work? If not, and you'd like me to help, you will need to find a way to send me the MultiGSEAResultObject.rds binary object.

Note that there was a "recently" (since last the EP multiGSEA stuff was updated) large change in the multiGSEA codebase where functions that returned data.frame-like things now include an as.dt = FALSE argument. If the caller wants to return a data.table, they must explicitly set as.dt = TRUE.

Previously the package relied on an option(multiGSEA.df.return = "data.table") (or some similarly named options) to have some global behavior over the data.frame-like things that multiGSEA functions returned.

It might be that something is expecting a data.table but is being returned a data.frame because it's not setting as.dt = TRUE on some function all (the as.dt parameter defaults to FALSE everywhere in the codebase).

That having been said, all of the bits inside multiGSEA and multiGSEA.shiny handle these things correctly after this change happened. I "know" this because the updated versions of multiGSEA have been used inside "facile" for a long time, and I continue to use them even now @ Denali.

Which leads me to the start: it feels like this is some issue inside ShinyExpressionPlotMultiGSEA ... so please try and test this idea by just invoking the multiGSEA.shiny::explore function on the MultiGSEAResult object you are trying to get ShinyExpressionPlotMultiGSEA to load.

mukhyala commented 6 years ago

Yes, you are right on every count - the issue was in fix.collection.counts in ShinyExpressionPlotMultiGSEA.

Replacing this - `

cm <- collectionMetadata(object, .external=FALSE)[name != 'count'] cnts <- geneSets(object, active.only=FALSE, .external=FALSE)[, {

with this-

meta.data=collectionMetadata(object) cm=meta.data[meta.data$name != 'count',] cnts <- geneSets(object, active.only=FALSE, .external=FALSE, as.dt=TRUE)[, { ` Fixed the problem.


On to the next issue: the Diffex tab displayed an error:

is(x, "data.table") is not TRUE

thanks to your tips again was a simple find mg functions and add as.dt=T. lfc <- reactive({ req(mgc()$mg) %>% logFC(as.dt = TRUE) %>% arrange(desc(logFC)) })

lianos commented 6 years ago

Fantastic. I'll close this issue, then ;-)