# ChIP-Seq Workflow Template

Author: Daniela Cassol (danielac@ucr.edu) and Thomas Girke (thomas.girke@ucr.edu)

#### Last update: 22 June, 2019

#### Package

systemPipeR 1.18.2

# 1 ChIP-Seq Workflow

This workflow demonstrates how to use various utilities for building and running automated end-to-end analysis workflows for `ChIP-Seq` data. The full workflow can be found here: HTML, .Rmd, and .R.

## 1.1 Loading package and workflow template

Load the `ChIP-Seq` sample workflow into your current working directory.

    library(systemPipeRdata)
    genWorkenvir(workflow = "chipseq")
    setwd("chipseq")

The working environment of the sample data loaded in the previous step contains the following preconfigured directory structure. Directory names are indicated in grey. Users can change this structure as needed, but need to adjust the code in their workflows accordingly.

- chipseq/
  - This is the directory of the R session running the workflow.
  - Run script ( *.Rmd) and sample annotation (targets.txt) files are located here.
  - Note, this directory can have any name (e.g. chipseq). Changing its name does not require any modifications in the run script(s).
  - Important subdirectories:
    - param/
      - Stores parameter files such as: *.param, *.tmpl and *_run.sh.
    - data/
      - FASTQ samples
      - Reference FASTA file
      - Annotations
      - etc.
    - results/
      - Alignment, variant and peak files (BAM, VCF, BED)
      - Tabular result files
      - Images and plots
      - etc.

The following parameter files are included in each workflow template:

1. `targets.txt`: initial one provided by user; downstream `targets_*.txt` files are generated automatically
2. `*.param`: defines parameter for input/output file operations, e.g. `trim.param`, `bwa.param`, `hisat2.param`, …
3. `*_run.sh`: optional bash script, e.g.: `gatk_run.sh`
4. Compute cluster environment (skip on single machine):
   - `.batchtools.conf.R`: defines type of scheduler for `batchtools`. Note, it is necessary to point the right template accordingly to the cluster in use.
   - `*.tmpl`: specifies parameters of scheduler used by a system, e.g. Torque, SGE, Slurm, etc.

## 1.2 Run workflow

Next, run the chosen sample workflow `systemPipeChIPseq` (.Rmd) by executing from the command-line `make -B` within the `chipseq` directory. Alternatively, one can run the code from the provided `*.Rmd` template file from within R interactively.

Workflow includes following steps:

1. Read preprocessing
   - Quality filtering (trimming)
   - FASTQ quality report
2. Alignments: `Bowtie2` or `rsubread`
3. Alignment stats
4. Peak calling: `MACS2`, `BayesPeak`
5. Peak annotation with genomic context
6. Differential binding analysis
7. GO term enrichment analysis
8. Motif analysis

# 2 Version Information

    sessionInfo()

    ## R version 3.6.0 (2019-04-26)
    ## Platform: x86_64-w64-mingw32/x64 (64-bit)
    ## Running under: Windows Server 2012 R2 x64 (build 9600)
    ##
    ## Matrix products: default
    ##
    ## locale:
    ## [1] LC_COLLATE=C
    ## [2] LC_CTYPE=English_United States.1252
    ## [3] LC_MONETARY=English_United States.1252
    ## [4] LC_NUMERIC=C
    ## [5] LC_TIME=English_United States.1252
    ##
    ## attached base packages:
    ## [1] stats4    parallel  stats     graphics  grDevices
    ## [6] utils     datasets  methods   base
    ##
    ## other attached packages:
    ##  [1] batchtools_0.9.11           data.table_1.12.2
    ##  [3] ape_5.3                     ggplot2_3.2.0
    ##  [5] systemPipeR_1.18.2          ShortRead_1.42.0
    ##  [7] GenomicAlignments_1.20.1    SummarizedExperiment_1.14.0
    ##  [9] DelayedArray_0.10.0         matrixStats_0.54.0
    ## [11] Biobase_2.44.0              BiocParallel_1.18.0
    ## [13] Rsamtools_2.0.0             Biostrings_2.52.0
    ## [15] XVector_0.24.0              GenomicRanges_1.36.0
    ## [17] GenomeInfoDb_1.20.0         IRanges_2.18.1
    ## [19] S4Vectors_0.22.0            BiocGenerics_0.30.0
    ## [21] BiocStyle_2.12.0
    ##
    ## loaded via a namespace (and not attached):
    ##  [1] nlme_3.1-140             Category_2.50.0
    ##  [3] bitops_1.0-6             bit64_0.9-7
    ##  [5] RColorBrewer_1.1-2       progress_1.2.2
    ##  [7] httr_1.4.0               Rgraphviz_2.28.0
    ##  [9] tools_3.6.0              backports_1.1.4
    ## [11] R6_2.4.0                 DBI_1.0.0
    ## [13] lazyeval_0.2.2           colorspace_1.4-1
    ## [15] withr_2.1.2              tidyselect_0.2.5
    ## [17] prettyunits_1.0.2        bit_1.1-14
    ## [19] compiler_3.6.0           graph_1.62.0
    ## [21] formatR_1.7              rtracklayer_1.44.0
    ## [23] bookdown_0.11            scales_1.0.0
    ## [25] checkmate_1.9.3          genefilter_1.66.0
    ## [27] RBGL_1.60.0              rappdirs_0.3.1
    ## [29] stringr_1.4.0            digest_0.6.19
    ## [31] rmarkdown_1.13           AnnotationForge_1.26.0
    ## [33] pkgconfig_2.0.2          htmltools_0.3.6
    ## [35] BSgenome_1.52.0          limma_3.40.2
    ## [37] rlang_0.3.4              RSQLite_2.1.1
    ## [39] GOstats_2.50.0           hwriter_1.3.2
    ## [41] dplyr_0.8.1              VariantAnnotation_1.30.1
    ## [43] RCurl_1.95-4.12          magrittr_1.5
    ## [45] GO.db_3.8.2              GenomeInfoDbData_1.2.1
    ## [47] Matrix_1.2-17            Rcpp_1.0.1
    ## [49] munsell_0.5.0            stringi_1.4.3
    ## [51] yaml_2.2.0               edgeR_3.26.5
    ## [53] zlibbioc_1.30.0          grid_3.6.0
    ## [55] blob_1.1.1               crayon_1.3.4
    ## [57] lattice_0.20-38          splines_3.6.0
    ## [59] GenomicFeatures_1.36.2   annotate_1.62.0
    ## [61] hms_0.4.2                locfit_1.5-9.1
    ## [63] knitr_1.23               pillar_1.4.1
    ## [65] rjson_0.2.20             base64url_1.4
    ## [67] codetools_0.2-16         biomaRt_2.40.0
    ## [69] XML_3.98-1.20            glue_1.3.1
    ## [71] evaluate_0.14            latticeExtra_0.6-28
    ## [73] BiocManager_1.30.4       gtable_0.3.0
    ## [75] purrr_0.3.2              assertthat_0.2.1
    ## [77] xfun_0.7                 xtable_1.8-4
    ## [79] survival_2.44-1.1        tibble_2.1.3
    ## [81] pheatmap_1.0.12          AnnotationDbi_1.46.0
    ## [83] memoise_1.1.0            brew_1.0-6
    ## [85] GSEABase_1.46.0

# 3 Funding

This project was supported by funds from the National Institutes of Health (NIH) and the National Science Foundation (NSF).