README.md 7.04 KB
Newer Older
Rachel  LEGENDRE's avatar
Rachel LEGENDRE committed
1
# ChIPflow: from raw data to epigenomic dynamics
Rachel  LEGENDRE's avatar
Rachel LEGENDRE committed
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

[![Snakemake](https://img.shields.io/badge/snakemake-≥5.2.1-brightgreen.svg)](https://snakemake.readthedocs.io/en/stable/) [![Python 3.6](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)


## Authors

* Rachel Legendre (@rlegendr)
* Maelle Daunesse
* Adrien Pain
* Hugo Varet
* Claudia Chica


## What is ChIPflow ?

Rachel  LEGENDRE's avatar
Rachel LEGENDRE committed
17
ChIPflow is a snakemake-based workflow for the analysis of ChIP-seq data from the raw fastq files to the differential analysis of transcription factor binding or histone modification marking. It streamlines critical steps like the quality assessment of the immunoprecipitation using the cross correlation and the replicate comparison for both narrow and broad peaks. For the differential analysis ChIPflow provides linear and non linear methods for normalisation between samples as well as conservative and stringent models for estimating the variance and testing the significance of the observed differences (see [chipflowr](https://gitlab.pasteur.fr/hub/chipflowr)).
Rachel  LEGENDRE's avatar
Rachel LEGENDRE committed
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

## How to install ChIPflow ?

### Installation with singularity

You need to install:
- python >= 3.8
- snakemake >=4.8.0
- pandas
- pysam
- singularity

    
Download the singularity container:
 
Rachel  LEGENDRE's avatar
Rachel LEGENDRE committed
33
`singularity pull library://rlegendre/default/chipflow:latest` 
Rachel  LEGENDRE's avatar
Rachel LEGENDRE committed
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

### Manual installation 

In addition to above tools, you need to install pipeline-related tools:

- cutadapt >= 3.2
- fastqc == 0.11.9
- samtools >= 1.10
- bowtie2 >= 2.3.5
- macs2 >= 2.2.7
- picard >= 2.18.25
- featureCounts (from subread) >= 2.0.0
- bedtools >= 2.27.1
- idr == 2.0.3
- R >= 4.0.3
- spp == 1.15.2
    - need following cran packages: snow, snowfail, bitops, caTools, RCurl, Rcpp, and bioconductor packages: GenomeInfoDB, genomicRanges, Rsamtools.
Rachel  LEGENDRE's avatar
Rachel LEGENDRE committed
51
- [chipflowr](https://gitlab.pasteur.fr/hub/chipflowr)
Rachel  LEGENDRE's avatar
Rachel LEGENDRE committed
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183


# How to run ChIPflow ?

## Usage

* Step 1: Install workflow

If you simply want to use this workflow, download and extract the latest release.

`git clone https://gitlab.pasteur.fr/hub/chipflow.git`

In any case, if you use this workflow in a paper, don't forget to give credits to the authors by citing the URL of this repository and, if available, its DOI (see above).


*  Step 2: Configure workflow

Configure the workflow according to your needs via editing the `config.yaml`, `design.txt` and `multiqc_config.yaml` files in the `config/` directory.

You can also copy the singularity image in the cloned ChIPflow directory and rename it as "chipflow.img".

*  Step 3: Execute workflow

Test your configuration by performing a dry-run via

`snakemake --use-singularity -n `

Execute the workflow locally via

`snakemake --use-singularity --cores $N`

using $N cores or run it in a cluster environment via

`snakemake --use-singularity --singularity-args "-B '/home/login/'" --cluster-config config/cluster_config.json --cluster "sbatch --mem={cluster.ram} --cpus-per-task={threads} " -j 200 --nolock`


Visualize how the rules are connected via 

`snakemake -s Snakefile --rulegraph --nolock | dot -Tsvg > rulegraph.svg`

or how the files are processed via

`snakemake -s Snakefile -j 10 --dag --nolock | dot -Tsvg > dag.svg`

### Pipeline overview

<img src="images/chipflow_pipeline.svg" width="700">


### Rename FASTQ files

All FASTQ files have to observe the following name nomenclature: `MARK_COND_REP_MATE.fastq.gz`. For FASTQ files with only one mate (single-end sequencing), or if no replicates are available, set MATE to R1 or REP to Rep1, respectively.

| Wildcard |                          Description                                |
|----------|---------------------------------------------------------------------|
|   MARK   | Histone mark or Transcription Factor (TF) name (i.e. H3K4me1, Klf4) |
|   COND   | Biological condition name (i.e. Normal, Cancer)                     |
|   REP    | Replicate number (i.e. Rep1 or Rep2)                                |
|   MATE   | Identification of mate pair sequencing (i.e. R1 or R2)              |

All the FASTQ files must be stored in the same directory.

### How to fill the design

The experimental analysis design is summarise in a tabulated design file that the user have to fill before running the pipeline.

Design columns:

|    Column    |                          Description                          |
|--------------|---------------------------------------------------------------|
|   IP_NAME    | IP FASTQ files prefix  (i.e. MARK_COND1)                      |
|   INPUT_NAME | INPUT FASTQ files prefix (i.e. INPUT_COND1)                   |
|   NB_IP      | Number of replicates of the histone mark or TFs (i.e. 1 or 2) |
|   NB_INPUT   | Number of replicates of INPUT files (i.e. 1 or 2)             |

Link to an Example: [design.txt](https://gitlab.pasteur.fr/hub/chipflow/-/blob/master/test/design.txt)


### How to fill the config file

All the parameters to run the pipeline are gathered in a YAML config file that the user has to fill before running the pipeline. Here is an filled example: [config.yaml](https://gitlab.pasteur.fr/hub/chipflow/-/blob/master/test/config.yaml)

This config file is divided in 2 sections:

1. Section 1: Running pipeline chunks

This first chunk provides input information and assigns working directories. 
`input_dir` path to FASTQ files directory. 
`input_mate` mate pair format (i.e. `_R[12]` for *MATE* = R1 or R2) , must match the *MATE* parameter in FASTQ files.
`input_extension` filename extension format (i.e. `fastq.gz` or `fq.gz`).
`analysis_dir` path to analysis directory.
`tmpdir` path to temporary directory (i.e. `/tmp/` or `/local/scratch/`)

```
input_dir: /path/to/raw_data
input_mate: '_R[12]'
input_extension: '.fastq.gz'
analysis_dir: /path/to/directory/analysis
tmpdir: "/tmp/"
```

The design chunk aims to check that the FASTQ files name match the design file information. The `marks`, `conditions` and `replicates` parameters must respectively match the *MARK*, *COND* and *REP* parameters of the FASTQ files name and the design file. 
For spike-in data, set `spike` on "True" and provide the spike-in genome FASTA file path through the `spike_genome_file` parameter.

```
design:
    design_file: /path/to/directory/analysis/config/design.txt    
    marks: K4Me3
    condition: C, U
    replicates: Rep
    spike: false
    spike_genome_file: /path/to/genome/directory/dmel9.fa
```

2. Section 2: Rule parameters chunks

Each step has it proper setting in independent chunk.
The second section of the configuration file is divided in multiple chunks. Each chunk gather the parameters of one step of the pipeline: `adapters`, `bowtie2_mapping`, `mark_duplicates`, `remove_blacklist`, `peak_calling`, `compute_idr` and `differential_analysis`. 

The `options` parameter present in `adapters`, `bowtie2_mapping` and `peak_calling` allows you to provide any parameter recognised by cutadapt, bowtie2 and macs2 respectively. For example for the `bowtie2_mapping` chunk, `options` can be fill with "--very-sensitive".

```
bowtie2_mapping:
    options: "--very-sensitive"
    threads: 4
```

## How to cite ChIPflow ?

https://www.biorxiv.org/content/10.1101/2021.02.02.429342v2