Contents

Shortcut to ChIP-seq analysis

bowtie2-macs2-deeptools

2.1 Genome mapping

Step 0: install software

1
2
# install miniconda, then call conda
conda install -c bioconda bowtie2 hisat2 samtools deeptools

step 1: build index

1
bowtie2-build hg38.fa bowtie2_index/hg38

step 2: mapping

Unpaired data

1
2
3
bowtie2 -p ${threads} -x index/hg38 \
         -U input.fastq.gz \
         -S ouput.sam

Paired data

1
2
3
4
bowtie2 -p 4 -x index/hg38 \
         -1 input_R1.fastq.gz \
         -2 input_R2.fastq.gz \
         -S ouput.sam

step 3: sam to bam

1
2
3
4
5
samtools view -Sbh  -q 25 \
              -@ ${threads}  \
              -o ouput.bam \
              input.sam

step 4: bam sort and index

1
2
3
samtools sort -@ ${threads} input.bam > output.sorted.bam 
samtools index input.sorted.bam #generate input.sorted.bam.bai

step 5: bam to bigwig

1
2
3
4
5
6
7
bamCoverage -p ${threads} \
            --normalizeUsing RPKM \ # note: other normalization options 
            --centerReads  \
            -e 200 \
            -b input.sorted.bam \
            -o output.bw

2.2 Peaks analysis

note:: macs2 (>v2.2.x) supports python 3.

step 0: install tools

1
conda install macs2 bedtools pygenometracks 

step 1: callpeaks (1) narrow peaks, e.g. TFs, h3k4m3

1
2
3
4
5
6
7
8
# bam file input
macs2 callpeak -t ChIP.elute.sorted.bam  \
               -c ChIP.input.sorted.bam \
               -f BAM \
               -g hs # organism \ 
               -B  -q 0.05 \
               -n  ${outFileName}\
               --outdir macs_out

(2) Broad peaks, e.g. h3k27me3

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# sam file also works fine
macs2 callpeak -t ./bowtie_out/WTme2ChIP.sam  \
               -c ./bowtie_out/ESCInput.sam \
               -f SAM \
               -g mm \
               -B --SPMR \
               --nomodel --extsize 147 \
               --broad
               -n WTme2ChIP
               --outdir macs_out

step 2: advanced analysis

  • tools: bedtools, deeptools, pyGenomeTracks, igv
  • genome algebra
    • overlap with other peaks: bedtools
  • visualization
    • heatmap: deeptools
    • signal tracks: pyGenomeTracks, igv