# Bio Pipeline Usage

# Description

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

# 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")

# 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(
                          person(given="Dario", family="Righelli",
                              email="fake_email@gmail.com",
                              comment=c(ORCID="ORCIDNUMBER",
                                        url="www.fakepersonalurl.com",
                                        affiliation="Institute of Applied Mathematics, CNR, Naples, IT",
                                        affiliation_url="www.fakeurl.com")),
                        person(given="Claudia", family="Angelini",
                        comment=c(ORCID="ORCIDNUMBER",
                                  url="www.fakepersonalurl.com",
                                  affiliation="Institute of Applied Mathematics, CNR, Naples, IT",
                                  affiliation_url="www.fakeurl.com"))
                        )
                      )

    #> Warning in person1(given = given[[i]], family = family[[i]], middle =
    #> middle[[i]], : Invalid ORCID iD: 'ORCIDNUMBER'.
    #> Warning in person1(given = given[[i]], family = family[[i]], middle =
    #> middle[[i]], : Invalid ORCID iD: 'ORCIDNUMBER'.

    #> Loading required package: distill

# 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, code=quote(geneCounts <- importData(
          system.file("extdata/GSE134118_Table_S3.xlsx", package="easyreporting"))),
          sourceFilesList=system.file("script/importFunctions.R", package="easyreporting"))

    #> Copying /tmp/Rtmpc3egAy/Rinst17bae091d8/easyreporting/script/importFunctions.R to /tmp/RtmpLkU33C//importFunctions.R

# 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,
                            code=quote(EDASeq::plotPCA(as.matrix(geneCounts))))

# 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,
        code="degList <- applyEdgeRExample(counts=geneCounts,
                        samples=colnames(geneCounts), contrast='Pleura - Broth')",
        comment=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"))

    #> Copying /tmp/Rtmpc3egAy/Rinst17bae091d8/easyreporting/script/geneFunctions.R to /tmp/RtmpLkU33C//geneFunctions.R

## 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, code="limma::plotMD(degList$test)")

# 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)

# Session Info

    sessionInfo()

    #> R version 4.5.1 (2025-06-13)
    #> Platform: x86_64-pc-linux-gnu
    #> Running under: Ubuntu 24.04.3 LTS
    #>
    #> Matrix products: default
    #> BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
    #> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so;  LAPACK version 3.12.0
    #>
    #> 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
    #>
    #> time zone: Etc/UTC
    #> tzcode source: system (glibc)
    #>
    #> attached base packages:
    #> [1] stats     graphics  grDevices utils     datasets  methods   base
    #>
    #> other attached packages:
    #> [1] distill_1.6          easyreporting_1.23.0 BiocStyle_2.37.1
    #>
    #> loaded via a namespace (and not attached):
    #>  [1] cli_3.6.5           knitr_1.50          rlang_1.1.6
    #>  [4] xfun_0.53           jsonlite_2.0.0      buildtools_1.0.0
    #>  [7] htmltools_0.5.8.1   maketools_1.3.2     sys_3.4.3
    #> [10] formatR_1.14        sass_0.4.10         rmarkdown_2.30
    #> [13] evaluate_1.0.5      jquerylib_0.1.4     fastmap_1.2.0
    #> [16] yaml_2.3.10         lifecycle_1.0.4     memoise_2.0.1
    #> [19] BiocManager_1.30.26 compiler_4.5.1      downlit_0.4.4
    #> [22] digest_0.6.37       R6_2.6.1            bslib_0.9.0
    #> [25] tools_4.5.1         withr_3.0.2         cachem_1.1.0