matthewhirschey / ddh.org

datadrivenhypothesis.org is a resource to query 100+ GB of raw biological science data to develop data-driven hypotheses
2 stars 7 forks source link

'gene_symbol not found' #86

Closed matthewhirschey closed 4 years ago

matthewhirschey commented 4 years ago

gene_symbol does not appear to be dynamically set. I sometimes code gene_symbol as a hard value to work on functions outside of the shiny app. I recently cleared my environment, and now have this error. Not sure which code you or I wrote to break it (TBH, it was me), but want to kick it over to you to see if you have any ideas.

Screencast explaining the error here

matthewhirschey commented 4 years ago

Related to gene_symbol, it seems that setting a hard value just allows the app to load, but gene_symbol can still be dynamically set with data(). I'm not sure which function (in Shiny or out) is looking for gene_symbol to exist, and if not, then halt.

*I just pushed all my changes to pathways thus far, so give a pull to see them.

johnbradley commented 4 years ago

R is just printing an error message without any context.

Error in eval(ei, envir) : object 'gene_symbol' not found

I find this really frustrating. Usually I see a stack trace to tell me where the problem is. I did find a traceback function that seems to print out where things went wrong. Here is my r console from running the app then using traceback:

> shiny::runApp('code')
Loading required package: shiny
...
Loading required package: ggpolypath
Error in eval(ei, envir) : object 'gene_symbol' not found
> traceback(max.lines=10)
12: eval(ei, envir)
11: eval(ei, envir)
10: withVisible(eval(ei, envir))
9: source(here::here("code", "fun_graphs.R"))
8: ..stacktraceon..({
       library(shiny)
       library(shinyWidgets)
       library(tidyverse)
       library(plotly)
       library(networkD3)
       library(corrr)
       library(here)
       library(lubridate)
       library(rmarkdown)
    ...
7: eval(exprs, envir)
6: eval(exprs, envir)
5: sourceUTF8(fullpath, envir = new.env(parent = sharedEnv))
4: func(fname, ...)
3: appObj()
2: appParts$onStart()
1: shiny::runApp("code")

I set max.lines to 10 to reduce the volume of data traceback is printing, but you may want to leave this off in practice.

The above pointed me towards a problem in fun_graphs.R.

I think this line is our problem: https://github.com/matthewhirschey/ddh/blob/9c711d69394a541061591402a834a6af95e189af/code/fun_graphs.R#L199 We are using a global variable gene_symbol that is not defined.

I'm wondering if there is a configuration setting we could turn on to automatically print stack traces.

matthewhirschey commented 4 years ago

Ah. Thanks for your help. I'll change it to be "just text" and figure out if I need the logic later. Appreciate it!

And yes, I'm no bug squasher, but the error messages are not helpful.