roblanf / sangeranalyseR

functions to analyse sanger sequencing reads in R
MIT License
96 stars 24 forks source link

Failure to generate html report #80

Closed somakchowdhury closed 2 years ago

somakchowdhury commented 2 years ago

I am running into the following error when I run the reproducible example.

What am I doing wrong? Could you help?

sangeranalyseR command used : generateReport(ACHLO_contigs, includeSangerContig=TRUE, includeSangerRead=TRUE, outputDir = "./report/")

Error thrown: File ./Chromatogram.pdf not found in resource path Error: pandoc document conversion failed with error 99

Session Info:

 > sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

other attached packages:
 [1] sangeranalyseR_1.1.2  sangerseqR_1.30.0     logger_0.2.2          BiocStyle_2.22.0     
 [5] seqinr_4.2-8          kableExtra_1.3.4      rmarkdown_2.11        openxlsx_4.2.5       
 [9] shinyWidgets_0.6.2    ggdendro_0.1.22       shinycssloaders_1.0.0 excelR_0.4.0         
[13] zeallot_0.1.0         DT_0.20               plotly_4.10.0         ggplot2_3.3.5        
[17] data.table_1.14.2     shinyjs_2.0.0         shinydashboard_0.7.2  shiny_1.7.1          
[21] gridExtra_2.3         phangorn_2.8.1        reshape2_1.4.4        DECIPHER_2.22.0      
[25] RSQLite_2.2.9         Biostrings_2.62.0     GenomeInfoDb_1.30.0   XVector_0.34.0       
[29] IRanges_2.28.0        S4Vectors_0.32.3      BiocGenerics_0.40.0   ape_5.5              
[33] stringr_1.4.0        

loaded via a namespace (and not attached):
 [1] colorspace_2.0-2       ellipsis_0.3.2         rstudioapi_0.13        farver_2.1.0          
 [5] remotes_2.4.2          bit64_4.0.5            fansi_0.5.0            xml2_1.3.3            
 [9] codetools_0.2-18       cachem_1.0.6           knitr_1.37             ade4_1.7-18           
[13] jsonlite_1.7.2         BiocManager_1.30.16    compiler_4.1.2         httr_1.4.2            
[17] assertthat_0.2.1       Matrix_1.3-4           fastmap_1.1.0          lazyeval_0.2.2        
[21] later_1.3.0            htmltools_0.5.2        igraph_1.2.9           gtable_0.3.0          
[25] glue_1.6.0             GenomeInfoDbData_1.2.7 dplyr_1.0.7            fastmatch_1.1-3       
[29] Rcpp_1.0.7             jquerylib_0.1.4        vctrs_0.3.8            svglite_2.0.0         
[33] nlme_3.1-153           crosstalk_1.2.0        xfun_0.27              rvest_1.0.2           
[37] mime_0.12              lifecycle_1.0.1        zlibbioc_1.40.0        MASS_7.3-54           
[41] scales_1.1.1           promises_1.2.0.1       curl_4.3.2             yaml_2.2.1            
[45] memoise_2.0.1          sass_0.4.0             stringi_1.7.5          zip_2.2.0             
[49] rlang_0.4.12           pkgconfig_2.0.3        systemfonts_1.0.3      bitops_1.0-7          
[53] fontawesome_0.2.2      evaluate_0.14          lattice_0.20-45        purrr_0.3.4           
[57] labeling_0.4.2         htmlwidgets_1.5.4      bit_4.0.4              tidyselect_1.1.1      
[61] plyr_1.8.6             magrittr_2.0.1         R6_2.5.1               generics_0.1.1        
[65] DBI_1.1.1              pillar_1.6.4           withr_2.4.3            RCurl_1.98-1.5        
[69] tibble_3.1.6           crayon_1.4.2           utf8_1.2.2             grid_4.1.2            
[73] blob_1.2.2             digest_0.6.28          webshot_0.5.2          xtable_1.8-4          
[77] tidyr_1.1.4            httpuv_1.6.4           munsell_0.5.0          viridisLite_0.4.0     
[81] bslib_0.3.1            quadprog_1.5-8
JanEngelstaedter commented 2 years ago

I've had exactly the same error, on MacOS Big Sur.

roblanf commented 2 years ago

Sorry for the slow replies guys, and for the issue. @Kuanhao-Chao and I will take a look ASAP.

Kuanhao-Chao commented 2 years ago

Hi @somakchowdhury and @JanEngelstaedter,

Sorry for the slow replies. I just tested with the example dataset with outputDir = "./report/", and it worked. The error message you got shows that the './Chromatogram.pdf' is either not created or placed in the wrong path. I could not reproduce your error so I am not sure what happened. I am running on MacOS Big Sur as well.

Could you help me test if you can generate the report in SangerRead & SangerContig levels? For example,

  1. generateReport(ACHLO_contigs@contigList[[1]], includeSangerContig=TRUE, includeSangerRead=TRUE, outputDir = "./report/")

  2. generateReport(ACHLO_contigs@contigList[[1]]@forwardReadList[[1]], includeSangerContig=TRUE, includeSangerRead=TRUE, outputDir = "./report/")

Let me know whether you still encounter the same error. And if it's okay, Could you send me your data so that I can test sangeranalyseR? Thanks!

Best, Kuan-Hao

JanEngelstaedter commented 2 years ago

Thanks Kuan-Hao! I've tried your example and got the same error. Everything else (processing files, shiny app, writing fasta files) works fine, so I don't think the data is the problem. Judging from the output, it looks like the Rmd file is knitted without any issues, and the chromatogram.pdf is produced and saved where it's supposed to be saved. However, I suspect that the md file is written in another folder outside of the project (perhaps within some package folder?), and that's why pandoc fails to produce the html file? I tried to find the SangerRead_Report_ab1.knit.md file on my hard drive but couldn't find it anywhere. Hope this helps finding the bug. It's a great package, thanks a lot for writing it!

somakchowdhury commented 2 years ago

When running generateReport(ACHLO_contigs@contigList[[1]], includeSangerContig=TRUE, includeSangerRead=TRUE, outputDir = "./report/")

I again get the following error:


/usr/lib/rstudio/bin/pandoc/pandoc +RTS -K512m -RTS SangerRead_Report_ab1.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /home/bioithimedia/Documents/Sanger/report/Achl_ACHLO006-09/Achl_ACHLO006-09_1_F/SangerRead_Report_ab1.html --lua-filter /home/bioithimedia/R/x86_64-pc-linux-gnu-library/4.1/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /home/bioithimedia/R/x86_64-pc-linux-gnu-library/4.1/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --standalone --section-divs --table-of-contents --toc-depth 3 --variable toc_float=1 --variable toc_selectors=h1,h2,h3 --variable toc_collapsed=1 --variable toc_smooth_scroll=1 --variable toc_print=1 --template /home/bioithimedia/R/x86_64-pc-linux-gnu-library/4.1/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --include-in-header /tmp/RtmpHxMjw5/rmarkdown-str13a0252299b6.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' 
File ./Chromatogram.pdf not found in resource path
Error: pandoc document conversion failed with error 99

When I run this one : generateReport(ACHLO_contigs@contigList[[1]]@forwardReadList[[1]], includeSangerContig=TRUE, includeSangerRead=TRUE, outputDir = "./report/")

I still get the same error:


/usr/lib/rstudio/bin/pandoc/pandoc +RTS -K512m -RTS SangerRead_Report_ab1.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output /home/bioithimedia/Documents/Sanger/report/Achl_ACHLO006-09_1_F/SangerRead_Report_ab1.html --lua-filter /home/bioithimedia/R/x86_64-pc-linux-gnu-library/4.1/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /home/bioithimedia/R/x86_64-pc-linux-gnu-library/4.1/rmarkdown/rmarkdown/lua/latex-div.lua --self-contained --variable bs3=TRUE --standalone --section-divs --table-of-contents --toc-depth 3 --variable toc_float=1 --variable toc_selectors=h1,h2,h3 --variable toc_collapsed=1 --variable toc_smooth_scroll=1 --variable toc_print=1 --template /home/bioithimedia/R/x86_64-pc-linux-gnu-library/4.1/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --include-in-header /tmp/RtmpHxMjw5/rmarkdown-str13a058ae12ca.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' 
File ./Chromatogram.pdf not found in resource path
Error: pandoc document conversion failed with error 99

Seems like there seems to be dependency problem with some of the components of the report in a way that they dont appear in the same directory or outside the report folder. Here is the folder structure created by both the commands

report/
|-- Achl_ACHLO006-09
|   -- Achl_ACHLO006-09_1_F
|       -- Chromatogram.pdf
-- Achl_ACHLO006-09_1_F
    -- Chromatogram.pdf

I hope this is helpful to debug this. Agree with Jan that this is an invaluable tool and very useful.

Kuanhao-Chao commented 2 years ago

Hi @JanEngelstaedter @somakchowdhury,

I think I've fixed the bug. Could you please help us test whether it works for you now? You can download the lastest sangeranalyseR version by running:

library(devtools)

## Install the release version
install_github("roblanf/sangeranalyseR", ref = "master")
library(sangeranalyseR)

Every 6 months Bioconductor requests developers to upgrade to the new R version, and every time there will be some packages that sangeranalyseR depends on change the exception handling and it causes some functions to crash. Thank you for your bug report!! If you have any problems, please let us know 👍🏼

Best, Kuan-Hao

somakchowdhury commented 2 years ago

@Kuanhao-Chao Thanks for the prompt response. After installing the latest version the report is generated as expected seems there is a need to keep an eye out for R updates I guess.

One more question I had was about the signal signalRatioCutoff value. Is it possible to ask the program when constructing contig to ignore secondary peaks and only call the bases called in the primary peak?

Thanks again for solving this.

Cheers, Somak

JanEngelstaedter commented 2 years ago

Yes, problem solved for me as well - thanks for fixing this so swiftly! Cheers, Jan

Kuanhao-Chao commented 2 years ago

Hi @somakchowdhury ,

signalRatioCutoff controls the ratio of the height of a secondary peak to a primary peak. Secondary peaks higher than this ratio are annotated. Those below the ratio are excluded. The default value is 0.33.

So changing this value does not affect the result of primary sequence. It only changes the secondary sequence.

Best wishes, Kuan-Hao

roblanf commented 2 years ago

Just adding here what I think might be an answer to this question (@Kuanhao-Chao can you tell me if I'm right?):

Is it possible to ask the program when constructing contig to ignore secondary peaks and only call the bases called in the primary peak?

If you set the signalRatioCutoff to 1.1, then presumably it's impossible to get a secondary peak that high, so secondary peaks will be ignored completely. What I'm unsure of is whether we force signalRatioCutoff to be <=1.0. If that's the case, then it's possible that we could have two equal peaks.

Either way, perhaps we should add an option to ignoreSecondaryPeaks, which would do this in a more intuitive way?

@Kuanhao-Chao, what do you think? If we go that route, I'll start a separate issue.

Kuanhao-Chao commented 2 years ago

Hi @roblanf

Sorry for the late reply. I didn't get the notification and just saw the message! In the current released sangeranalyseR parameter sanity check, signalRatioCutoff must be between 0 and 1, not equal ( signalRatioCutoff < 0 || signalRatioCutoff > 1) because I assume the secondary peaks must be lower than the primary peaks. Should we allow the equal case (0 and 1)?

Adding ignoreSecondaryPeaks sounds like a good idea! If we are going to add this option, I also need to fix UI to handle the NULL case, and it may take some time to add this feature

Best, Kuan-Hao

roblanf commented 2 years ago

I think it's probably good enough to just allow signalRatioCutoff to equal 1. In this case, that is effectively the same as having a completely separate parameter for ignoreSecondaryPeaks.

But it looks like your sanity check already allows this: signalRatioCutoff < 0 || signalRatioCutoff > 1)

would only return an error if the parameter was larger than one. Can you confirm?

Kuanhao-Chao commented 2 years ago

Oh yes! I interpreted it wrong yesterday! The current released version allows 0 and 1 cases for signalRatioCutoff. Sorry to cause the confusion. 👍