Contents

1 Description

This vignettes will guide you throught a tipycal usage of the easyreporting package, while performing a simplified bioinformatics analysis workflow.

2 Requirements

For the usage you just need to load the easyreporting package, which will load the rmarkdown and tools 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 paramenter is optional.

Once created the easyreporting class instance, we can use it into 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")
bioEr <- easyreporting(filenamePath=proj.path, title="bioinfo_report",
                        author=c("Dario Righelli"))

4 Loading Data

For this vignette we previously downloaded an xlsx table from GEO with accession number GSE134118.

For importing the xls file, we prepared an ad-hoc function called importData stored in the importFunctions.R file.

mkdTitle(bioEr, title="Loading Counts Data")
mkdCodeChunkComplete(object=bioEr, message=paste0("geneCounts <- importData(sy",
        "stem.file('extdata/GSE134118_Table_S3.xlsx',",
        "package='easyreporting'))"), 
        sourceFilesList=system.file("script/importFunctions.R", 
                                            package="easyreporting"))

5 Counts exploration

In order to explore the counts we can perform a PCA with plotPCA function within the EDASeq package. To trace this step we again use a mkdCodeChunkComplete function, inserting the function call as the message to track.

mkdTitle(bioEr, title="Plot PCA on count data", level=2)
mkdCodeChunkComplete(bioEr, 
                        message="EDASeq::plotPCA(as.matrix(geneCounts))")

6 Differential expression

Let’s suppose we stored a function for applying edgeR on our counts in an R file. We called the file geneFunctions.R and the function applyEdgeRExample.

It will be easy for us to source the file and to call the function with a single call of easyreporting package. By aid of the mkdCodeChunkCommented function we can add a comment preceeding the code chunk.

mkdTitle(bioEr, "Differential Expression Analysis")
mkdCodeChunkCommented(bioEr, 
    codeMsg="degList <- applyEdgeRExample(counts=geneCounts, 
                    samples=colnames(geneCounts), contrast='Pleura - Broth')", 
    commentMsg=paste0("As we saw from the PCA, the groups are well separated",
        ", so we can perform a Differential Expression analysis with edgeR."),
    sourceFilesList=system.file("script/geneFunctions.R", 
                                package="easyreporting"))

6.1 Inspecting DEGs

Usually to have a graphical representation of the obtained results we can plot an MD plot by using the plotMD function of the limma package.

Also in this case, we create a new title and a new chunk within the function to call.

mkdTitle(bioEr, "MD Plot of DEGs", level=2)
mkdCodeChunkComplete(bioEr, message="limma::plotMD(degList$test)")

7 Compiling the report

Once finished our analysis it is possible to compile the produced rmarkdown report simply by using the compile method. The compile method appends a sessionInfo() to the report to trace all the packages and versions used for the analysis.

compile(bioEr)
#> 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/RtmpoutBho/rmarkdown-str5e824f61e3ed.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

8 Session Info

sessionInfo()
#> R Under development (unstable) (2020-01-28 r77731)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 18.04.3 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_0.99.17 BiocStyle_2.15.6     
#> 
#> loaded via a namespace (and not attached):
#>  [1] Biobase_2.47.2              httr_1.4.1                 
#>  [3] edgeR_3.29.0                bit64_0.9-7                
#>  [5] splines_4.0.0               R.utils_2.9.2              
#>  [7] assertthat_0.2.1            statmod_1.4.33             
#>  [9] askpass_1.1                 BiocManager_1.30.10        
#> [11] stats4_4.0.0                aroma.light_3.17.1         
#> [13] BiocFileCache_1.11.4        latticeExtra_0.6-29        
#> [15] blob_1.2.1                  GenomeInfoDbData_1.2.2     
#> [17] cellranger_1.1.0            Rsamtools_2.3.4            
#> [19] yaml_2.2.1                  progress_1.2.2             
#> [21] pillar_1.4.3                RSQLite_2.2.0              
#> [23] lattice_0.20-38             limma_3.43.3               
#> [25] glue_1.3.1                  digest_0.6.24              
#> [27] GenomicRanges_1.39.2        RColorBrewer_1.1-2         
#> [29] XVector_0.27.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.45.3            biomaRt_2.43.3             
#> [37] magick_2.3                  genefilter_1.69.0          
#> [39] bookdown_0.17               zlibbioc_1.33.1            
#> [41] purrr_0.3.3                 xtable_1.8-4               
#> [43] jpeg_0.1-8.1                BiocParallel_1.21.2        
#> [45] tibble_2.1.3                openssl_1.4.1              
#> [47] annotate_1.65.1             IRanges_2.21.3             
#> [49] SummarizedExperiment_1.17.1 GenomicFeatures_1.39.4     
#> [51] BiocGenerics_0.33.0         survival_3.1-8             
#> [53] magrittr_1.5                crayon_1.3.4               
#> [55] readxl_1.3.1                memoise_1.1.0              
#> [57] evaluate_0.14               R.methodsS3_1.7.1          
#> [59] hwriter_1.3.2               tools_4.0.0                
#> [61] prettyunits_1.1.1           hms_0.5.3                  
#> [63] matrixStats_0.55.0          stringr_1.4.0              
#> [65] S4Vectors_0.25.12           locfit_1.5-9.1             
#> [67] DelayedArray_0.13.3         AnnotationDbi_1.49.1       
#> [69] Biostrings_2.55.4           compiler_4.0.0             
#> [71] DESeq_1.39.0                GenomeInfoDb_1.23.13       
#> [73] rlang_0.4.4                 grid_4.0.0                 
#> [75] RCurl_1.98-1.1              rappdirs_0.3.1             
#> [77] bitops_1.0-6                rmarkdown_2.1              
#> [79] codetools_0.2-16            curl_4.3                   
#> [81] DBI_1.1.0                   EDASeq_2.21.0              
#> [83] R6_2.4.1                    GenomicAlignments_1.23.1   
#> [85] rtracklayer_1.47.0          knitr_1.28                 
#> [87] dplyr_0.8.4                 bit_1.1-15.2               
#> [89] stringi_1.4.5               parallel_4.0.0             
#> [91] Rcpp_1.0.3                  png_0.1-7                  
#> [93] vctrs_0.2.2                 geneplotter_1.65.0         
#> [95] tidyselect_1.0.0            dbplyr_1.4.2               
#> [97] xfun_0.12