Contents

1 Description

This vignettes will guide the user in the exploration of the functionalities of easyreporting.

2 Requirements

For the usage you just need to load the easyreporting package, which will load the R6 and rmarkdown packages.

if(!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install("easyreporting")
library("easyreporting")

3 easyreporting instance creation

For simplicity we setup a project directory path starting from the working directory for our report, but you can just enter any path. The filenamepath and the title parameters are mandatory, while the author(s) paramenter is optional.

Once created the easyreporting class instance, we can use it in our further code to make other operations. It stores some variables for us, in order to not be called again during next opreations. For example the name and the path of the report, the type of report and the general rmarkdown options of the document.

proj.path <- file.path(tempdir(), "bioinfo_report")
er <- easyreporting(filenamePath=proj.path, title="example_report",
                        author=c("Dario Righelli"))

4 Code Chunks

Easyreporting enables to include rmarkdown titles from first (default) to sixth level. The good norm, when writing reports, is always to add a title to a new code chunk (CC) followed by a natural language text, which describes the CC.

mkdTitle(er, title="Code Chunks", level=1)

mkdGeneralMsg(er, "A simple paragraph useful to describe my code chunk...")

4.1 Manually creating a code chunk

The most mechanical way to create and populate a CC is to manually open the CC, to insert the code, and then to close it. Here we show how to insert a variable assignenent inside a CC.

mkdTitle(er, title="Manual code chunk", level=2)

mkdCodeChunkSt(er)
#> Please remember to close the Code Chunk!
#> Just invoke mkdCodeChunkEnd() once you complete your function calling :)
variable <- 1
mkdVariableAssignment(er, "variable", `variable`, show=TRUE)
mkdCodeChunkEnd(er)

4.2 Code Chunks Options

By using the standard function makeOptionsList, it is possible to create a custom list of options (an optionsList), as described from rmarkdown. In this way we are able to personalize even single code chunks, depending on specific cases.

Here we create an optionsList where the includeFlag is set to TRUE (our default is FALSE).

When opening the code chunk, it is possible to pass the new optionsList to the easyreporting class mkdCodeChunkSt method.

optList <- makeOptionsList(echoFlag=TRUE, includeFlag=TRUE)
mkdCodeChunkSt(er, optionList=optList)
#> Please remember to close the Code Chunk!
#> Just invoke mkdCodeChunkEnd() once you complete your function calling :)
mkdCodeChunkEnd(er)

4.3 Adding personal files to source

If you have one or more files with some functions that you want to use inside your code, it is possible to add them by using the sourceFilesList parameter.

## moreover I can add a list of files to source in che code chunk
RFilesList <- list.files(system.file("script", package="easyreporting"), 
                        full.names=TRUE)
mkdCodeChunkSt(er, optionList=optList, sourceFilesList=RFilesList)
#> Please remember to close the Code Chunk!
#> Just invoke mkdCodeChunkEnd() once you complete your function calling :)
mkdGeneralMsg(er, message="v <- fakeFunction(10)")
mkdCodeChunkEnd(er)

4.4 Complete chunk creation

It is also possible to create a complete chunk by using the mkdCodeChunkComplete function.

mkdCodeChunkComplete(er, message="v <- fakeFunction(11)")

Finally, it is possible to create a unique code chunk within all the functionalities desribed before.

optList <- makeOptionsList(includeFlag=TRUE, cacheFlag=TRUE)

mkdCodeChunkCommented(er, 
                commentMsg="This is the comment of the following code chunk",
                codeMsg="v <- fakeFunction(12)",
                optionList=optList,
                sourceFilesList=NULL)

5 Compiling

compile(er)
#> processing file: bioinfo_report.Rmd
#> output file: bioinfo_report.knit.md
#> /usr/bin/pandoc +RTS -K512m -RTS bioinfo_report.utf8.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash+smart --output bioinfo_report.html --email-obfuscation none --self-contained --standalone --section-divs --template /home/biocbuild/bbs-3.11-bioc/R/library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable 'theme:bootstrap' --include-in-header /tmp/Rtmp8ahaoS/rmarkdown-str15f8448363b4.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --lua-filter /home/biocbuild/bbs-3.11-bioc/R/library/rmarkdown/rmd/lua/pagebreak.lua --lua-filter /home/biocbuild/bbs-3.11-bioc/R/library/rmarkdown/rmd/lua/latex-div.lua
#> 
#> Output created: bioinfo_report.html

6 Session Info

sessionInfo()
#> R version 4.0.0 (2020-04-24)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 18.04.4 LTS
#> 
#> Matrix products: default
#> BLAS:   /home/biocbuild/bbs-3.11-bioc/R/lib/libRblas.so
#> LAPACK: /home/biocbuild/bbs-3.11-bioc/R/lib/libRlapack.so
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=C              
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] easyreporting_1.0.0 BiocStyle_2.16.0   
#> 
#> loaded via a namespace (and not attached):
#>  [1] Biobase_2.48.0              httr_1.4.1                 
#>  [3] edgeR_3.30.0                bit64_0.9-7                
#>  [5] splines_4.0.0               R.utils_2.9.2              
#>  [7] assertthat_0.2.1            statmod_1.4.34             
#>  [9] askpass_1.1                 BiocManager_1.30.10        
#> [11] stats4_4.0.0                aroma.light_3.18.0         
#> [13] BiocFileCache_1.12.0        latticeExtra_0.6-29        
#> [15] blob_1.2.1                  GenomeInfoDbData_1.2.3     
#> [17] cellranger_1.1.0            Rsamtools_2.4.0            
#> [19] yaml_2.2.1                  progress_1.2.2             
#> [21] pillar_1.4.3                RSQLite_2.2.0              
#> [23] lattice_0.20-41             limma_3.44.0               
#> [25] glue_1.4.0                  digest_0.6.25              
#> [27] GenomicRanges_1.40.0        RColorBrewer_1.1-2         
#> [29] XVector_0.28.0              htmltools_0.4.0            
#> [31] Matrix_1.2-18               R.oo_1.23.0                
#> [33] XML_3.99-0.3                pkgconfig_2.0.3            
#> [35] ShortRead_1.46.0            biomaRt_2.44.0             
#> [37] magick_2.3                  genefilter_1.70.0          
#> [39] bookdown_0.18               zlibbioc_1.34.0            
#> [41] purrr_0.3.4                 xtable_1.8-4               
#> [43] jpeg_0.1-8.1                BiocParallel_1.22.0        
#> [45] tibble_3.0.1                openssl_1.4.1              
#> [47] annotate_1.66.0             IRanges_2.22.0             
#> [49] ellipsis_0.3.0              SummarizedExperiment_1.18.0
#> [51] GenomicFeatures_1.40.0      BiocGenerics_0.34.0        
#> [53] survival_3.1-12             magrittr_1.5               
#> [55] crayon_1.3.4                readxl_1.3.1               
#> [57] memoise_1.1.0               evaluate_0.14              
#> [59] R.methodsS3_1.8.0           hwriter_1.3.2              
#> [61] tools_4.0.0                 prettyunits_1.1.1          
#> [63] hms_0.5.3                   lifecycle_0.2.0            
#> [65] matrixStats_0.56.0          stringr_1.4.0              
#> [67] S4Vectors_0.26.0            locfit_1.5-9.4             
#> [69] DelayedArray_0.14.0         AnnotationDbi_1.50.0       
#> [71] Biostrings_2.56.0           compiler_4.0.0             
#> [73] DESeq_1.40.0                GenomeInfoDb_1.24.0        
#> [75] rlang_0.4.5                 grid_4.0.0                 
#> [77] RCurl_1.98-1.2              rappdirs_0.3.1             
#> [79] bitops_1.0-6                rmarkdown_2.1              
#> [81] codetools_0.2-16            curl_4.3                   
#> [83] DBI_1.1.0                   EDASeq_2.22.0              
#> [85] R6_2.4.1                    GenomicAlignments_1.24.0   
#> [87] rtracklayer_1.48.0          knitr_1.28                 
#> [89] dplyr_0.8.5                 bit_1.1-15.2               
#> [91] stringi_1.4.6               parallel_4.0.0             
#> [93] Rcpp_1.0.4.6                png_0.1-7                  
#> [95] vctrs_0.2.4                 geneplotter_1.66.0         
#> [97] tidyselect_1.0.0            dbplyr_1.4.3               
#> [99] xfun_0.13