changeset 0:9c157b556c33 draft

Uploaded
author iuc
date Thu, 16 Jan 2014 13:31:17 -0500
parents
children d202e3d663bb
files dir2html.py macs2_bdgbroadcall.xml macs2_bdgcmp.xml macs2_bdgdiff.xml macs2_bdgpeakcall.xml macs2_callpeak.xml macs2_filterdup.xml macs2_randsample.xml macs2_refinepeak.xml readme.rst tool_dependencies.xml
diffstat 11 files changed, 817 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dir2html.py	Thu Jan 16 13:31:17 2014 -0500
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+import os
+import sys
+from xml.sax.saxutils import escape
+
+def make_table( directory ):
+    ret = ['<table class="fileList">\n']
+    for file in os.listdir( directory ):
+        ret.append('<tr><td class="file"><a href="%s">%s</a></td></tr>\n' % ( file, escape(file).replace( 'MACS2_', '' ) ))
+    ret.append('</table>')
+    return ''.join(ret)
+
+def make_html( directory, stderr ):
+    return '\n'.join(['<html>'
+                      '<head>',
+                      '   <title>Additional output created by MACS2</title>',
+                      '   <style type="text/css">',
+                      '      table.fileList { text-align: left; }',
+                      '      td.directory { font-weight: bold; }',
+                      '      td.file { padding-left: 4em; }',
+                      '   </style>',
+                      '</head>',
+                      '<body>',
+                      '<h1>Additional Files:</h1>',
+                      make_table( directory ),
+                      '<h3>Messages from MACS2:</h3>',
+                      stderr.read().replace('\n', '<br>'),
+                      '</body>',
+                      '</html>'])
+                   
+if __name__ == '__main__':
+    if len(sys.argv) == 3:
+        directory_path = sys.argv[1]
+        stderr = open( sys.argv[2] )
+        print make_html( directory_path, stderr )
+    else:
+        sys.exit( 'Two parameter expected: directory path and stderr path' )
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macs2_bdgbroadcall.xml	Thu Jan 16 13:31:17 2014 -0500
@@ -0,0 +1,52 @@
+<tool id="macs2_bdgbroadcall" name="Call broad peaks" version="2.0.10.0">
+    <description>from bedGraph</description>
+    <requirements>
+        <requirement type="python-module">macs2</requirement>
+        <requirement type="python-module">numpy</requirement>
+        <requirement type="package" version="2.0.10.2">macs2</requirement>
+        <requirement type="package" version="1.7.1">numpy</requirement>
+    </requirements>
+    <command>
+
+        macs2 bdgbroadcall
+            --ifile $infile
+            --cutoff-peak $cutoffpeak
+            --cutoff-link $cutofflink
+            --min-length $minlen
+            --lvl1-max-gap $LVL1MAXGAP
+            --lvl2-max-gap $LVL2MAXGAP
+            --ofile $ofile
+
+    </command>
+    <inputs>
+
+        <param name="infile" type="data" format="bedgraph" label="MACS score in bedGraph" />
+        <param name="cutoffpeak" type="float" label="Cutoff for peaks" value="2.0" help="depending on which method you used for score track. If the file contains qvalue scores from MACS2, score 2 means qvalue 0.01. DEFAULT: 2.0 (--cutoff-peak)"/>
+        <param name="cutofflink" type="float" label="Cutoff for peaks" value="1.0" help="Cutoff for linking regions/low abundance regions depending on which method you used for score track. If the file contains qvalue scores from MACS2, score 1 means qvalue 0.1, and score 0.3 means qvalue 0.5. DEFAULT: 1 (--cutoff-link)"/>
+        <param name="minlen" type="integer" label="Minimum length of peak" value="200" help="better to set it as d value" />
+        <param name="LVL1MAXGAP" type="integer" label="Maximum gap between significant peaks" value="30" help="better to set it as tag size" />
+        <param name="LVL2MAXGAP" type="integer" label="Maximum linking between significant peaks" value="800" help="better to set it as 4 times of d value" />
+
+    </inputs>
+
+    <outputs>
+        <data name="ofile" format="bed" label="${tool.name} on ${on_string}" />
+    </outputs>
+    <tests>
+        <!--none yet for macs2-->
+    </tests>
+    <help>
+**What it does**
+
+Call broad peaks from bedGraph output.
+bdgbroadcall from macs2
+
+------
+
+**Citation**
+
+For the underlying tool, please cite Zhang Y, Liu T, Meyer CA, Eeckhoute J, Johnson DS, Bernstein BE, Nusbaum C, Myers RM, Brown M, Li W, Liu XS. Model-based analysis of ChIP-Seq (MACS). Genome Biol. 2008;9(9):R137.
+
+Integration of MACS2 with Galaxy performed by Ziru Zhou ( ziruzhou@gmail.com ). Please send your comments/questions to modENCODE DCC at help@modencode.org.
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macs2_bdgcmp.xml	Thu Jan 16 13:31:17 2014 -0500
@@ -0,0 +1,84 @@
+<tool id="macs2_bdgcmp" name="Deduct noise" version="2.0.10.0">
+    <description>by comparing two signal tracks in bedGraph (bdgcmp)</description>
+    <requirements>
+        <requirement type="python-module">macs2</requirement>
+        <requirement type="python-module">numpy</requirement>
+        <requirement type="package" version="2.0.10.2">macs2</requirement>
+        <requirement type="package" version="1.7.1">numpy</requirement>
+    </requirements>
+    <command>
+        macs2 bdgcmp
+            -t $input_treatment_file
+            -c $input_control_file
+
+            -m $bdgcmp_options.bdgcmp_options_selector
+            #if $bdgcmp_options.bdgcmp_options_selector in ['FE', 'logFR', 'logLR']:
+                -p $pseudocount
+            #end if
+            --ofile $ofile
+
+    </command>
+    <inputs>
+    <!--experiment name and option of selecting paired or single end will always be present-->
+    <param name="experiment_name" type="text" value="MACS2 in Galaxy" size="50" label="Experiment Name"/>
+
+        <param name="input_treatment_file" type="data" format="bedgraph" label="Treatment bedGraph file" />
+        <param name="input_control_file" type="data" format="bedgraph" label="Control bedGraph file" />
+
+        <conditional name="bdgcmp_options">
+            <param name="bdgcmp_options_selector" type="select" label="Method to use while calculating a score in any bin by comparing treatment value and control value">
+                <option value="ppois">Poisson Pvalue (-log10 (pvalue) form) using control as lambda and treatment as observation</option>
+                <option value="qpois">q-value through a BH process for poisson pvalues</option>
+                <option value="subtract">subtraction from treatment</option>
+                <option value="logFE">log10 fold enrichment</option>
+                <option value="FE">linear scale fold enrichment</option>
+                <option value="logLR">log10 likelihood between ChIP-enriched model and open chromatin model</option>
+                <option value="slogLR">symmetric log10 likelihood between two ChIP-enrichment models and open chromatin model</option>
+            </param>
+            <when value="FE">
+                <param name="pseudocount" type="float" label="Set pseudocount" value="0.0" help="The count will be applied after normalization of sequencing depth. DEFAULT: 0.0, no pseudocount is applied."/>
+            </when>
+            <when value="logLR">
+                <param name="pseudocount" type="float" label="Set pseudocount" value="0.0" help="The count will be applied after normalization of sequencing depth. DEFAULT: 0.0, no pseudocount is applied."/>
+            </when>
+            <when value="logFE">
+                <param name="pseudocount" type="float" label="Set pseudocount" value="0.0" help="The count will be applied after normalization of sequencing depth. DEFAULT: 0.0, no pseudocount is applied."/>
+            </when>
+        </conditional>
+
+    </inputs>
+
+    <outputs>
+        <data name="ofile" format="bedgraph" label="${tool.name} on ${on_string}" />
+    </outputs>
+    <tests>
+        <!--none yet for macs2-->
+    </tests>
+    <help>
+**What it does**
+
+With the improvement of sequencing techniques, chromatin immunoprecipitation followed by high throughput sequencing (ChIP-Seq)
+is getting popular to study genome-wide protein-DNA interactions. To address the lack of powerful ChIP-Seq analysis method, we present a novel algorithm, named Model-based Analysis of ChIP-Seq (MACS), for
+identifying transcript factor binding sites. MACS captures the influence of genome complexity to evaluate the significance of enriched ChIP regions, and MACS improves the spatial resolution of
+binding sites through combining the information of both sequencing tag position and orientation. MACS can be easily used for ChIP-Seq data alone, or with control sample with the increase of specificity.
+
+View the original MACS2 documentation: https://github.com/taoliu/MACS/blob/master/README
+
+------
+
+**Usage**
+
+**Peak Calling**: Main MACS2 Function to Call peaks from alignment results.
+
+**Compare .bdg files**: Deduct noise by comparing two signal tracks in bedGraph.
+
+
+------
+
+**Citation**
+
+For the underlying tool, please cite Zhang Y, Liu T, Meyer CA, Eeckhoute J, Johnson DS, Bernstein BE, Nusbaum C, Myers RM, Brown M, Li W, Liu XS. Model-based analysis of ChIP-Seq (MACS). Genome Biol. 2008;9(9):R137.
+
+Integration of MACS2 with Galaxy performed by Ziru Zhou ( ziruzhou@gmail.com ). Please send your comments/questions to modENCODE DCC at help@modencode.org.
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macs2_bdgdiff.xml	Thu Jan 16 13:31:17 2014 -0500
@@ -0,0 +1,84 @@
+<tool id="macs2_bdgdiff" name="Differential peak detection" version="2.0.10.0">
+    <description>based on paired four bedgraph files</description>
+    <requirements>
+        <requirement type="python-module">macs2</requirement>
+        <requirement type="python-module">numpy</requirement>
+        <requirement type="package" version="2.0.10.2">macs2</requirement>
+        <requirement type="package" version="1.7.1">numpy</requirement>
+    </requirements>
+    <command>
+
+        macs2 bdgdiff
+            --t1 $infile_pileup_cond1
+            --t2 $infile_pileup_cond2
+            --c1 $infile_control_cond1
+            --c2 $infile_control_cond2
+            --cutoff $cutoff
+            --min-len $minlen
+            --depth1 $depth1
+            --depth2 $depth2
+
+            # Why does #if '--ofile-cond1' in $outputs not work?
+            #if '--ofile-cond1' in str($outputs).split(','):
+                --ofile-cond1 $output_cond1
+            #end if
+
+            #if '--ofile-cond2' in str($outputs).split(','):
+                --ofile-cond2 $output_cond2
+            #end if
+
+            #if '--ofile-both-conditions' in str($outputs).split(','):
+                --ofile-both-conditions $output_both
+            #end if
+
+    </command>
+    <inputs>
+        <param name="infile_pileup_cond1" type="data" format="bedgraph" label="MACS pileup bedGraph for condition 1" />
+        <param name="infile_pileup_cond2" type="data" format="bedgraph" label="MACS pileup bedGraph for condition 2" />
+
+        <param name="infile_control_cond1" type="data" format="bedgraph" label="MACS control lambda bedGraph for condition 1" />
+        <param name="infile_control_cond2" type="data" format="bedgraph" label="MACS control lambda bedGraph for condition 2" />
+
+        <param name="cutoff" type="float" label="Cutoff of log10 likelihood ratio cutoff" value="1.0" help="DEFAULT: 1.0 (likelihood ratio=10) (--cutoff)"/>
+        <param name="minlen" type="integer" label="Minimum length of differential region" value="200"/>
+        <param name="depth1" type="integer" value="1" label="Sequence depth of condition 1 in million reads" help="Default: 1 (--depth1)" />
+        <param name="depth2" type="integer" value="1" label="Sequence depth of condition 2 in million reads" help="Default: 1 (--depth2)" />
+
+        <param name="outputs" type="select" display="checkboxes" multiple="True" label="Outputs">
+            <option value="--ofile-cond1">Unique regions in condition 1</option>
+            <option value="--ofile-cond2">Unique regions in condition 2</option>
+            <option value="--ofile-both-conditions" selected="true">Common regions in both conditions</option>
+            <validator type="no_options" message="Please select at least one output file." />
+        </param>
+
+    </inputs>
+
+    <outputs>
+        <data name="output_cond1" format="bed" label="${tool.name} on ${on_string} (cond 1)">
+            <filter>'--ofile-cond1' in outputs</filter>
+        </data>
+        <data name="output_cond2" format="bed" label="${tool.name} on ${on_string} (cond 2)">
+            <filter>'--ofile-cond2' in outputs</filter>
+        </data>
+        <data name="output_both" format="bed" label="${tool.name} on ${on_string} (both)">
+            <filter>'--ofile-both-conditions' in outputs</filter>
+        </data>
+    </outputs>
+    <tests>
+        <!--none yet for macs2-->
+    </tests>
+    <help>
+**What it does**
+
+bdgdiff from macs2
+
+
+------
+
+**Citation**
+
+For the underlying tool, please cite Zhang Y, Liu T, Meyer CA, Eeckhoute J, Johnson DS, Bernstein BE, Nusbaum C, Myers RM, Brown M, Li W, Liu XS. Model-based analysis of ChIP-Seq (MACS). Genome Biol. 2008;9(9):R137.
+
+Integration of MACS2 with Galaxy performed by Ziru Zhou ( ziruzhou@gmail.com ). Please send your comments/questions to modENCODE DCC at help@modencode.org.
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macs2_bdgpeakcall.xml	Thu Jan 16 13:31:17 2014 -0500
@@ -0,0 +1,57 @@
+<tool id="macs2_bdgpeakcall" name="Call peaks" version="2.0.10.0">
+    <description>from bedGraph output</description>
+    <requirements>
+        <requirement type="python-module">macs2</requirement>
+        <requirement type="python-module">numpy</requirement>
+        <requirement type="package" version="2.0.10.2">macs2</requirement>
+        <requirement type="package" version="1.7.1">numpy</requirement>
+    </requirements>
+    <command>
+
+        macs2 bdgpeakcall
+        --ifile $infile
+        --cutoff $cutoff
+        --min-length $minlen
+        --max-gap $maxgap
+        $callsummits
+        $notrackline
+        --ofile $ofile
+
+    </command>
+    <inputs>
+        <param name="infile" type="data" format="bedgraph" label="MACS score in bedGraph" />
+
+        <param name="cutoff" type="float" label="Cutoff for peaks" value="5.0" help="Cutoff depends on which method you used for score track. If the file contains pvalue scores from MACS2, score 5 means pvalue 1e-5. DEFAULT: 5.0 (--cutoff)"/>
+        <param name="minlen" type="integer" value="200" label="Minimum length of peak" help="better to set it as d value (--min-length)"/>
+        <param name="maxgap" type="integer" value="30" label="Maximum gap between significant points in a peak" help="better to set it as tag size DEFAULT: 30 (--max-gap)"/>
+
+        <param name="callsummits" type="boolean" truevalue="--call-summits" falsevalue="" checked="False" 
+            label="If set, MACS will use a more sophisticated approach to find all summits in each enriched peak region."
+            help="(-call-summits)"/>
+        <param name="notrackline" type="boolean" truevalue="" falsevalue="--no-trackline" checked="False" 
+            label="Include trackline into bedGraph output"
+            help="required by USCS (--no-trackline)"/>
+
+    </inputs>
+    <outputs>
+        <data name="ofile" format="tabular" label="${tool.name} on ${on_string}" />
+    </outputs>
+    <tests>
+        <!--none yet for macs2-->
+    </tests>
+    <help>
+**What it does**
+
+Call peaks from bedGraph output.
+bdgpeakcall from macs2
+
+
+------
+
+**Citation**
+
+For the underlying tool, please cite Zhang Y, Liu T, Meyer CA, Eeckhoute J, Johnson DS, Bernstein BE, Nusbaum C, Myers RM, Brown M, Li W, Liu XS. Model-based analysis of ChIP-Seq (MACS). Genome Biol. 2008;9(9):R137.
+
+Integration of MACS2 with Galaxy performed by Ziru Zhou ( ziruzhou@gmail.com ). Please send your comments/questions to modENCODE DCC at help@modencode.org.
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macs2_callpeak.xml	Thu Jan 16 13:31:17 2014 -0500
@@ -0,0 +1,253 @@
+<tool id="macs2_callpeak" name="Call peaks" version="2.0.10.0">
+    <description>from alignment results</description>
+    <requirements>
+        <requirement type="python-module">macs2</requirement>
+        <requirement type="python-module">numpy</requirement>
+        <requirement type="package" version="2.0.10.2">macs2</requirement>
+        <requirement type="package" version="1.7.1">numpy</requirement>
+        <!-- awk and R is missing -->
+    </requirements>
+    <command>
+        #set $temp_stderr = 'macs2_stderr'
+        macs2 callpeak
+
+            --name "MACS2"
+            -t #echo ' '.join( map(str, $input_treatment_file) )#
+
+            #if ' '.join( map(str, $input_control_file) ) != 'None':
+                -c #echo ' '.join( map(str, $input_control_file) )#
+            #end if
+
+        #for $ifile in $input_treatment_file:
+            --format='$ifile.ext.upper()'
+        #end for
+        
+        #if $effective_genome_size_options.effective_genome_size_options_selector == 'user_defined':
+            --gsize $effective_genome_size_options.gsize
+        #else:
+            --gsize $effective_genome_size_options.effective_genome_size_options_selector
+        #end if
+
+        --bw='$bw'
+
+        ##advanced options
+        #if str( $advanced_options.advanced_options_selector ) == 'on':
+            --mfold $advanced_options.mfoldlo $advanced_options.mfoldhi
+            $advanced_options.nolambda
+
+            #if str($advanced_options.broad_options.broad_options_selector) == '--broad':
+                #set $__options['broad'] = str( $advanced_options.broad_options.broad_options_selector )
+                #set $__options['broad_cutoff'] = float( str( $advanced_options.broad_options.broad_cutoff ) )
+            #end if
+
+            #if str($advanced_options.broad_options.broad_options_selector) == '--broad':
+                --broad
+                --broad-cutoff='$advanced_options.broad_options.broad_cutoff'
+            #end if
+
+        #else:
+            --mfold 10 30
+        #end if
+
+        $bdg
+
+        ##pq value select options
+        #if str( $pq_options.pq_options_selector ) == 'qvalue':
+            --qvalue $pq_options.qvalue
+        #else:
+            --pvalue $pq_options.pvalue
+        #end if
+
+        ##model options
+        #if str( $nomodel_type.nomodel_type_selector ) == 'nomodel':
+            --nomodel --shiftsize='$nomodel_type.shiftsize'
+        #end if
+
+        2> $temp_stderr;
+        #######################################################
+        ## move files generated by callpeak command 
+
+        ## TODO
+        ## run R to create pdf from model script
+        ##if os.path.exists( os.path.join( tmp_dir, "MACS2_PREFIX_model.r" ) ):
+        ##    cmdline = 'Rscript "MACS2_PREFIX_model.r" > "MACS2_PREFIX_model.r.log"' )
+        ##    proc = subprocess.Popen( args=cmdline, shell=True, cwd=tmp_dir )
+        ##    proc.wait()
+
+
+        ## move bed out to proper output file
+        ##set $file = os.path.join( $tmp_dir, "%s_peaks.bed" % $experiment_name )
+        ##if os.path.exists( $file ):
+        ##    mv $file $output_bed_file
+        ##end if
+
+        ## OICR peak_xls file
+        ##set $file = os.path.join( $tmp_dir, "%s_peaks.xls" % $experiment_name )
+        ##if os.path.exists( $file ):
+        ##    mv $file output_peaks $output_peaks_file
+        ##end if
+
+        ### peaks.encodepeaks (narrowpeaks) file
+        ##set $file = os.path.join ( $tmp_dir, "%s_peaks.encodePeak" % $experiment_name )
+        ##if os.path.exists( $file ):
+        ##    mv $file $output_narrowpeaks_file
+
+
+        ##parse xls files to interval files as needed
+        ##TODO is in working dir
+        #if 'peaks_interval' in str($outputs).split(','):
+            #set $file = os.path.join( $tmp_dir, 'MACS2_PREFIX_peaks.xls' )
+            #if os.path.exists( $file ):
+                echo '#peaks file' > $output_xls_to_interval_peaks_file;
+                awk '$2-=1' $file >> $output_xls_to_interval_peaks_file;
+                ##xls_to_interval( create_peak_xls_file, output_xls_to_interval_peaks_file, header = 'peaks file' )
+            #end if
+        #end if
+
+        #if 'html' in str($outputs).split(','):
+            ## if output files exists, move them to the extra_files_path and create a html result page linking to them
+            count=`ls -1 MACS2* 2>/dev/null | wc -l`;
+            if [ \$count != 0 ];
+            then 
+                mkdir $output_extra_files.extra_files_path;
+                mv MACS2* $output_extra_files.extra_files_path;
+                python /home/bag/projects/github/galaxytools/macs2/dir2html.py $output_extra_files.extra_files_path $temp_stderr > $output_extra_files;
+            fi;
+        #end if
+
+        cat $temp_stderr 2>&#38;1
+
+    </command>
+    <inputs>
+        <param name="input_control_file" type="data" format="bam,sam,bed" multiple="True" optional="True" label="ChIP-Seq Control File" />
+        <param name="input_treatment_file" type="data" format="bam,sam,bed" multiple="True" label="ChIP-Seq Treatment File" />
+
+        <conditional name="effective_genome_size_options">
+            <param name="effective_genome_size_options_selector" type="select" label="Effective genome size" help="--gsize">
+                <option value="3300000000">Human (3.300.000.000)</option>
+                <option value="3000000000">Mouse (3.000.000.000)</option>
+                <option value="190000000">Fly (190.000.000)</option>
+                <option value="130000000">Worm (130.000.000)</option>
+                <option value="user_defined">User defined</option>
+            </param>
+            <when value="user_defined">
+                <param name="gsize" type="integer" size="12" label="Effective genome size" value=""/>
+            </when>
+        </conditional>
+
+        <param name="bw" type="integer" label="Band width" value="300" help="(--bw)"/>
+        <param name="bdg" type="boolean" truevalue="-B" falsevalue="" checked="False" label="Save fragment pileup, control lambda, -log10pvalue/qvalue in bedGraph" help="Files are located in the html report."/>
+
+        <conditional name="pq_options">
+            <param name="pq_options_selector" type="select" label="Peak detection based on" help="default uses q-value">
+                <option value="qvalue">q-value</option>
+                <option value="pvalue">p-value</option>
+            </param>
+            <when value="pvalue">
+                <param name="pvalue" type="float" label="p-value cutoff for peak detection" value="1e-2" help="default: 1e-2 (--pvalue)"/>
+            </when>
+            <when value="qvalue">
+                <param name="qvalue" type="float" label="q-value cutoff for peak detection" value="5e-2" help="default: 5e-2 (--qvalue)"/>
+            </when> 
+        </conditional>
+
+        <conditional name="nomodel_type">
+            <param name="nomodel_type_selector" type="select" label="Build Model">
+                <option value="nomodel">Do not build the shifting model (--nomodel)</option>
+                <option value="create_model" selected="true">Build the shifting model</option>
+            </param>
+            <when value="nomodel">
+                <param name="shiftsize" type="integer" label="Arbitrary shift size in bp" value="100" help="(--shiftsize)"/>
+            </when>
+        </conditional>
+
+        <param name="outputs" type="select" display="checkboxes" multiple="True" label="Outputs">
+            <option value="peaks_bed" selected="True">Peaks as bed file</option>
+            <option value="html">Summary page (html)</option>
+            <option value="narrow">narrow Peaks</option>
+            <option value="broad">broad Peaks</option>
+            <option value="gapped">gapped Peaks</option>
+            <option value="summits" selected="true">summits</option>
+            <option value="peaks_interval">Peaks as interval file</option>
+
+            <validator type="no_options" message="Please select at least one output file." />
+        </param>
+
+        <conditional name="advanced_options">
+            <param name="advanced_options_selector" type="select" label="Advanced options">
+                <option value="off">Hide advanced options</option>
+                <option value="on">Display advanced options</option>
+            </param>
+            <when value="on">
+                <param name="mfoldlo" type="integer" label="Fold-enrichment lower limit" value="10" help="Select the regions with MFOLD high-confidence enrichment ratio against background to build model (--mfold)"/>
+                <param name="mfoldhi" type="integer" label="Fold-enrichment upper-limit" value="30" help="Select the regions with MFOLD high-confidence enrichment ratio against background to build model (--mfold)"/>
+                <param name="nolambda" label="Use fixed background lambda as local lambda for every peak region" type="boolean" truevalue="--nolambda" falsevalue="" checked="False" help="up to 9X more time consuming (--nolambda)"/>
+                <conditional name="broad_options">
+                    <param name="broad_options_selector" type="select" label="Composite broad regions" help="by putting nearby highly enriched regions into a broad region with loose cutoff (--broad)">
+                        <option value="">No broad regions</option>
+                        <option value="--broad">broad regions</option>
+                    </param>
+                    <when value="--broad">
+                        <param name="broad_cutoff" type="float" label="Cutoff for broad region" value="0.1" help="value is either p-value or q-value as specified above (--broad-cutoff)"/>
+                    </when>
+                </conditional>
+            </when>
+            <when value="off" />
+        </conditional>
+
+    </inputs>
+    <outputs>
+        <!--callpeaks output-->
+        <data name="output_bed" format="tabular" from_work_dir="MACS2_PREFIX_peaks.xls" label="${tool.name} on ${on_string} (peaks: xls)">
+            <filter>'peaks_bed' in outputs</filter>
+        </data>
+        <data name="output_narrowpeaks" format="tabular" from_work_dir="MACS2_PREFIX_peaks.narrowPeak" label="${tool.name} on ${on_string} (narrow Peaks)">
+            <filter>'narrow' in outputs</filter>
+        </data>
+        <data name="output_broadpeaks" format="tabular" from_work_dir="MACS2_PREFIX_peaks.broadPeak" label="${tool.name} on ${on_string} (broad Peaks)">
+            <filter>'broad' in outputs</filter>
+        </data>
+        <data name="output_gappedpeaks" format="tabular" from_work_dir="MACS2_PREFIX_peaks.gappedPeak" label="${tool.name} on ${on_string} (gapped Peaks)">
+            <filter>'gapped' in outputs</filter>
+        </data>
+        <data name="output_summits" format="bed" from_work_dir="MACS2_PREFIX_summits.bed" label="${tool.name} on ${on_string} (summits)">
+            <filter>'summits' in outputs</filter>
+        </data>
+        <data name="output_xls_to_interval_peaks_file" format="interval" label="${tool.name} on ${on_string} (peaks: interval)">
+            <filter>'peaks_interval' in outputs</filter>
+        </data>
+        <data name="output_extra_files" format="html" label="${tool.name} on ${on_string} (html report)">
+            <filter>'html' in outputs</filter>
+        </data>
+  </outputs>
+  <tests>
+    <!--none yet for macs2-->
+  </tests>
+  <help>
+**What it does**
+
+With the improvement of sequencing techniques, chromatin immunoprecipitation followed by high throughput sequencing (ChIP-Seq)
+is getting popular to study genome-wide protein-DNA interactions. To address the lack of powerful ChIP-Seq analysis method, we present a novel algorithm, named Model-based Analysis of ChIP-Seq (MACS), for
+identifying transcript factor binding sites. MACS captures the influence of genome complexity to evaluate the significance of enriched ChIP regions, and MACS improves the spatial resolution of
+binding sites through combining the information of both sequencing tag position and orientation. MACS can be easily used for ChIP-Seq data alone, or with control sample with the increase of specificity.
+
+View the original MACS2 documentation: https://github.com/taoliu/MACS/blob/master/README
+
+------
+
+**Usage**
+
+**Peak Calling**: Main MACS2 Function to Call peaks from alignment results.
+
+**Compare .bdg files**: Deduct noise by comparing two signal tracks in bedGraph.
+
+
+------
+
+**Citation**
+
+For the underlying tool, please cite Zhang Y, Liu T, Meyer CA, Eeckhoute J, Johnson DS, Bernstein BE, Nusbaum C, Myers RM, Brown M, Li W, Liu XS. Model-based analysis of ChIP-Seq (MACS). Genome Biol. 2008;9(9):R137.
+
+Integration of MACS2 with Galaxy performed by Ziru Zhou ( ziruzhou@gmail.com ). Please send your comments/questions to modENCODE DCC at help@modencode.org.
+  </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macs2_filterdup.xml	Thu Jan 16 13:31:17 2014 -0500
@@ -0,0 +1,64 @@
+<tool id="macs2_filterdup" name="Remove duplicate reads" version="2.0.10.0">
+    <description>at the same position</description>
+    <requirements>
+        <requirement type="python-module">macs2</requirement>
+        <requirement type="python-module">numpy</requirement>
+        <requirement type="package" version="2.0.10.2">macs2</requirement>
+        <requirement type="package" version="1.7.1">numpy</requirement>
+    </requirements>
+    <command>
+        macs2 filterdup
+            -t $infile
+            -o $outfile
+
+        --format '$ifile.extension.upper()'
+        --gsize $gsize
+        --tsize $tsize
+        --pvalue $pvalue
+        #if str( $keep_dup_options.keep_dup_options_selector ) == "user":
+            --keep-dup $keep_dup_options.user_keepdup
+        #else
+            --keep-dup str( $keep_dup_options.keep_dup_options_selector )
+        #end if
+    </command>
+    <inputs>
+
+        <!--may need to add a few more formats at later time-->
+        <param name="infile" type="data" format="sam,bam,bed" label="Sequencing alignment file" />
+        <param name="gsize" type="float" label="Effective genome size" value="2.7e+9" help="Human: 3.3e+9, Mouse: 3.0e+9, Fly: 1.9e+8, Worm: 1.3e+8 (--gsize)" />
+        <param name="tsize" type="float" label="Tag size" value="-1.0" help="This will overide the auto detected tag size. DEFAULT: Not set (-1.0)  (--tsize)" />
+        <param name="pvalue" type="float" label="Pvalue cutoff for binomial distribution test" value="1e-5" help="default: 1e-5 (--pvalue)" />
+
+        <conditional name="keep_dup_options">
+            <param name="keep_dup_options_selector" type="select" label="controlling behavior of duplicate tags at the exact same location"
+                help="It controls the 'macs2 filterdup' behavior towards duplicate tags at the exact same location (the same coordination and the same strand. The default 'auto') option makes 'macs2 filterdup' calculate the maximum tags at the exact same location based on binomal distribution using given -p as pvalue cutoff; and the 'all' option keeps every tags (useful if you only want to convert formats). If an integer is given, at most this number of tags will be kept at the same location. Default: auto">
+                <option value="auto">auto</option>
+                <option value="all">all</option>
+                <option value="user">user defined</option>
+            </param>
+            <when value="user">
+                <param name="user_keepdup" type="integer" label="Keep at most this number of tags" value="10"/>
+            </when>
+        </conditional>
+
+    </inputs>
+    <outputs>
+        <data name="outfile" format="bed" label="${tool.name} on ${on_string}" />
+  </outputs>
+  <tests>
+    <!--none yet for macs2-->
+  </tests>
+  <help>
+**What it does**
+
+Remove duplicate reads at the same position, then convert acceptable format to BED format.
+filterdup tool from macs2
+------
+
+**Citation**
+
+For the underlying tool, please cite Zhang Y, Liu T, Meyer CA, Eeckhoute J, Johnson DS, Bernstein BE, Nusbaum C, Myers RM, Brown M, Li W, Liu XS. Model-based analysis of ChIP-Seq (MACS). Genome Biol. 2008;9(9):R137.
+
+Integration of MACS2 with Galaxy performed by Ziru Zhou ( ziruzhou@gmail.com ). Please send your comments/questions to modENCODE DCC at help@modencode.org.
+  </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macs2_randsample.xml	Thu Jan 16 13:31:17 2014 -0500
@@ -0,0 +1,62 @@
+<tool id="macs2_randsamoke" name="Randomly sample number or percentage" version="2.0.10.0">
+    <description>of total reads</description>
+    <requirements>
+        <requirement type="python-module">macs2</requirement>
+        <requirement type="python-module">numpy</requirement>
+        <requirement type="package" version="2.0.10.2">macs2</requirement>
+        <requirement type="package" version="1.7.1">numpy</requirement>
+    </requirements>
+    <command>
+        macs2 randsample
+            -t $infile
+            -o $outfile
+
+        --format '$ifile.extension.upper()'
+
+        --tsize $tsize
+        #if str($method_options.method_options_selector ) == 'percentage':
+            $method_options.percentage
+        #else:
+            $method_options.number
+        #end if
+
+    </command>
+    <inputs>
+
+        <!--may need to add a few more formats at later time-->
+        <param name="infile" type="data" format="sam,bam,bed" label="Sequencing alignment file" />
+        <param name="tsize" type="float" label="Tag size" value="-1.0" help="This will overide the auto detected tag size. DEFAULT: Not set (-1.0)  (--tsize)" />
+
+        <conditional name="method_options">
+            <param name="method_options_selector" type="select" label="Select action to be performed">
+                <option value="percentage">Percentage</option>
+                <option value="number">Number</option>
+            </param>
+            <when value="percentage">
+                    <param name="percentage" type="float" value="80.0" label="Pvalue cutoff for binomial distribution test" help="(--percentage)" />
+            </when>
+            <when value="number">
+                    <param name="number" type="integer" value="800000" label="Number of tags you want to keep" help="Note that the number of tags in output is approximate as the number specified here (--number)" />
+            </when>
+        </conditional>
+
+    </inputs>
+    <outputs>
+        <data name="outfile" format="bed" label="${tool.name} on ${on_string}" />
+  </outputs>
+  <tests>
+    <!--none yet for macs2-->
+  </tests>
+  <help>
+**What it does**
+
+randsample tool from macs2
+------
+
+**Citation**
+
+For the underlying tool, please cite Zhang Y, Liu T, Meyer CA, Eeckhoute J, Johnson DS, Bernstein BE, Nusbaum C, Myers RM, Brown M, Li W, Liu XS. Model-based analysis of ChIP-Seq (MACS). Genome Biol. 2008;9(9):R137.
+
+Integration of MACS2 with Galaxy performed by Ziru Zhou ( ziruzhou@gmail.com ). Please send your comments/questions to modENCODE DCC at help@modencode.org.
+  </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macs2_refinepeak.xml	Thu Jan 16 13:31:17 2014 -0500
@@ -0,0 +1,46 @@
+<tool id="macs2_refinepeak" name="Refine peak summits" version="2.0.10.0">
+    <description></description>
+    <requirements>
+        <requirement type="python-module">macs2</requirement>
+        <requirement type="python-module">numpy</requirement>
+        <requirement type="package" version="2.0.10.2">macs2</requirement>
+        <requirement type="package" version="1.7.1">numpy</requirement>
+    </requirements>
+    <command>
+
+        macs2 refinepeak
+            -b $bed_infile
+            -i $infile
+            --format '$ifile.extension.upper()'
+            --cutoff $cutoff
+            --window-size $winsize
+            --ofile $ofile
+
+    </command>
+    <inputs>
+        <param name="infile" type="data" format="sam,bam,bed" label="Sequencing alignment file" />
+        <param name="bed_infile" type="data" format="bed" label="Candidate peak file in BED format" />
+        <param name="cutoff" type="float" label="Cutoff" value="5.0" help="DEFAULT: 5.0 (--cutoff)"/>
+        <param name="winsize" type="integer" value="200" label="Scan window size on both side of the summit" help="DEFAULT: 200bp (--window-size)" />
+    </inputs>
+
+    <outputs>
+        <data name="ofile" format="bed" label="${tool.name} on ${on_string}" />
+    </outputs>
+    <tests>
+        <!--none yet for macs2-->
+    </tests>
+    <help>
+**What it does**
+
+(Experimental) Take raw reads alignment, refine peak summits and give scores measuring balance of forward- backward tags. Inspired by SPP.
+
+------
+
+**Citation**
+
+For the underlying tool, please cite Zhang Y, Liu T, Meyer CA, Eeckhoute J, Johnson DS, Bernstein BE, Nusbaum C, Myers RM, Brown M, Li W, Liu XS. Model-based analysis of ChIP-Seq (MACS). Genome Biol. 2008;9(9):R137.
+
+Integration of MACS2 with Galaxy performed by Ziru Zhou ( ziruzhou@gmail.com ). Please send your comments/questions to modENCODE DCC at help@modencode.org.
+    </help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/readme.rst	Thu Jan 16 13:31:17 2014 -0500
@@ -0,0 +1,60 @@
+========================
+Galaxy wrapper for MACS2
+========================
+
+With the improvement of sequencing techniques, chromatin immunoprecipitation 
+followed by high throughput sequencing (ChIP-Seq) is getting popular to study 
+genome-wide protein-DNA interactions. To address the lack of powerful ChIP-Seq 
+analysis method, we present a novel algorithm, named Model-based Analysis of 
+ChIP-Seq (MACS), for identifying transcript factor binding sites. MACS captures 
+the influence of genome complexity to evaluate the significance of enriched ChIP 
+regions, and MACS improves the spatial resolution of binding sites through 
+combining the information of both sequencing tag position and orientation. 
+MACS can be easily used for ChIP-Seq data alone, or with control sample with the increase of specificity.
+
+
+============
+Installation
+============
+
+It is recommended to install this wrapper via the `Galaxy Tool Shed`.
+
+.. _`Galaxy Tool Shed`: http://toolshed.g2.bx.psu.edu/view/modencode-dcc/macs2
+
+
+=======
+History
+=======
+- v2.0.10.1: Initial public release
+- v2.0.10.3: add "broad peaks" options
+
+
+====================
+Detailed description
+====================
+
+View the original MACS2 documentation: https://github.com/taoliu/MACS/blob/master/README.rst
+
+
+===============================
+Wrapper Licence (MIT/BSD style)
+===============================
+
+Permission to use, copy, modify, and distribute this software and its
+documentation with or without modifications and for any purpose and
+without fee is hereby granted, provided that any copyright notices
+appear in all copies and that both those copyright notices and this
+permission notice appear in supporting documentation, and that the
+names of the contributors or copyright holders not be used in
+advertising or publicity pertaining to distribution of the software
+without specific prior permission.
+
+THE CONTRIBUTORS AND COPYRIGHT HOLDERS OF THIS SOFTWARE DISCLAIM ALL
+WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT
+OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
+OR PERFORMANCE OF THIS SOFTWARE.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml	Thu Jan 16 13:31:17 2014 -0500
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<tool_dependency>
+    <package name="numpy" version="1.7.1">
+       <repository changeset_revision="84125ffacb90" name="package_numpy_1_7" owner="iuc" toolshed="http://testtoolshed.g2.bx.psu.edu" />
+    </package>
+    <package name="scipy" version="0.12">
+       <repository changeset_revision="3c1bf479158c" name="package_scipy_0_12" owner="iuc" toolshed="http://testtoolshed.g2.bx.psu.edu" />
+    </package>
+    <package name="macs2" version="2.0.10.2">
+        <install version="1.0">
+            <actions>
+                <action type="setup_virtualenv">MACS2==2.0.10.07132012</action>
+            </actions>
+        </install>
+        <readme>Macs2 installation instructions. MACS2 can be found at https://github.com/taoliu/MACS</readme>
+    </package>
+</tool_dependency>