Using MEME to identify TF binding motif from ChIP-seq data

Author:Mark Robinson
Date:June 10, 2010

Suppose we want to find binding sites in our ChIP data. We can do that by extracting sequences near the peaks, and then use MEME to “discover” motifs.

Extract the flanking ChIP-seq peaks

We’ll make use of a handy script made available by Anton Valouev from Stanford which will take your peak/region coordinates and create a fasta file containing flanking DNA sequence for each peak/region.:

%% cd ~/
%% curl -O
%% gunzip

Then you can run:

%% perl

to see the command-line options.

To extract 200 bp around each peak call, type the following command (make sure to replace paths to all_chr.fasta and peak call file if they are different on your computer):

%% cd /mnt/myxo
%% perl /root/ -i ./QuEST_analysis/calls/peak_caller.ChIP.out.accepted -o ./MrpC -r ./myxo-genome.fa -w 200

you will now have files ‘MrpC.peaks.200bp.fa’ and ‘MrpC.regions.200bp.fa’.

These are the files we want to use to look for motifs.

Using MEME

First, download, unpack, configure, and build MEME:

%% cd
%% curl -O
%% tar zxf meme_current.tar.gz
%% cd meme_4.3.0/
%% ./configure --prefix=/usr/local --with-url=
%% make
%% make install
%% apt-get -y install csh

The full set of command line options for running MEME can be found here if you feel adventurous and want to play. For our purposes today, the following command should get the job done:

%% cd /mnt/myxo
%% meme MrpC.peaks.200bp.fa -dna -nmotifs 5 -mod oops -revcomp -o MrpC_meme

This tells meme to use the file MrpC.peaks.200bp.fa as input. That it should use a nucleotide alphabet (amino acid is the default). It should look for a maximum of 5 motifs (1 is the default). The revcomp flag tells meme to look for motifs on both strands (default is only the forward strand) and the ‘-mod oops’ argument tells meme to expect one motif in every sequence. Finally the -o flag allows you to specify an output directory for files generated by meme.

The ouput directory will (upon completion) contain among other files a html file. You can either zip it up

%% apt-get install -y zip
%% zip -r MrpC_meme

copy it to your local computer, unzip it, and open ‘mem.html’ with a Web browser...

Running a Web server

... OR you can configure your AWS machine to be a Web server to serve it from there. To do that, type:

%% apt-get -y install apache2

You will also need to edit your security rules on Amazon AWS to let HTTP through; this will take effect immediately so you don’t need to restart your EC2 machine.

Once you can go to ‘http://$amazon-machine-name‘ and see “it works!”, you’re good – run the following command:

%% cd /mnt/myxo
%% ln -fs $PWD/MrpC_meme /var/www/

and then go visit:


LICENSE: This documentation and all textual/graphic site content is licensed under the Creative Commons - 0 License (CC0) -- fork @ github. Presentations (PPT/PDF) and PDFs are the property of their respective owners and are under the terms indicated within the presentation.
comments powered by Disqus