Giter Club home page Giter Club logo

peakcaller's Introduction

DOI DOI

ChIPseq Peak Caller

By Simon Myers, Nicolas Altemose & Daniel Wells

This pipeline implements the algorithms for calling peaks from ChIPseq data described in Altemose et al. eLife 2017.

Example Usage

Convert BAM to fragment BED

First we need to summarise the PE BAM files as BED files of physical DNA fragments. The BAM files should already have been QC'd (e.g. low quality & duplicates removed).

for sample in Chip Input
do
(
bedtools bamtobed -i ${sample}.bam -bedpe | \
  awk '{print $1, $2, $6}' OFS="\t" | \
  LC_ALL=C sort -k1,1V -k2,2n -S5G --parallel=5 \
  > Fragment_Position_${sample}.sorted.bed
) &
done

(Create Pseudoreplicates)

The method requires 2 replicates per ChIP sample, if you don't have this you can split your sample into two pseudoreplicates.

awk '{print > (rand()<0.5 ? (FILENAME".PR1") : (FILENAME".PR2"))}' Fragment_Position_Chip.sorted.bed

Call Peaks

Then we can run the script to fit the parameters of the model to our data and then calculate coverage at each base pair and find the peaks.

sh MAPeakCaller.sh \
	--intermediates intermediates_folder/ \
	--outconstfile Constants_SampleName1.tsv \
	--outpeakfile SingleBasePairPeaks_SampleName1.bed \
	--chrsizes hg38.sizes \
	-a Fragment_Position_Chip.sorted.bed.PR1 \
	-b Fragment_Position_Chip.sorted.bed.PR2 \
	-i Fragment_Position_Input.sorted.bed \
	--autosomes 22 \
	--pthresh 0.000001 \
	--peakminsep 250

This will produce two files:

  • Constants_SampleName1.tsv
  • SingleBasePairPeaks_SampleName1.bed

Total runtime ~ 20 mins on 16 core server.

Force Calling

We can also 'force call' p-values and enrichments at abitrary locations, In the example below we're force calling Sample2 at the peak postions from Sample1 (you can use any BED file for --forcepositions):

sh MAPeakCaller.sh \
	--intermediates intermediates_folder/ \
	--chrsizes hg38.sizes \
	--outconstfile Constants_SampleName2.tsv \
	--outpeakfile ForceCalledPeaks_SampleName2.bed \
	-a Fragment_Position_Chip.sorted.bed.PR1 \
	-b Fragment_Position_Chip.sorted.bed.PR2 \
	-i Fragment_Position_Input.sorted.bed \
	--autosomes 22 \
	--forcepositions SingleBasePairPeaks_SampleName1.bed

Dependencies

  • R (3.5.1)
  • R packages "data.table" (1.11.4), "IRanges", and "parallel"
  • Bedtools (2.27.1)
  • Samtools (1.7)

This code is ported from the original at https://github.com/altemose/PRDM9-map

If you use this program, please cite Altemose et al. eLife 2017.

This is free software shared in the hope it may be of use; no warranty is given or implied.

peakcaller's People

Contributors

daniel-wells avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.