naikai / sake

sake
27 stars 12 forks source link

Error when running SAKE on Ting et al dataset #81

Open olivertam opened 3 years ago

olivertam commented 3 years ago

Hi,

We have encountered an error when processing the Ting et al. dataset through SAKE. Here are the parameters that we used:

When we run SAKE, it would crash after the estimation of k step.

Error message:

Compute NMF rank= 2  ... + measures ... OK
Compute NMF rank= 3  ... + measures ... OK
Compute NMF rank= 4  ... + measures ... OK
Compute NMF rank= 5  ... + measures ... OK
Compute NMF rank= 6  ... + measures ... OK
Compute NMF rank= 7  ... + measures ... OK

[1] "### Time to run NMF ###"
        user    system   elapsed
1740.328    106.687  441.518  

Warning: Error in h: error in evaluating the argument 'x' in selecting a method for function 'sort': error in evaluating the argument 'x' in selecting a method for function 'unique': Seems like you haven't run NMF 'real' run yet
  79: <Anonymous>
Warning: Error in h: error in evaluating the argument 'x' in selecting a method for function 'sort': error in evaluating the argument 'x' in selecting a method for function 'unique': Seems like you haven't run NMF 'real' run yet
  79: <Anonymous>

Traceback:

>traceback()
11: execCallbacks(timeoutSecs, all, loop$id)
10: run_now(timeoutMs/1000, all=FALSE)
9: service(timeout)
8: service(App)
7: ..stacktracefloor..(serviceApp())
6: withCallingHandlers(expr, error = doCaptureStack)
5: domain$wrapSync(expr)
4: promises::with_promise_domain(createStackTracePromiseDomain(),
              expr)
3: captureStackTraces({
              while (!.globals$stopped) {
                     ..stacktracefloor..(serviceApp())
               }
    })
2: ..slacktraceoff..(captureStackTraces({
              while (!.globals$stopped) {
                     ..stacktracefloor..(serviceApp())
               }
    })
1: shiny::runApp(system.file("sake", package="sake"))

SessionInfo:

R version 4.0.4 (2021-02-15)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7

attached base packages:
[1] tools     parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] doParallel_1.0.16    iterators_1.0.13     foreach_1.5.1        pathview_1.30.1     
 [5] gageData_2.28.0      gage_2.40.1          snowfall_1.84-6.1    snow_0.4-3          
 [9] matrixStats_0.58.0   RColorBrewer_1.1-2   AnnotationHub_2.22.0 BiocFileCache_1.14.0
[13] dbplyr_2.1.0         BiocParallel_1.24.1  biomaRt_2.46.3       corrplot_0.84       
[17] magrittr_2.0.1       data.table_1.14.0    DT_0.16              shinydashboard_0.6.1
[21] shinythemes_1.2.0    htmltools_0.5.0      d3heatmap_0.6.1      plotly_4.9.2        
[25] ggplot2_3.3.3        shinyBS_0.61         networkD3_0.4        sake_0.4.0          
[29] dplyr_1.0.5          NMF_0.30.1           Biobase_2.50.0       BiocGenerics_0.36.0 
[33] cluster_2.1.1        rngtools_1.5         pkgmaker_0.32.2.900  registry_0.5-1      
[37] shiny_1.5.0         

loaded via a namespace (and not attached):
  [1] backports_1.2.1               Hmisc_4.5-0                   plyr_1.8.6                   
  [4] igraph_1.2.6                  lazyeval_0.2.2                splines_4.0.4                
  [7] crosstalk_1.1.0.1             GenomeInfoDb_1.26.4           gridBase_0.4-7               
 [10] digest_0.6.27                 viridis_0.5.1                 GO.db_3.12.1                 
 [13] fansi_0.4.2                   checkmate_2.0.0               memoise_2.0.0                
 [16] limma_3.46.0                  fastcluster_1.1.25            Biostrings_2.58.0            
 [19] annotate_1.68.0               askpass_1.1                   prettyunits_1.1.1            
 [22] jpeg_0.1-8.1                  colorspace_2.0-0              blob_1.2.1                   
 [25] rappdirs_0.3.3                xfun_0.22                     crayon_1.4.1                 
 [28] RCurl_1.98-1.3                jsonlite_1.7.2                graph_1.68.0                 
 [31] genefilter_1.72.1             impute_1.64.0                 survival_3.2-10              
 [34] glue_1.4.2                    gtable_0.3.0                  zlibbioc_1.36.0              
 [37] XVector_0.30.0                DelayedArray_0.16.3           Rgraphviz_2.34.0             
 [40] scales_1.1.1                  DBI_1.1.1                     Rcpp_1.0.6                   
 [43] htmlTable_2.1.0               viridisLite_0.3.0             xtable_1.8-4                 
 [46] progress_1.2.2                foreign_0.8-81                bit_4.0.4                    
 [49] preprocessCore_1.52.1         Formula_1.2-4                 stats4_4.0.4                 
 [52] htmlwidgets_1.5.2             httr_1.4.2                    ellipsis_0.3.1               
 [55] farver_2.1.0                  pkgconfig_2.0.3               XML_3.99-0.6                 
 [58] nnet_7.3-15                   dynamicTreeCut_1.63-1         locfit_1.5-9.4               
 [61] utf8_1.2.1                    labeling_0.4.2                tidyselect_1.1.0             
 [64] rlang_0.4.10                  reshape2_1.4.4                later_1.1.0.1                
 [67] AnnotationDbi_1.52.0          munsell_0.5.0                 BiocVersion_3.12.0           
 [70] cachem_1.0.4                  generics_0.1.0                RSQLite_2.2.5                
 [73] stringr_1.4.0                 fastmap_1.1.0                 yaml_2.2.1                   
 [76] knitr_1.31                    org.Hs.eg.db_3.12.0           bit64_4.0.5                  
 [79] purrr_0.3.4                   KEGGREST_1.30.1               dendextend_1.14.0            
 [82] mime_0.10                     KEGGgraph_1.50.0              xml2_1.3.2                   
 [85] compiler_4.0.4                rstudioapi_0.13               curl_4.3                     
 [88] png_0.1-7                     interactiveDisplayBase_1.28.0 tibble_3.1.0                 
 [91] geneplotter_1.68.0            stringi_1.5.3                 lattice_0.20-41              
 [94] Matrix_1.3-2                  vctrs_0.3.7                   pillar_1.5.1                 
 [97] lifecycle_1.0.0               BiocManager_1.30.12           bitops_1.0-6                 
[100] httpuv_1.5.5                  GenomicRanges_1.42.0          latticeExtra_0.6-29          
[103] R6_2.5.0                      promises_1.1.1                gridExtra_2.3                
[106] IRanges_2.24.1                codetools_0.2-18              assertthat_0.2.1             
[109] SummarizedExperiment_1.20.0   openssl_1.4.3                 DESeq2_1.30.1                
[112] withr_2.4.1                   S4Vectors_0.28.1              GenomeInfoDbData_1.2.4       
[115] hms_1.0.0                     rpart_4.1-15                  grid_4.0.4                   
[118] tidyr_1.1.3                   MatrixGenerics_1.2.1          WGCNA_1.70-3                 
[121] base64enc_0.1-3  

Thanks for all your help.

ColeWunderlich commented 3 years ago

After investigation, this appears to be due to the following call:

choices = as.character(paste0("NMF", sort(unique(nmf_groups()$nmf_subtypes))))

Which occurs on lines 1809, 1814, 1984 of server.r

nmf_groups() can be found on line 698 of server.r. The "Seems like you haven't run NMF 'real' run yet" error appears to be coming from the call on line 700 which is part of nmf_groups()

need(class(nmf_res()) == "NMFfitX1", "Seems like you haven't run NMF 'real' run yet")

My guess is the current version of NMF is no longer returning an NMFfitX1 class, causing nmf_groups to fail. My current recommendation is to try downgrading the version of NMF to either 0.22.0 or 0.23.0 (not tested), both of which can be found on CRAN.

olivertam commented 3 years ago

Hi,

The same error is still present, even with NMF version 0.22.0:

Compute NMF rank= 2  ... + measures ... OK
Compute NMF rank= 3  ... + measures ... OK
Compute NMF rank= 4  ... + measures ... OK
Compute NMF rank= 5  ... + measures ... OK
Compute NMF rank= 6  ... + measures ... OK
Compute NMF rank= 7  ... + measures ... OK

[1] "### Time to run NMF ###"
        user    system   elapsed
  1703.171    74.646    414.704  

Warning: Error in h: error in evaluating the argument 'x' in selecting a method for function 'sort': error in evaluating the argument 'x' in selecting a method for function 'unique': Seems like you haven't run NMF 'real' run yet
  79: <Anonymous>
Warning: Error in h: error in evaluating the argument 'x' in selecting a method for function 'sort': error in evaluating the argument 'x' in selecting a method for function 'unique': Seems like you haven't run NMF 'real' run yet
  79: <Anonymous>

> installed.packages()["NMF", "Version"]
[1]. "0.22.0"

Thanks.

ColeWunderlich commented 3 years ago

Hey Oliver,

After thinking about this some more, I think my initial assumption that the problem was with the NMF package is wrong.

My current hunch is that the DESeq2 tab is being called immediately after NMF estimation is done running. The DESeq2 tab expects an NMFfitX1 class, which is only generated after a real NMF run (the estimation run generates anNMF.rank class). I believe this mismatch is what is causing the error. Normally, the DESeq2 tab shouldn't be activated until it is clicked on, which makes me suspect that an update/change in the newer versions of shiny and associated packages may be causing this change in behaviour.

It's a long shot, but a potential fix may be downgrading to the package versions I have in my currently working R3.6 installation:

shiny 1.4.0.2
shinydashboard 0.7.1
shinythemes 1.1.2

It's also possible, but unlikely, that the change occurred in sake itself. Downgrading sake may also help.

devtools::install_github("naikai/sake", ref="2d5a5cfe9e7d97b569a537f816dd5b8187a0fb8e")

devtools::install_github("naikai/sake", ref=”1f13232a31e5d99874e765fd358ee96061be6ae0”)

This will downgrade to this commit which closely matches the version I currently have working on R3.6.

Edit: Updated post to use a commit/version of SAKE without an install bug.

ColeWunderlich commented 3 years ago

Updated previous comment to use a version of sake without the install bug. The devtools::install_github() command should work now.

nickhir commented 2 years ago

I also encounter the exact same error message. @ColeWunderlich, I tried your suggestion and downgraded to R3.6.0 along with

shiny 1.4.0.2
shinydashboard 0.7.1
shinythemes 1.1.2

but the error remained. Any ideas what might be happening? Could you maybe post your full sessionInfo?