openbiox / UCSCXenaShiny

📊 An R package for interactively exploring UCSC Xena https://xenabrowser.net/datapages/; Book: https://lishensuo.github.io/UCSCXenaShiny_Book; App online: https://shiny.hiplot.cn/ucsc-xena-shiny/, https://shiny.zhoulab.ac.cn/UCSCXenaShiny
https://openbiox.github.io/UCSCXenaShiny/
GNU General Public License v3.0
96 stars 31 forks source link

optimize #323

Closed ShixiangWang closed 4 months ago

ShixiangWang commented 7 months ago

https://github.com/openbiox/UCSCXenaShiny/blob/447e580803a0fa11ceb8f9f52f631dd92d570d9e/inst/shinyapp/modules/07_PharmacoGenomics/FeatureDatabaseSig_singlethread.R#L140-L329

ShixiangWang commented 4 months ago

尝试用 llply 的并行替换 lapply,但失败了。目前 progress 内部的代码复杂度高,除非把逻辑和 shiny 完全隔离,不然很难优化,问题也不好 debug。 @lishensuo 这一块以后再说吧,尽量不让他影响其他 shiny 模块就行。

Preprocessing drug omics data...
Using library: /Users/wsx/Library/R
Using library: /Users/wsx/Library/R
Using library: /Users/wsx/Library/R
Using library: /Users/wsx/Library/R
Done for loading data and modules.
Warning: Error in summary.connection: invalid connection
  158: h
  157: .handleSimpleError
  156: summary.connection
  155: summary
  154: serialize
  153: sendData.SOCKnode
  152: sendData
  151: postNode
  150: sendCall
  149: clusterCall
  148: e$fun
  147: foreach::`%dopar%`
  146: plyr::llply
  145: eval [/Users/wsx/Documents/GitHub/UCSCXenaShiny/inst/shinyapp/modules/07_PharmacoGenomics/FeatureDatabaseSig_singlethread.R#173]
  144: eval
  143: withProgress
  142: <reactive:re_list> [/Users/wsx/Documents/GitHub/UCSCXenaShiny/inst/shinyapp/modules/07_PharmacoGenomics/FeatureDatabaseSig_singlethread.R#140]
  141: ..stacktraceon..
  140: .func
  139: withVisible
  138: withCallingHandlers
  137: contextFunc
  136: env$runWith
  135: force
  134: domain$wrapSync
  133: promises::with_promise_domain
  132: withReactiveDomain
  131: domain$wrapSync
  130: promises::with_promise_domain
  129: ctx$run
  128: self$.updateValue
  127: ..stacktraceoff..
  126: re_list
  125: plyr::llply
  124: <reactive:re_list2> [/Users/wsx/Documents/GitHub/UCSCXenaShiny/inst/shinyapp/modules/07_PharmacoGenomics/FeatureDatabaseSig_singlethread.R#336]
  123: ..stacktraceon..
  122: .func
  121: withVisible
  120: withCallingHandlers
  119: contextFunc
  118: env$runWith
  117: force
  116: domain$wrapSync
  115: promises::with_promise_domain
  114: withReactiveDomain
  113: domain$wrapSync
  112: promises::with_promise_domain
  111: ctx$run
  110: self$.updateValue
  109: ..stacktraceoff..
  108: re_list2
  107: lapply [/Users/wsx/Documents/GitHub/UCSCXenaShiny/inst/shinyapp/modules/07_PharmacoGenomics/FeatureDatabaseSig_singlethread.R#344]
  106: exprFunc [/Users/wsx/Documents/GitHub/UCSCXenaShiny/inst/shinyapp/modules/07_PharmacoGenomics/FeatureDatabaseSig_singlethread.R#344]
  105: widgetFunc
  104: ::
htmlwidgets
shinyRenderWidget
  103: func
  102: force
  101: withVisible
  100: withCallingHandlers
   99: domain$wrapSync
   98: promises::with_promise_domain
   97: captureStackTraces
   96: doTryCatch
   95: tryCatchOne
   94: tryCatchList
   93: tryCatch
   92: do
   91: hybrid_chain
   90: renderFunc
   89: renderFunc
   88: force
   87: domain$wrapSync
   86: promises::with_promise_domain
   85: renderFunc
   84: output$FeatureDatabaseSig-freq_table
   83: ..stacktraceon..
   82: orig
   81: func
   80: withCallingHandlers
   79: domain$wrapSync
   78: promises::with_promise_domain
   77: captureStackTraces
   76: withCallingHandlers
   75: shinyCallingHandlers
   74: force
   73: domain$wrapSync
   72: promises::with_promise_domain
   71: private$withCurrentOutput
   70: force
   69: withVisible
   68: withCallingHandlers
   67: domain$wrapSync
   66: promises::with_promise_domain
   65: captureStackTraces
   64: doTryCatch
   63: tryCatchOne
   62: tryCatchList
   61: tryCatch
   60: do
   59: hybrid_chain
   58: force
   57: withVisible
   56: withCallingHandlers
   55: domain$wrapSync
   54: promises::with_promise_domain
   53: captureStackTraces
   52: doTryCatch
   51: tryCatchOne
   50: tryCatchList
   49: tryCatch
   48: do
   47: hybrid_chain
   46: observe
   45: <observer:output$FeatureDatabaseSig-freq_table>
   44: contextFunc
   43: env$runWith
   42: force
   41: domain$wrapSync
   40: promises::with_promise_domain
   39: withReactiveDomain
   38: domain$wrapSync
   37: promises::with_promise_domain
   36: ctx$run
   35: run
   34: withCallingHandlers
   33: domain$wrapSync
   32: promises::with_promise_domain
   31: captureStackTraces
   30: withCallingHandlers
   29: shinyCallingHandlers
   28: force
   27: withVisible
   26: withCallingHandlers
   25: domain$wrapSync
   24: promises::with_promise_domain
   23: captureStackTraces
   22: doTryCatch
   21: tryCatchOne
   20: tryCatchList
   19: tryCatch
   18: do
   17: hybrid_chain
   16: flushCallback
   15: FUN
   14: lapply
   13: ctx$executeFlushCallbacks
   12: .getReactiveEnvironment()$flush
   11: flushReact
   10: serviceApp
    9: ..stacktracefloor..
    8: withCallingHandlers
    7: domain$wrapSync
    6: promises::with_promise_domain
    5: captureStackTraces
    4: ..stacktraceoff..
    3: runApp
    2: print.shiny.appobj
    1: <Anonymous>