changeset 0:06cb587a5e87 draft

Uploaded initial version 2.1.0-4.
author pjbriggs
date Tue, 30 Jun 2015 08:16:18 -0400
parents
children 02a01ea54722
files README.rst macs21_wrapper.py macs21_wrapper.xml test-data/test_MACS2.1.0_bw_html_report.zip test-data/test_MACS2.1.0_control_lambda.bdg test-data/test_MACS2.1.0_html_report.zip test-data/test_MACS2.1.0_peaks.xls test-data/test_MACS2.1.0_peaks.xls.re_match test-data/test_MACS2.1.0_peaks_narrowPeak.interval test-data/test_MACS2.1.0_summits.bed test-data/test_MACS2.1.0_treat_pileup.bdg test-data/test_MACS2.1.0_treat_pileup.bw test-data/test_region_IP.bed test-data/test_region_Input.bed tool_dependencies.xml
diffstat 15 files changed, 1237 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.rst	Tue Jun 30 08:16:18 2015 -0400
@@ -0,0 +1,99 @@
+MACS21: Model-based Analysis of ChIP-Seq (MACS 2.1.0) peak calling
+==================================================================
+
+Galaxy tool wrapper for the peak calling function of MACS 2.1.0. MACS has been
+developed by Tao Lui
+https://github.com/taoliu/MACS/
+
+The reference for MACS is:
+
+- 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
+
+Automated installation
+======================
+
+Installation via the Galaxy Tool Shed will take of installing the tool wrapper and
+the MACS 2.1.0 program.
+
+Manual Installation
+===================
+
+There are two files to install:
+
+- ``macs21_wrapper.xml`` (the Galaxy tool definition)
+- ``macs21_wrapper.py.sh`` (the Python script wrapper)
+
+The suggested location is in a ``tools/macs21/`` folder. You will then
+need to modify the ``tools_conf.xml`` file to tell Galaxy to offer the tool
+by adding the line:
+
+    <tool file="macs21/macs21_wrapper.xml" />
+
+You will also need to install MACS 2.1.0 and its dependencies:
+
+- https://pypi.python.org/pypi/MACS2
+
+and ensure that it's on your Galaxy user's ``PATH`` when running the tool.
+
+If you want to run the functional tests, copy the sample test files under
+sample test files under Galaxy's ``test-data/`` directory. Then:
+
+    ./run_tests.sh -id macs2_wrapper
+
+
+History
+=======
+
+This tool was originally based on the ``modencode-dcc`` MACS2 tool developed
+by Ziru Zhou (ziruzhou@gmail.com), specifically the ``16:14f378e35191``
+revision of the tool available via
+
+- http://toolshed.g2.bx.psu.edu/view/modencode-dcc/macs2 
+
+This version has been substantially modified both to adapt it to MACS 2.1.0, and
+to re-implement the internal workings of the tool to conform with current
+practices in invoking commands from Galaxy, and to add new functionality.
+
+========== ======================================================================
+Version    Changes
+---------- ----------------------------------------------------------------------
+2.1.0-4    - Remove 'bdgcmp' functionality.
+2.1.0-3    - Add tool tests
+2.1.0-2    - Add option to create bigWig file from bedGraphs; fix bug with -B
+             option; make --mfold defaults consistent.
+2.1.0-1    - Initial version
+========== ======================================================================
+
+
+Developers
+==========
+
+This tool is developed on the following GitHub repository:
+https://github.com/fls-bioinformatics-core/galaxy-tools/tree/master/macs21
+
+For making the "Galaxy Tool Shed" http://toolshed.g2.bx.psu.edu/ tarball I use
+the ``package_macs21_wrapper.sh`` script.
+
+
+Licence (MIT)
+=============
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macs21_wrapper.py	Tue Jun 30 08:16:18 2015 -0400
@@ -0,0 +1,262 @@
+#!/bin/env python
+#
+# Galaxy wrapper to run MACS 2.1
+#
+# Completely rewritten from the original macs2 wrapped by Ziru Zhou
+# taken from http://toolshed.g2.bx.psu.edu/view/modencode-dcc/macs2
+
+import sys
+import os
+import subprocess
+import tempfile
+import shutil
+
+def move_file(working_dir,name,destination):
+    """Move a file 'name' from 'working_dir' to 'destination'
+
+    """
+    if destination is None:
+        # Nothing to do
+        return
+    source = os.path.join(working_dir,name)
+    if os.path.exists(source):
+        shutil.move(source,destination)
+
+def convert_xls_to_interval(xls_file,interval_file,header=None):
+    """Convert MACS XLS file to interval
+
+    From the MACS readme: "Coordinates in XLS is 1-based which is different with
+    BED format."
+
+    However this function no longer performs any coordinate conversions, it
+    simply ensures that any blank or non-data lines are commented out
+
+    """
+    fp = open(interval_file,'wb')
+    if header:
+        fp.write('#%s\n' % header)
+    for line in open(xls_file):
+        # Keep all existing comment lines
+        if line.startswith('#'):
+            fp.write(line)
+        else:
+            # Split line into fields and test to see if
+            # the 'start' field is actually an integer
+            fields = line.split('\t')
+            if len(fields) > 1:
+                try:
+                    int(fields[1])
+                except ValueError:
+                    # Integer conversion failed so comment out
+                    # "bad" line instead
+                    fields[0] = "#%s" % fields[0]
+            fp.write( '\t'.join( fields ) )
+    fp.close()
+
+def make_bigwig_from_bedgraph(bedgraph_file,bigwig_file,
+                              chrom_sizes,working_dir=None):
+    """Make bigWig file from a bedGraph
+
+    The protocol is:
+
+    $ fetchChromSizes.sh mm9 > mm9.chrom.sizes
+    $ bedClip treat.bedgraph mm9.chrom.sizes treat.clipped
+    $ bedGraphToBigWig treat.clipped mm9.chrom.sizes treat.bw
+
+    Get the binaries from
+    http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/
+
+    We skip the fetchChromSizes step if the 'chrom_sizes'
+    argument supplied a valid file with the chromosome sizes
+    for the genome build in question.
+
+    """
+    print "Generating bigWig from bedGraph..."
+    # Check for chromosome sizes
+    if not os.path.exists(chrom_sizes):
+        # Determine genome build
+        chrom_sizes = os.path.basename(chrom_sizes)
+        genome_build = chrom_sizes.split('.')[0]
+        if genome_build == '?':
+            # No genome build set
+            sys.stderr.write("ERROR genome build not set, cannot get sizes for '?'\n")
+            sys.stderr.write("Assign a genome build to your input dataset and rerun\n")
+            sys.exit(1)
+        print "Missing chrom sizes file, attempting to fetch for '%s'" % genome_build
+        # Run fetchChromSizes
+        chrom_sizes = os.path.join(working_dir,chrom_sizes)
+        stderr_file = os.path.join(working_dir,"fetchChromSizes.stderr")
+        cmd = "fetchChromSizes %s" % genome_build
+        print "Running %s" % cmd
+        proc = subprocess.Popen(args=cmd,shell=True,cwd=working_dir,
+                                stdout=open(chrom_sizes,'wb'),
+                                stderr=open(stderr_file,'wb'))
+        proc.wait()
+        # Copy stderr from fetchChromSizes for information only
+        for line in open(stderr_file,'r'):
+            print line.strip()
+        os.remove(stderr_file)
+        # Check that the sizes file was downloaded
+        if not os.path.exists(chrom_sizes):
+            sys.stderr.write("Failed to download chrom sizes for '%s'\n" % genome_build)
+            sys.exit(1)
+    # Run bedClip
+    treat_clipped = "%s.clipped" % os.path.basename(bedgraph_file)
+    cmd = "bedClip %s %s %s" % (bedgraph_file,chrom_sizes,treat_clipped)
+    print "Running %s" % cmd
+    proc = subprocess.Popen(args=cmd,shell=True,cwd=working_dir)
+    proc.wait()
+    # Check that clipped file exists
+    treat_clipped = os.path.join(working_dir,treat_clipped)
+    if not os.path.exists(treat_clipped):
+        sys.stderr.write("Failed to create clipped bed file\n")
+        sys.exit(1)
+    # Run bedGraphToBigWig
+    cmd = "bedGraphToBigWig %s %s %s" % (treat_clipped,chrom_sizes,
+                                         bigwig_file)
+    print "Running %s" % cmd
+    proc = subprocess.Popen(args=cmd,shell=True,cwd=working_dir)
+    proc.wait()
+    # Clean up temporary chrom length file
+    if os.path.dirname(chrom_sizes) == working_dir:
+        print "Removing temporary chrom sizes file"
+        os.remove(chrom_sizes)
+
+if __name__ == "__main__":
+
+    # Echo the command line
+    print ' '.join(sys.argv)
+
+    # Initialise output files - values are set by reading from
+    # the command line supplied by the Galaxy wrapper
+    output_extra_html = None
+    output_extra_path = None
+    output_broadpeaks = None
+    output_gappedpeaks = None
+    output_narrowpeaks = None
+    output_treat_pileup = None
+    output_lambda_bedgraph = None
+    output_bigwig = None
+    output_xls_to_interval_peaks_file = None
+    output_peaks = None
+    output_bdgcmp = None
+
+    # Other initialisations
+    chrom_sizes_file = None
+
+    # Build the MACS 2.1 command line
+    # Initial arguments are always the same: command & input ChIP-seq file name
+    cmdline = ["macs2 %s -t %s" % (sys.argv[1],sys.argv[2])]
+
+    # Process remaining args
+    for arg in sys.argv[3:]:
+        if arg.startswith('--format='):
+            # Convert format to uppercase
+            format_ = arg.split('=')[1].upper()
+            cmdline.append("--format=%s" % format_)
+        elif arg.startswith('--name='):
+            # Replace whitespace in name with underscores
+            experiment_name = '_'.join(arg.split('=')[1].split())
+            cmdline.append("--name=%s" % experiment_name)
+        elif arg.startswith('--length='):
+            # Extract chromosome size file
+            chrom_sizes_file = arg.split('=')[1]
+        elif arg.startswith('--output-'):
+            # Handle destinations for output files
+            arg0,filen = arg.split('=')
+            if arg0 == '--output-summits':
+                output_summits = filen
+            elif arg0 == '--output-extra-files':
+                output_extra_html = filen
+            elif  arg0 == '--output-extra-files-path':
+                output_extra_path = filen
+            elif  arg0 == '--output-broadpeaks':
+                output_broadpeaks = filen
+            elif  arg0 == '--output-gappedpeaks':
+                output_gappedpeaks = filen
+            elif  arg0 == '--output-narrowpeaks':
+                output_narrowpeaks = filen
+            elif  arg0 == '--output-pileup':
+                output_treat_pileup = filen
+            elif  arg0 == '--output-lambda-bedgraph':
+                output_lambda_bedgraph = filen
+            elif  arg0 == '--output-bigwig':
+                output_bigwig = filen
+            elif  arg0 == '--output-xls-to-interval':
+                output_xls_to_interval_peaks_file = filen
+            elif  arg0 == '--output-peaks':
+                output_peaks = filen
+        else:
+            # Pass remaining args directly to MACS
+            # command line
+            cmdline.append(arg)
+    
+    cmdline = ' '.join(cmdline)
+    print "Generated command line:\n%s" % cmdline
+
+    # Execute MACS2
+    #
+    # Make a working directory
+    working_dir = tempfile.mkdtemp()
+    #
+    # Collect stderr in a file for reporting later
+    stderr_filen = tempfile.NamedTemporaryFile().name
+    #
+    # Run MACS2
+    proc = subprocess.Popen(args=cmdline,shell=True,cwd=working_dir,
+                            stderr=open(stderr_filen,'wb'))
+    proc.wait()
+    
+    # Run R script to create PDF from model script
+    if os.path.exists(os.path.join(working_dir,"%s_model.r" % experiment_name)):
+        cmdline = 'R --vanilla --slave < "%s_model.r" > "%s_model.r.log"' % \
+                  (experiment_name, experiment_name)
+        proc = subprocess.Popen(args=cmdline,shell=True,cwd=working_dir)
+        proc.wait()
+
+    # Convert XLS to interval, if requested
+    if output_xls_to_interval_peaks_file is not None:
+        peaks_xls_file = os.path.join(working_dir,'%s_peaks.xls' % experiment_name )
+        if os.path.exists(peaks_xls_file):
+            convert_xls_to_interval(peaks_xls_file,output_xls_to_interval_peaks_file,
+                                    header='peaks file')
+
+    # Create bigWig from bedGraph, if requested
+    if output_bigwig is not None:
+        treat_bedgraph_file = os.path.join(working_dir,'%s_treat_pileup.bdg' % experiment_name)
+        if os.path.exists(treat_bedgraph_file):
+            make_bigwig_from_bedgraph(treat_bedgraph_file,output_bigwig,
+                                      chrom_sizes_file,working_dir)
+        
+    # Move MACS2 output files from working dir to their final destinations
+    move_file(working_dir,"%s_summits.bed" % experiment_name,output_summits)
+    move_file(working_dir,"%s_peaks.xls" % experiment_name,output_peaks)
+    move_file(working_dir,"%s_peaks.narrowPeak" % experiment_name,output_narrowpeaks)
+    move_file(working_dir,"%s_peaks.broadPeak" % experiment_name,output_broadpeaks)
+    move_file(working_dir,"%s_peaks.gappedPeak" % experiment_name,output_gappedpeaks)
+    move_file(working_dir,"%s_treat_pileup.bdg" % experiment_name,output_treat_pileup)
+    move_file(working_dir,"%s_control_lambda.bdg" % experiment_name,output_lambda_bedgraph)
+    move_file(working_dir,"bdgcmp_out.bdg",output_bdgcmp)
+
+    # Move remaining file to the 'extra files' path and link from the HTML
+    # file to allow user to access them from within Galaxy
+    html_file = open(output_extra_html,'wb')
+    html_file.write('<html><head><title>Additional output created by MACS (%s)</title></head><body><h3>Additional Files:</h3><p><ul>\n' % experiment_name)
+    # Make the 'extra files' directory
+    os.mkdir(output_extra_path)
+    # Move the files
+    for filen in sorted(os.listdir(working_dir)):
+        shutil.move(os.path.join(working_dir,filen),
+                    os.path.join(output_extra_path,filen))
+        html_file.write( '<li><a href="%s">%s</a></li>\n' % (filen,filen))
+    # All files moved, close out HTML
+    html_file.write( '</ul></p>\n' )
+    # Append any stderr output
+    html_file.write('<h3>Messages from MACS:</h3>\n<p><pre>%s</pre></p>\n' %
+                    open(stderr_filen,'rb').read())
+    html_file.write('</body></html>\n')
+    html_file.close()
+
+    # Clean up the working directory and files
+    os.unlink(stderr_filen)
+    os.rmdir(working_dir)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macs21_wrapper.xml	Tue Jun 30 08:16:18 2015 -0400
@@ -0,0 +1,398 @@
+<tool id="macs2_1_peakcalling" name="MACS2.1.0" version="2.1.0-4">
+  <description>Model-based Analysis of ChIP-Seq: peak calling</description>
+  <requirements>
+    <requirement type="package" version="2.7">python</requirement>
+    <requirement type="package" version="1.9">numpy</requirement>
+    <requirement type="package" version="2.1.0.20140616">macs2</requirement>
+    <requirement type="package" version="3.1.2">R</requirement>
+    <requirement type="package" version="1.0">ucsc_tools_for_macs21</requirement>
+  </requirements>
+  <version_command>macs2 --version</version_command>
+  <command interpreter="python">
+    macs21_wrapper.py callpeak
+    ##
+    ## ChIP-seq input
+    $input_chipseq_file1
+    ##
+    ## ChIP-seq control
+    #if str($input_control_file1) != 'None'
+       -c $input_control_file1
+    #end if
+    ##
+    --format=$input_chipseq_file1.extension
+    --name="$experiment_name"
+    --bw=$bw
+    ##
+    ## Genome size
+    #if str($genome_size.gsize) == ''
+       --gsize=$genome_size.user_defined_gsize
+    #else:
+       --gsize=$genome_size.gsize
+    #end if
+    ##
+    ## Broad peaks
+    #if str($broad_options.broad_regions) == 'broad'
+       --broad --broad-cutoff=$broad_options.broad_cutoff
+    #end if
+    ##
+    ## (no)model options
+    #if str($nomodel_type.nomodel_type_selector) == 'nomodel'
+       --nomodel --extsize=$nomodel_type.extsize
+    #end if
+    ##
+    ## pq value select options
+    #if str($pq_options.pq_options_selector) == 'qvalue'
+       --qvalue=$pq_options.qvalue
+    #else
+       --pvalue=$pq_options.pvalue
+    #end if
+    ##
+    ## Bedgraph options
+    #if $bdg_options.bdg
+       -B $bdg_options.spmr
+    #end if
+    ##
+    ## Advanced options
+    #if $advanced_options.advanced_options_selector
+       --mfold $advanced_options.mfoldlo $advanced_options.mfoldhi
+       $advanced_options.nolambda
+       $advanced_options.call_summits
+       #if str($advanced_options.keep_duplicates.keep_dup) == ''
+          --keep-dup $advanced_options.keep_duplicates.maximum_tags
+       #else
+          --keep-dup $advanced_options.keep_duplicates.keep_dup
+       #end if
+    #else
+       ## Defaults if advanced options not set
+       --mfold 10 30 --keep-dup 1
+    #end if
+    ##
+    ## Output files
+    --output-summits=$output_summits_bed_file
+    --output-extra-files=$output_extra_files
+    --output-extra-files-path=$output_extra_files.files_path
+    ##
+    ## Narrow/broad peak outputs
+    #if str($broad_options.broad_regions) == 'broad'
+       --output-broadpeaks=$output_broadpeaks_file
+       --output-gappedpeaks=$output_gappedpeaks_file
+    #else
+       --output-narrowpeaks=$output_narrowpeaks_file
+    #end if
+    ##
+    ## Bedgraph outputs
+    #if $bdg_options.bdg
+       --output-pileup=$output_treat_pileup_file 
+       --output-lambda-bedgraph=$output_lambda_bedgraph_file
+       #if $bdg_options.make_bigwig
+          --output-bigwig=$output_bigwig_file
+          --length=$GALAXY_DATA_INDEX_DIR/shared/ucsc/chrom/${input_chipseq_file1.dbkey}.len
+       #end if
+    #end if
+    ##
+    ## XLS/interval output
+    #if str($xls_to_interval) == 'True'
+       --output-xls-to-interval=$output_xls_to_interval_peaks_file
+    #else
+       --output-peaks=$output_peaks_file
+    #end if
+  </command>
+  <inputs>
+    <!--experiment name used as base for output file names -->
+    <param name="experiment_name" type="text" value="MACS2.1.0 in Galaxy" size="50"
+	   label="Experiment Name"/>
+    <!--choose 'broad' or 'narrow' regions-->
+    <conditional name="broad_options">
+      <param name="broad_regions" type="select" label="Type of region to call"
+	     help="Broad regions are formed by linking nearby enriched regions">
+	<option value="" selected="true">Narrow regions</option>
+	<option value="broad">Broad regions</option>
+      </param>
+      <when value="broad">
+	<param name="broad_cutoff" type="float"
+	       label="Cutoff for broad regions"
+	       value="0.1" help="default: 0.1 (--broad-cutoff)"/>
+      </when>
+    </conditional>
+    <param name="input_chipseq_file1" type="data" format="bed,sam,bam"
+	   label="ChIP-seq read file" />
+    <param name="input_control_file1" type="data" format="bed,sam,bam" optional="True"
+	   label="ChIP-seq control read file" />
+    <conditional name="genome_size">
+      <param name="gsize" type="select" label="Effective genome size"
+	     help="Either pre-defined (for common organisms), or user-defined (--gsize)">
+	<option value="hs" selected="true">Human (2.7e9)</option>
+	<option value="mm">Mouse (1.87e9)</option>
+	<option value="ce">C. elegans (9e7)</option>
+	<option value="dm">Fruitfly (1.2e8)</option>
+	<option value="">User-defined</option>
+      </param>
+      <when value="">
+	<!-- User-defined effective genome size -->
+	<param name="user_defined_gsize" type="float" value=""
+	       label="Enter effective genome size (number of bases)"
+	       help="e.g. '1.0e+9' or '1000000000'" />
+      </when>
+    </conditional>
+    <param name="bw" type="integer" label="Band width" value="300" help="(--bw)"/>
+    <param name="xls_to_interval" label="Include XLS file from MACS"
+	   type="boolean" truevalue="True" falsevalue="False" checked="True"
+	   help="MACS2 XLS file will be output to the history in 'interval' format (suitable for subsequent analysis in Galaxy). Note that start positions are 1-based."/>
+
+    <conditional name="bdg_options">
+      <param name="bdg"
+	     label="Save treatment and control lambda pileups in bedGraph"
+	     type="boolean" truevalue="-B" falsevalue="" checked="False" />
+      <when value="-B">
+	<param name="spmr"
+	       type="boolean" truevalue="--SPMR" falsevalue="" checked="False"
+	       label="Save signal per million reads for fragment pileup profiles"
+	       help="(--SPMR)" />
+	<param name="make_bigwig" type="boolean" checked="True"
+	       truevalue="True" falsevalue=""
+	       label="Also generate bigWig file from bedGraph"
+	       help="bigWig file can used in subsequent analyses e.g. CEAS" />
+      </when>
+      <when value="">
+	<!-- Display nothing -->
+      </when>
+    </conditional>
+
+    <conditional name="pq_options">
+      <param name="pq_options_selector" type="select"
+	     label="Select p-value or q-value" 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 binding region detection"
+	       value="1e-2" help="default: 1e-2 (--pvalue)"/>
+      </when>
+      <when value="qvalue">
+	<param name="qvalue" type="float"
+	       label="q-value cutoff for binding region detection"
+	       value="0.01" help="default: 0.01 (--qvalue)"/>
+      </when>
+    </conditional>
+    <conditional name="advanced_options">
+      <param name="advanced_options_selector"
+	     type="boolean" truevalue="on" falsevalue="off" checked="False"
+	     label="Use advanced options?" />
+      <when value="on">
+        <param name="mfoldlo" type="integer"
+	       label="Select the regions with MFOLD high-confidence enrichment ratio against background to build model (lower-limit)"
+	       value="10" help="(--mfold)"/>
+	<param name="mfoldhi" type="integer"
+	       label="Select the regions with MFOLD high-confidence enrichment ratio against background to build model (upper-limit)"
+	       value="30" help="(--mfold)"/>
+	<param name="nolambda"
+	       label="Use fixed background lambda as local lambda for every binding region"
+	       type="boolean" truevalue="--nolambda" falsevalue="" checked="False"
+	       help="(--nolambda)"/>
+	<param name="call_summits"
+	       label="Detect subpeaks within binding region"
+	       type="boolean" truevalue="--call-summits" falsevalue="" checked="False"
+	       help="(--call-summits)"/>
+	<conditional name="keep_duplicates">
+	  <param name="keep_dup" type="select"
+		 label="Use of duplicate reads">
+	    <option value="auto">Automatically calculate maximum number of duplicates to keep (auto)</option>
+	    <option value="all">Use all duplicates (all)</option>
+	    <option value="" selected="true">Manually specify maxium number of duplicates</option>
+	  </param>
+	  <when value="">
+	    <param name="maximum_tags" type="integer" value="1"
+		   label="Maxium number of duplicated tags to keep at each location"/>
+	  </when>
+	</conditional>
+      </when>
+      <when value="off">
+	<!--display nothing-->
+      </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 enabled)</option>
+        <option value="create_model" selected="true">Build the shifting model (--nomodel disabled)</option>
+      </param>
+      <when value="nomodel">
+        <param name="extsize" type="integer" label="Arbitrary extension size in bp" value="200" help="Used as fragment size to extend each read towards 3' end (--extsize)"/>
+      </when>
+    </conditional>
+  </inputs>
+
+  <outputs>
+    <!--callpeaks output-->
+    <data name="output_extra_files" format="html"
+	  label="${tool.name}: callpeak on ${on_string} (html report)">
+    </data>
+    <data name="output_summits_bed_file" format="bed"
+	  label="${tool.name}: callpeak on ${on_string} (summits: bed)">
+    </data>
+    <data name="output_peaks_file" format="xls"
+	  label="${tool.name}: callpeak on ${on_string} (peaks: xls)">
+      <filter>xls_to_interval is False</filter>
+    </data>
+    <data name="output_narrowpeaks_file" format="interval"
+	  label="${tool.name}: callpeak on ${on_string} (peaks: narrowPeak)">
+      <filter>broad_options['broad_regions'] == ''</filter>
+    </data>
+    <data name="output_broadpeaks_file" format="interval"
+	  label="${tool.name}: callpeak on ${on_string} (peaks: broadPeak)">
+      <filter>broad_options['broad_regions'] == 'broad'</filter>
+    </data>
+    <data name="output_gappedpeaks_file" format="interval"
+	  label="${tool.name}: callpeak on ${on_string} (peaks: gappedPeak)">
+      <filter>broad_options['broad_regions'] == 'broad'</filter>
+    </data>
+    <data name="output_xls_to_interval_peaks_file" format="interval"
+	  label="${tool.name}: callpeak on ${on_string} (peaks: interval)">
+      <filter>xls_to_interval is True</filter>
+    </data>
+    <data name="output_treat_pileup_file" format="bedgraph"
+	  label="${tool.name}: callpeak on ${on_string} (treat pileup: bedGraph)">
+      <filter>bdg_options['bdg'] is True</filter>
+    </data>
+    <data name="output_lambda_bedgraph_file" format="bedgraph"
+	  label="${tool.name}: callpeak on ${on_string} (control lambda: bedGraph)">
+      <filter>bdg_options['bdg'] is True</filter>
+    </data>
+    <data name="output_bigwig_file" format="bigwig"
+	  label="${tool.name}: callpeak on ${on_string} (treat pileup: bigWig)">
+      <filter>bdg_options['bdg'] is True</filter>
+      <filter>bdg_options['make_bigwig'] is True</filter>
+    </data>
+  </outputs>
+  <tests>
+    <!-- Peak calling without bigwig output -->
+    <test>
+      <!-- Inputs -->
+      <param name="experiment_name" value="test_MACS2.1.0" />
+      <param name="broad_regions" value="" />
+      <param name="input_chipseq_file1" value="test_region_IP.bed" dbkey="galGal3"
+	     ftype="bed" />
+      <param name="input_control_file1" value="test_region_Input.bed"
+	     ftype="bed" />
+      <param name="gsize" value="" />
+      <param name="user_defined_gsize" value="775000000.0" />
+      <param name="bw" value="300" />
+      <param name="xls_to_interval" value="true" />
+      <param name="bdg_options|bdg" value="-B" />
+      <param name="bdg_options|spmr" value="--SPMR" />
+      <param name="bdg_options|make_bigwig" value="false" />
+      <param name="pq_options_selector" value="qvalue" />
+      <param name="qvalue" value="0.05" />
+      <param name="advanced_options_selector" value="true" />
+      <param name="advanced_options|mfoldlo" value="5" />
+      <param name="advanced_options|mfoldhi" value="50" />
+      <param name="advanced_options|nolambda" value="" />
+      <param name="advanced_options|call_summits" value="" />
+      <param name="advanced_options|keep_duplicates" value="" />
+      <param name="advanced_options|maximum_tags" value="1" />
+      <param name="nomodel_type_selector" value="nomodel" />
+      <param name="nomodel_type|extsize" value="243" />
+      <!-- Outputs -->
+      <output name="output_extra_files" file="test_MACS2.1.0_html_report.zip"
+	      compare="sim_size" delta="1500" />
+      <output name="output_summits_bed_file" file="test_MACS2.1.0_summits.bed" />
+      <output name="output_narrowpeaks_file" file="test_MACS2.1.0_peaks_narrowPeak.interval" />
+      <output name="output_xls_to_interval_peaks_file"
+	      file="test_MACS2.1.0_peaks.xls.re_match"
+	      compare="re_match" lines_diff="1" />
+      <output name="output_treat_pileup_file" file="test_MACS2.1.0_treat_pileup.bdg" />
+      <output name="output_lambda_bedgraph_file" file="test_MACS2.1.0_control_lambda.bdg" />
+    </test>
+    <!-- Peak calling with bigwig output -->
+    <test>
+      <!-- Inputs -->
+      <param name="experiment_name" value="test_MACS2.1.0" />
+      <param name="broad_regions" value="" />
+      <param name="input_chipseq_file1" value="test_region_IP.bed" dbkey="galGal3"
+	     ftype="bed" />
+      <param name="input_control_file1" value="test_region_Input.bed"
+	     ftype="bed" />
+      <param name="gsize" value="" />
+      <param name="user_defined_gsize" value="775000000.0" />
+      <param name="bw" value="300" />
+      <param name="xls_to_interval" value="true" />
+      <param name="bdg_options|bdg" value="-B" />
+      <param name="bdg_options|spmr" value="--SPMR" />
+      <param name="bdg_options|make_bigwig" value="true" />
+      <param name="pq_options_selector" value="qvalue" />
+      <param name="qvalue" value="0.05" />
+      <param name="advanced_options_selector" value="true" />
+      <param name="advanced_options|mfoldlo" value="5" />
+      <param name="advanced_options|mfoldhi" value="50" />
+      <param name="advanced_options|nolambda" value="" />
+      <param name="advanced_options|call_summits" value="" />
+      <param name="advanced_options|keep_duplicates" value="" />
+      <param name="advanced_options|maximum_tags" value="1" />
+      <param name="nomodel_type_selector" value="nomodel" />
+      <param name="nomodel_type|extsize" value="243" />
+      <!-- Outputs -->
+      <output name="output_extra_files" file="test_MACS2.1.0_bw_html_report.zip"
+	      compare="sim_size" delta="2500" />
+      <output name="output_summits_bed_file" file="test_MACS2.1.0_summits.bed" />
+      <output name="output_narrowpeaks_file" file="test_MACS2.1.0_peaks_narrowPeak.interval" />
+      <output name="output_xls_to_interval_peaks_file"
+	      file="test_MACS2.1.0_peaks.xls.re_match"
+	      compare="re_match" lines_diff="1" />
+      <output name="output_treat_pileup_file" file="test_MACS2.1.0_treat_pileup.bdg" />
+      <output name="output_lambda_bedgraph_file" file="test_MACS2.1.0_control_lambda.bdg" />
+      <output name="output_bigwig_file" file="test_MACS2.1.0_treat_pileup.bw"
+	      compare="sim_size" />
+    </test>
+  </tests>
+  <help>
+**What it does**
+
+MACS (Model-based Analysis of ChIP-seq) 2.1.0 provides algorithms for identifying
+transcript factor binding sites. The program can be used either for ChIP-Seq data alone,
+or with control sample data to improve specificity.
+
+View the MACS2 documentation at:
+https://github.com/taoliu/MACS/blob/master/README.rst
+
+------
+
+**Usage**
+
+The tool interfaces with the **callpeak** function in MACS, which calls peaks from
+alignment results.
+
+------
+
+**Credits**
+
+This Galaxy tool was based on the MACS2 tool hosted in the Galaxy toolshed at
+
+ * http://toolshed.g2.bx.psu.edu/view/modencode-dcc/macs2
+
+(specifically the 16:14f378e35191 revision of the tool) which is credited to Ziru
+Zhou. This version is a reimplemented version developed within the Bioinformatics
+Core Facility at the University of Manchester, which uses more up-to-date Galaxy
+syntax and adds some extra features.
+
+The tool runs Tao Liu's MACS2 software:
+
+ * https://github.com/taoliu/MACS
+
+The reference for MACS is:
+
+ * 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.
+
+Please kindly acknowledge both this Galaxy tool and the MACS2 package if you
+use it.
+  </help>
+  <citations>
+    <!--
+    See https://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax#A.3Ccitations.3E_tag_set
+    Can be either DOI or Bibtex
+    Use http://www.bioinformatics.org/texmed/ to convert PubMed to Bibtex
+    -->
+    <citation type="doi">10.1186/gb-2008-9-9-r137</citation>
+  </citations>
+</tool>
Binary file test-data/test_MACS2.1.0_bw_html_report.zip has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test_MACS2.1.0_control_lambda.bdg	Tue Jun 30 08:16:18 2015 -0400
@@ -0,0 +1,153 @@
+chr26	0	4102915	0.31355
+chr26	4102915	4103978	486.00000
+chr26	4103978	4103998	972.00000
+chr26	4103998	4104449	1458.00000
+chr26	4104449	4105233	1944.00000
+chr26	4105233	4105326	2430.00000
+chr26	4105326	4105398	2916.00000
+chr26	4105398	4105644	3402.00024
+chr26	4105644	4105855	3888.00000
+chr26	4105855	4105980	4374.00000
+chr26	4105980	4106825	4860.00000
+chr26	4106825	4107471	5346.00049
+chr26	4107471	4107794	5832.00000
+chr26	4107794	4108037	20000.00000
+chr26	4108037	4108498	6804.00049
+chr26	4108498	4108857	9720.00000
+chr26	4108857	4108877	20000.00000
+chr26	4108877	4109100	40000.00000
+chr26	4109100	4109120	20000.00000
+chr26	4109120	4109327	14580.00000
+chr26	4109327	4109570	20000.00000
+chr26	4109570	4109733	8262.00000
+chr26	4109733	4109826	9720.00000
+chr26	4109826	4109898	14580.00000
+chr26	4109898	4109949	19440.00000
+chr26	4109949	4110111	14580.00000
+chr26	4110111	4110204	20000.00000
+chr26	4110204	4110276	40000.00000
+chr26	4110276	4110354	60000.00000
+chr26	4110354	4110447	40000.00000
+chr26	4110447	4110480	24300.00195
+chr26	4110480	4110733	29160.00000
+chr26	4110733	4110765	40000.00000
+chr26	4110765	4110826	24300.00195
+chr26	4110826	4110859	20000.00000
+chr26	4110859	4110976	40000.00000
+chr26	4110976	4111102	20000.00000
+chr26	4111102	4111144	14580.00000
+chr26	4111144	4111325	12150.00098
+chr26	4111325	4111355	14580.00000
+chr26	4111355	4111704	12636.00000
+chr26	4111704	4111947	20000.00000
+chr26	4111947	4112349	13608.00098
+chr26	4112349	4112592	20000.00000
+chr26	4112592	4112706	14580.00000
+chr26	4112706	4112862	20000.00000
+chr26	4112862	4112949	40000.00000
+chr26	4112949	4113105	20000.00000
+chr26	4113105	4113145	13608.00098
+chr26	4113145	4113327	14580.00000
+chr26	4113327	4113524	13608.00098
+chr26	4113524	4113767	20000.00000
+chr26	4113767	4113775	13608.00098
+chr26	4113775	4114145	14580.00000
+chr26	4114145	4114146	12636.00000
+chr26	4114146	4114154	20000.00000
+chr26	4114154	4114389	40000.00000
+chr26	4114389	4114686	24300.00195
+chr26	4114686	4114732	40000.00000
+chr26	4114732	4114855	60000.00000
+chr26	4114855	4114929	40000.00000
+chr26	4114929	4114975	20000.00000
+chr26	4114975	4115116	14580.00000
+chr26	4115116	4115234	19440.00000
+chr26	4115234	4115308	14580.00000
+chr26	4115308	4115326	12150.00098
+chr26	4115326	4115398	11664.00000
+chr26	4115398	4115495	11178.00000
+chr26	4115495	4115635	20000.00000
+chr26	4115635	4115837	24300.00195
+chr26	4115837	4115891	29160.00000
+chr26	4115891	4115990	40000.00000
+chr26	4115990	4116014	60000.00000
+chr26	4116014	4116072	80000.00000
+chr26	4116072	4116134	60000.00000
+chr26	4116134	4116215	40000.00000
+chr26	4116215	4116233	60000.00000
+chr26	4116233	4116257	40000.00000
+chr26	4116257	4116366	29160.00000
+chr26	4116366	4116450	34020.00000
+chr26	4116450	4116512	29160.00000
+chr26	4116512	4116611	24300.00195
+chr26	4116611	4116745	20000.00000
+chr26	4116745	4116831	40000.00000
+chr26	4116831	4116988	20000.00000
+chr26	4116988	4117136	11664.00000
+chr26	4117136	4117471	12150.00098
+chr26	4117471	4117730	11664.00000
+chr26	4117730	4117973	20000.00000
+chr26	4117973	4117983	11178.00000
+chr26	4117983	4118141	10692.00098
+chr26	4118141	4118645	11178.00000
+chr26	4118645	4118886	10692.00098
+chr26	4118886	4118904	11178.00000
+chr26	4118904	4119267	11664.00000
+chr26	4119267	4119275	11178.00000
+chr26	4119275	4119282	10692.00098
+chr26	4119282	4119525	20000.00000
+chr26	4119525	4119734	11178.00000
+chr26	4119734	4119808	10692.00098
+chr26	4119808	4119854	10206.00000
+chr26	4119854	4120286	9720.00000
+chr26	4120286	4120399	10206.00000
+chr26	4120399	4120642	20000.00000
+chr26	4120642	4120714	9720.00000
+chr26	4120714	4120957	20000.00000
+chr26	4120957	4120959	14580.00000
+chr26	4120959	4121021	19440.00000
+chr26	4121021	4121066	14580.00000
+chr26	4121066	4121216	19440.00000
+chr26	4121216	4121338	20000.00000
+chr26	4121338	4121445	40000.00000
+chr26	4121445	4121459	60000.00000
+chr26	4121459	4121581	40000.00000
+chr26	4121581	4121688	20000.00000
+chr26	4121688	4121837	19440.00000
+chr26	4121837	4121959	14580.00000
+chr26	4121959	4122015	9720.00000
+chr26	4122015	4122258	20000.00000
+chr26	4122258	4122851	8262.00000
+chr26	4122851	4123020	7776.00000
+chr26	4123020	4123263	20000.00000
+chr26	4123263	4123386	7776.00000
+chr26	4123386	4123404	9720.00000
+chr26	4123404	4123641	14580.00000
+chr26	4123641	4123764	9720.00000
+chr26	4123764	4123783	20000.00000
+chr26	4123783	4124007	40000.00000
+chr26	4124007	4124026	20000.00000
+chr26	4124026	4124386	14580.00000
+chr26	4124386	4124396	9720.00000
+chr26	4124396	4124639	20000.00000
+chr26	4124639	4124786	9234.00000
+chr26	4124786	4125017	9720.00000
+chr26	4125017	4125164	9234.00000
+chr26	4125164	4125407	20000.00000
+chr26	4125407	4125836	9234.00000
+chr26	4125836	4126337	8748.00000
+chr26	4126337	4126363	8262.00000
+chr26	4126363	4126459	9720.00000
+chr26	4126459	4126509	14580.00000
+chr26	4126509	4126699	19440.00000
+chr26	4126699	4126742	20000.00000
+chr26	4126742	4126837	40000.00000
+chr26	4126837	4126887	60000.00000
+chr26	4126887	4126942	80000.00000
+chr26	4126942	4126985	60000.00000
+chr26	4126985	4127080	40000.00000
+chr26	4127080	4127130	20000.00000
+chr26	4127130	4127320	19440.00000
+chr26	4127320	4127363	14580.00000
+chr26	4127363	4127459	9720.00000
+chr26	4127459	4127761	6804.00049
Binary file test-data/test_MACS2.1.0_html_report.zip has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test_MACS2.1.0_peaks.xls	Tue Jun 30 08:16:18 2015 -0400
@@ -0,0 +1,29 @@
+#peaks file
+# This file is generated by MACS version 2.1.0.20140616
+# Command line: callpeak -t /home/pjb/BCF_Work/galaxies/test/galaxy-dist/database/files/000/dataset_46.dat -c /home/pjb/BCF_Work/galaxies/test/galaxy-dist/database/files/000/dataset_45.dat --format=BED --name=test_MACS2.1.0 --bw=300 --gsize=775000000.0 --nomodel --extsize=243 --qvalue=0.05 -B --SPMR --mfold 5 50 --keep-dup 1
+# ARGUMENTS LIST:
+# name = test_MACS2.1.0
+# format = BED
+# ChIP-seq file = ['/home/pjb/BCF_Work/galaxies/test/galaxy-dist/database/files/000/dataset_46.dat']
+# control file = ['/home/pjb/BCF_Work/galaxies/test/galaxy-dist/database/files/000/dataset_45.dat']
+# effective genome size = 7.75e+08
+# band width = 300
+# model fold = [5, 50]
+# qvalue cutoff = 5.00e-02
+# Larger dataset will be scaled towards smaller dataset.
+# Range for calculating regional lambda is: 1000 bps and 10000 bps
+# Broad region calling is off
+# MACS will save fragment pileup signal per million reads
+
+# tag size is determined as 50 bps
+# total tags in treatment: 50
+# tags after filtering in treatment: 50
+# maximum duplicate tags at the same position in treatment = 1
+# Redundant rate in treatment: 0.00
+# total tags in control: 50
+# tags after filtering in control: 50
+# maximum duplicate tags at the same position in control = 1
+# Redundant rate in control: 0.00
+# d = 243
+#chr	start	end	length	abs_summit	pileup	-log10(pvalue)	fold_enrichment	-log10(qvalue)	name
+chr26	4118914	4119282	369	4119130	9.00	9.13132	6.31632	2.51561	test_MACS2.1.0_peak_1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test_MACS2.1.0_peaks.xls.re_match	Tue Jun 30 08:16:18 2015 -0400
@@ -0,0 +1,29 @@
+\#peaks\ file
+\#\ This\ file\ is\ generated\ by\ MACS\ version\ 2\.1\.0\.20140616
+\#\ Command\ line\:\ callpeak\ \-t\ .* \-c\ .* \-\-format\=BED\ \-\-name\=test\_MACS2\.1\.0\ \-\-bw\=300\ \-\-gsize\=775000000\.0\ \-\-nomodel\ \-\-extsize\=243\ \-\-qvalue\=0\.05\ \-B\ \-\-SPMR\ \-\-mfold\ 5\ 50\ \-\-keep\-dup\ 1
+\#\ ARGUMENTS\ LIST\:
+\#\ name\ \=\ test\_MACS2\.1\.0
+\#\ format\ \=\ BED
+\#\ ChIP\-seq\ file\ \=\ \[\'.*\'\]
+\#\ control\ file\ \=\ \[\'.*\'\]
+\#\ effective\ genome\ size\ \=\ 7\.75e\+08
+\#\ band\ width\ \=\ 300
+\#\ model\ fold\ \=\ \[5\,\ 50\]
+\#\ qvalue\ cutoff\ \=\ 5\.00e\-02
+\#\ Larger\ dataset\ will\ be\ scaled\ towards\ smaller\ dataset\.
+\#\ Range\ for\ calculating\ regional\ lambda\ is\:\ 1000\ bps\ and\ 10000\ bps
+\#\ Broad\ region\ calling\ is\ off
+\#\ MACS\ will\ save\ fragment\ pileup\ signal\ per\ million\ reads
+
+\#\ tag\ size\ is\ determined\ as\ 50\ bps
+\#\ total\ tags\ in\ treatment\:\ 50
+\#\ tags\ after\ filtering\ in\ treatment\:\ 50
+\#\ maximum\ duplicate\ tags\ at\ the\ same\ position\ in\ treatment\ \=\ 1
+\#\ Redundant\ rate\ in\ treatment\:\ 0\.00
+\#\ total\ tags\ in\ control\:\ 50
+\#\ tags\ after\ filtering\ in\ control\:\ 50
+\#\ maximum\ duplicate\ tags\ at\ the\ same\ position\ in\ control\ \=\ 1
+\#\ Redundant\ rate\ in\ control\:\ 0\.00
+\#\ d\ \=\ 243
+\#chr\	start\	end\	length\	abs\_summit\	pileup\	\-log10\(pvalue\)\	fold\_enrichment\	\-log10\(qvalue\)\	name
+chr26\	4118914\	4119282\	369\	4119130\	9\.00\	9\.13132\	6\.31632\	2\.51561\	test\_MACS2\.1\.0\_peak\_1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test_MACS2.1.0_peaks_narrowPeak.interval	Tue Jun 30 08:16:18 2015 -0400
@@ -0,0 +1,1 @@
+chr26	4118913	4119282	test_MACS2.1.0_peak_1	25	.	6.31632	9.13132	2.51561	216
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test_MACS2.1.0_summits.bed	Tue Jun 30 08:16:18 2015 -0400
@@ -0,0 +1,1 @@
+chr26	4119129	4119130	test_MACS2.1.0_peak_1	2.51561
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test_MACS2.1.0_treat_pileup.bdg	Tue Jun 30 08:16:18 2015 -0400
@@ -0,0 +1,100 @@
+chr26	0	4107561	0.00000
+chr26	4107561	4107804	20000.00000
+chr26	4107804	4108165	0.00000
+chr26	4108165	4108408	20000.00000
+chr26	4108408	4108531	0.00000
+chr26	4108531	4108774	20000.00000
+chr26	4108774	4109009	0.00000
+chr26	4109009	4109252	20000.00000
+chr26	4109252	4109506	0.00000
+chr26	4109506	4109749	20000.00000
+chr26	4109749	4109782	0.00000
+chr26	4109782	4110025	20000.00000
+chr26	4110025	4110080	0.00000
+chr26	4110080	4110323	20000.00000
+chr26	4110323	4111276	0.00000
+chr26	4111276	4111519	20000.00000
+chr26	4111519	4112110	0.00000
+chr26	4112110	4112353	20000.00000
+chr26	4112353	4112762	0.00000
+chr26	4112762	4113005	20000.00000
+chr26	4113005	4113579	0.00000
+chr26	4113579	4113822	20000.00000
+chr26	4113822	4113899	0.00000
+chr26	4113899	4114142	20000.00000
+chr26	4114142	4115021	0.00000
+chr26	4115021	4115264	20000.00000
+chr26	4115264	4115555	0.00000
+chr26	4115555	4115792	20000.00000
+chr26	4115792	4115798	40000.00000
+chr26	4115798	4116035	20000.00000
+chr26	4116035	4116615	0.00000
+chr26	4116615	4116858	20000.00000
+chr26	4116858	4116931	0.00000
+chr26	4116931	4116988	20000.00000
+chr26	4116988	4117174	40000.00000
+chr26	4117174	4117231	20000.00000
+chr26	4117231	4117308	0.00000
+chr26	4117308	4117551	20000.00000
+chr26	4117551	4117615	0.00000
+chr26	4117615	4117642	20000.00000
+chr26	4117642	4117737	40000.00000
+chr26	4117737	4117858	60000.00000
+chr26	4117858	4117885	40000.00000
+chr26	4117885	4117905	20000.00000
+chr26	4117905	4117980	40000.00000
+chr26	4117980	4118037	20000.00000
+chr26	4118037	4118122	40000.00000
+chr26	4118122	4118148	60000.00000
+chr26	4118148	4118280	40000.00000
+chr26	4118280	4118365	20000.00000
+chr26	4118365	4118516	0.00000
+chr26	4118516	4118531	20000.00000
+chr26	4118531	4118561	40000.00000
+chr26	4118561	4118753	60000.00000
+chr26	4118753	4118759	80000.00000
+chr26	4118759	4118774	60000.00000
+chr26	4118774	4118804	40000.00000
+chr26	4118804	4118812	20000.00000
+chr26	4118812	4118827	40000.00000
+chr26	4118827	4118852	60000.00000
+chr26	4118852	4118898	80000.00000
+chr26	4118898	4118913	100000.00000
+chr26	4118913	4118963	120000.00000
+chr26	4118963	4118967	140000.00000
+chr26	4118967	4118996	160000.00000
+chr26	4118996	4119022	140000.00000
+chr26	4119022	4119047	160000.00000
+chr26	4119047	4119055	180000.00000
+chr26	4119055	4119070	160000.00000
+chr26	4119070	4119077	140000.00000
+chr26	4119077	4119095	160000.00000
+chr26	4119095	4119103	140000.00000
+chr26	4119103	4119118	160000.00000
+chr26	4119118	4119141	180000.00000
+chr26	4119141	4119156	160000.00000
+chr26	4119156	4119163	140000.00000
+chr26	4119163	4119168	160000.00000
+chr26	4119168	4119206	180000.00000
+chr26	4119206	4119210	160000.00000
+chr26	4119210	4119265	140000.00000
+chr26	4119265	4119290	120000.00000
+chr26	4119290	4119320	100000.00000
+chr26	4119320	4119346	80000.00000
+chr26	4119346	4119361	60000.00000
+chr26	4119361	4119406	40000.00000
+chr26	4119406	4119411	20000.00000
+chr26	4119411	4122292	0.00000
+chr26	4122292	4122535	20000.00000
+chr26	4122535	4124351	0.00000
+chr26	4124351	4124452	20000.00000
+chr26	4124452	4124594	40000.00000
+chr26	4124594	4124695	20000.00000
+chr26	4124695	4125766	0.00000
+chr26	4125766	4125809	20000.00000
+chr26	4125809	4126009	40000.00000
+chr26	4126009	4126052	20000.00000
+chr26	4126052	4126452	0.00000
+chr26	4126452	4126695	20000.00000
+chr26	4126695	4127518	0.00000
+chr26	4127518	4127761	20000.00000
Binary file test-data/test_MACS2.1.0_treat_pileup.bw has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test_region_IP.bed	Tue Jun 30 08:16:18 2015 -0400
@@ -0,0 +1,50 @@
+chr26	4107754	4107804	D3YGT8Q1:279:C6ND0ACXX:1:2307:11522:80910	255	-
+chr26	4108358	4108408	D3YGT8Q1:279:C6ND0ACXX:1:1205:12295:24447	255	-
+chr26	4108724	4108774	D3YGT8Q1:279:C6ND0ACXX:1:1212:7461:43211	255	-
+chr26	4109009	4109059	D3YGT8Q1:279:C6ND0ACXX:1:2306:13509:41113	255	+
+chr26	4109506	4109556	D3YGT8Q1:279:C6ND0ACXX:1:1316:8894:99440	255	+
+chr26	4109975	4110025	D3YGT8Q1:279:C6ND0ACXX:1:1314:13929:4230	255	-
+chr26	4110080	4110130	D3YGT8Q1:279:C6ND0ACXX:1:2116:20242:70310	255	+
+chr26	4111276	4111326	D3YGT8Q1:279:C6ND0ACXX:1:1113:7893:68431	255	+
+chr26	4112303	4112353	D3YGT8Q1:279:C6ND0ACXX:1:1312:10267:49823	255	-
+chr26	4112955	4113005	D3YGT8Q1:279:C6ND0ACXX:1:1306:15218:93662	255	-
+chr26	4113579	4113629	D3YGT8Q1:279:C6ND0ACXX:1:2101:12665:18403	255	+
+chr26	4114092	4114142	D3YGT8Q1:279:C6ND0ACXX:1:2210:5952:64144	255	-
+chr26	4115214	4115264	D3YGT8Q1:279:C6ND0ACXX:1:1214:9389:76439	255	-
+chr26	4115748	4115798	D3YGT8Q1:279:C6ND0ACXX:1:1102:9329:33447	255	-
+chr26	4115792	4115842	D3YGT8Q1:279:C6ND0ACXX:1:1209:7255:23188	255	+
+chr26	4116615	4116665	D3YGT8Q1:279:C6ND0ACXX:1:2203:17446:35897	255	+
+chr26	4116988	4117038	D3YGT8Q1:279:C6ND0ACXX:1:2203:8076:21265	255	+
+chr26	4117124	4117174	D3YGT8Q1:279:C6ND0ACXX:1:1210:4683:41907	255	-
+chr26	4117501	4117551	D3YGT8Q1:279:C6ND0ACXX:1:1112:18900:56439	255	-
+chr26	4117615	4117665	D3YGT8Q1:279:C6ND0ACXX:1:2313:2299:78456	255	+
+chr26	4117835	4117885	D3YGT8Q1:279:C6ND0ACXX:1:2107:13997:60524	255	-
+chr26	4117905	4117955	D3YGT8Q1:279:C6ND0ACXX:1:2201:10479:92578	255	+
+chr26	4117930	4117980	D3YGT8Q1:279:C6ND0ACXX:1:2110:14632:99394	255	-
+chr26	4118037	4118087	D3YGT8Q1:279:C6ND0ACXX:1:1104:14470:25800	255	+
+chr26	4118122	4118172	D3YGT8Q1:279:C6ND0ACXX:1:2115:11588:70088	255	+
+chr26	4118709	4118759	D3YGT8Q1:279:C6ND0ACXX:1:1216:4958:48081	255	-
+chr26	4118724	4118774	D3YGT8Q1:279:C6ND0ACXX:1:1103:19280:11053	255	-
+chr26	4118753	4118803	D3YGT8Q1:279:C6ND0ACXX:1:1109:5242:36011	255	+
+chr26	4118754	4118804	D3YGT8Q1:279:C6ND0ACXX:1:2115:21104:40586	255	-
+chr26	4118852	4118902	D3YGT8Q1:279:C6ND0ACXX:1:2106:20411:76655	255	+
+chr26	4118963	4119013	D3YGT8Q1:279:C6ND0ACXX:1:1115:12391:82672	255	+
+chr26	4118967	4119017	D3YGT8Q1:279:C6ND0ACXX:1:1316:6521:21414	255	+
+chr26	4119005	4119055	D3YGT8Q1:279:C6ND0ACXX:1:2304:6533:74899	255	-
+chr26	4119020	4119070	D3YGT8Q1:279:C6ND0ACXX:1:2305:4205:52717	255	-
+chr26	4119022	4119072	D3YGT8Q1:279:C6ND0ACXX:1:2209:3941:33541	255	+
+chr26	4119047	4119097	D3YGT8Q1:279:C6ND0ACXX:1:1311:20210:42351	255	+
+chr26	4119091	4119141	D3YGT8Q1:279:C6ND0ACXX:1:2106:1249:92735	255	-
+chr26	4119106	4119156	D3YGT8Q1:279:C6ND0ACXX:1:2214:19237:88451	255	-
+chr26	4119168	4119218	D3YGT8Q1:279:C6ND0ACXX:1:1205:5997:59335	255	+
+chr26	4119270	4119320	D3YGT8Q1:279:C6ND0ACXX:1:1203:19488:98141	255	-
+chr26	4119296	4119346	D3YGT8Q1:279:C6ND0ACXX:1:1215:19021:97547	255	-
+chr26	4119311	4119361	D3YGT8Q1:279:C6ND0ACXX:1:1106:19108:19961	255	-
+chr26	4119356	4119406	D3YGT8Q1:279:C6ND0ACXX:1:2108:17061:18071	255	-
+chr26	4122292	4122342	D3YGT8Q1:279:C6ND0ACXX:1:2105:6803:72755	255	+
+chr26	4124452	4124502	D3YGT8Q1:279:C6ND0ACXX:1:2303:8935:84202	255	+
+chr26	4124544	4124594	D3YGT8Q1:279:C6ND0ACXX:1:1115:5982:45995	255	-
+chr26	4125766	4125816	D3YGT8Q1:279:C6ND0ACXX:1:1214:15854:88292	255	+
+chr26	4126002	4126052	D3YGT8Q1:279:C6ND0ACXX:1:1106:12069:84969	255	-
+chr26	4126452	4126502	D3YGT8Q1:279:C6ND0ACXX:1:1301:4389:93421	255	+
+chr26	4127711	4127761	D3YGT8Q1:279:C6ND0ACXX:1:1314:2721:99427	255	-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/test_region_Input.bed	Tue Jun 30 08:16:18 2015 -0400
@@ -0,0 +1,50 @@
+chr26	4107915	4107965	D3YGT8Q1:279:C6ND0ACXX:1:2205:7723:65712	255	+
+chr26	4108978	4109028	D3YGT8Q1:279:C6ND0ACXX:1:2111:18182:78807	255	+
+chr26	4108998	4109048	D3YGT8Q1:279:C6ND0ACXX:1:1102:16043:23843	255	+
+chr26	4109399	4109449	D3YGT8Q1:279:C6ND0ACXX:1:2215:2801:57221	255	-
+chr26	4110183	4110233	D3YGT8Q1:279:C6ND0ACXX:1:1315:19316:26775	255	-
+chr26	4110276	4110326	D3YGT8Q1:279:C6ND0ACXX:1:1314:1280:77850	255	-
+chr26	4110348	4110398	D3YGT8Q1:279:C6ND0ACXX:1:1216:4159:61939	255	-
+chr26	4110594	4110644	D3YGT8Q1:279:C6ND0ACXX:1:1312:5546:70647	255	-
+chr26	4110805	4110855	D3YGT8Q1:279:C6ND0ACXX:1:2210:12809:70996	255	-
+chr26	4110980	4111030	D3YGT8Q1:279:C6ND0ACXX:1:2215:3014:41883	255	+
+chr26	4111825	4111875	D3YGT8Q1:279:C6ND0ACXX:1:2314:17556:68202	255	+
+chr26	4112421	4112471	D3YGT8Q1:279:C6ND0ACXX:1:1204:13331:57729	255	-
+chr26	4112827	4112877	D3YGT8Q1:279:C6ND0ACXX:1:2309:11398:71181	255	+
+chr26	4112983	4113033	D3YGT8Q1:279:C6ND0ACXX:1:1104:16671:54740	255	+
+chr26	4113645	4113695	D3YGT8Q1:279:C6ND0ACXX:1:2212:20179:47885	255	+
+chr26	4114267	4114317	D3YGT8Q1:279:C6ND0ACXX:1:2314:3773:63068	255	+
+chr26	4114275	4114325	D3YGT8Q1:279:C6ND0ACXX:1:1116:18465:6326	255	+
+chr26	4114684	4114734	D3YGT8Q1:279:C6ND0ACXX:1:1114:17981:44317	255	-
+chr26	4114758	4114808	D3YGT8Q1:279:C6ND0ACXX:1:1103:15929:31123	255	-
+chr26	4114804	4114854	D3YGT8Q1:279:C6ND0ACXX:1:1208:10693:22578	255	-
+chr26	4115616	4115666	D3YGT8Q1:279:C6ND0ACXX:1:1101:1142:17054	255	+
+chr26	4115950	4116000	D3YGT8Q1:279:C6ND0ACXX:1:1316:13040:39630	255	+
+chr26	4116012	4116062	D3YGT8Q1:279:C6ND0ACXX:1:2107:20439:44058	255	+
+chr26	4116111	4116161	D3YGT8Q1:279:C6ND0ACXX:1:2307:1504:41529	255	+
+chr26	4116135	4116185	D3YGT8Q1:279:C6ND0ACXX:1:2210:2837:7759	255	+
+chr26	4116287	4116337	D3YGT8Q1:279:C6ND0ACXX:1:2313:15422:100876	255	-
+chr26	4116709	4116759	D3YGT8Q1:279:C6ND0ACXX:1:2301:13318:45125	255	+
+chr26	4116866	4116916	D3YGT8Q1:279:C6ND0ACXX:1:1113:1326:96268	255	+
+chr26	4117851	4117901	D3YGT8Q1:279:C6ND0ACXX:1:1310:2843:93758	255	+
+chr26	4119403	4119453	D3YGT8Q1:279:C6ND0ACXX:1:1304:17211:28405	255	+
+chr26	4120471	4120521	D3YGT8Q1:279:C6ND0ACXX:1:2116:18127:100146	255	-
+chr26	4120786	4120836	D3YGT8Q1:279:C6ND0ACXX:1:1207:2164:6021	255	-
+chr26	4121337	4121387	D3YGT8Q1:279:C6ND0ACXX:1:2215:9085:93015	255	+
+chr26	4121459	4121509	D3YGT8Q1:279:C6ND0ACXX:1:2311:16000:27081	255	+
+chr26	4121566	4121616	D3YGT8Q1:279:C6ND0ACXX:1:1216:18410:44768	255	+
+chr26	4122136	4122186	D3YGT8Q1:279:C6ND0ACXX:1:2316:17558:30500	255	+
+chr26	4123141	4123191	D3YGT8Q1:279:C6ND0ACXX:1:2203:15835:86872	255	+
+chr26	4123836	4123886	D3YGT8Q1:279:C6ND0ACXX:1:2212:16650:8391	255	-
+chr26	4123904	4123954	D3YGT8Q1:279:C6ND0ACXX:1:1307:7349:80960	255	+
+chr26	4124517	4124567	D3YGT8Q1:279:C6ND0ACXX:1:1213:6010:82097	255	+
+chr26	4125236	4125286	D3YGT8Q1:279:C6ND0ACXX:1:2216:1172:30684	255	-
+chr26	4126820	4126870	D3YGT8Q1:279:C6ND0ACXX:1:2107:12500:48771	255	+
+chr26	4126863	4126913	D3YGT8Q1:279:C6ND0ACXX:1:2105:1028:78112	255	+
+chr26	4126909	4126959	D3YGT8Q1:279:C6ND0ACXX:1:1302:19618:57506	255	-
+chr26	4126959	4127009	D3YGT8Q1:279:C6ND0ACXX:1:1204:9666:55269	255	-
+chr26	4128534	4128584	D3YGT8Q1:279:C6ND0ACXX:1:2312:9851:2880	255	+
+chr26	4129060	4129110	D3YGT8Q1:279:C6ND0ACXX:1:2104:4039:10225	255	+
+chr26	4129077	4129127	D3YGT8Q1:279:C6ND0ACXX:1:1306:15379:11481	255	+
+chr26	4129446	4129496	D3YGT8Q1:279:C6ND0ACXX:1:1303:9852:6188	255	+
+chr26	4130521	4130571	D3YGT8Q1:279:C6ND0ACXX:1:1201:20815:69132	255	+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml	Tue Jun 30 08:16:18 2015 -0400
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<tool_dependency>
+  <!-- Dependencies from main/test toolsheds -->
+  <package name="numpy" version="1.9">
+    <repository changeset_revision="84e97f5cd3ab" name="package_numpy_1_9" owner="iuc" prior_installation_required="True" toolshed="https://toolshed.g2.bx.psu.edu" />
+  </package>
+  <package name="R" version="3.1.2">
+    <repository changeset_revision="6e0eee4ea4e1" name="package_r_3_1_2" owner="iuc" prior_installation_required="True" toolshed="https://toolshed.g2.bx.psu.edu" />
+  </package>
+  <!-- Subset of UCSC tools -->
+  <package name="ucsc_tools_for_macs21" version="1.0">
+      <install version="1.0">
+            <actions>
+	      <!-- fetchChromSizes -->
+              <action type="download_binary">
+                <url_template architecture="x86_64" os="linux">http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/fetchChromSizes</url_template>
+              </action>
+              <action type="chmod">
+                <file mode="755">$INSTALL_DIR/fetchChromSizes</file>
+              </action>
+	      <!-- bedClip -->
+              <action type="download_binary">
+                <url_template architecture="x86_64" os="linux">http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/bedClip</url_template>
+              </action>
+              <action type="chmod">
+                <file mode="755">$INSTALL_DIR/bedClip</file>
+              </action>
+	      <!-- bedGraphToBigWig -->
+              <action type="download_binary">
+                <url_template architecture="x86_64" os="linux">http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/bedGraphToBigWig</url_template>
+              </action>
+              <action type="chmod">
+                <file mode="755">$INSTALL_DIR/bedGraphToBigWig</file>
+              </action>
+              <action type="set_environment">
+                <environment_variable action="prepend_to" name="PATH">$INSTALL_DIR</environment_variable>
+              </action>
+	    </actions>
+      </install>
+  </package>
+  <!-- MACS 2.1.0 -->
+  <package name="macs2" version="2.1.0.20140616">
+      <install version="1.0">
+            <actions>
+              <action type="download_by_url">https://pypi.python.org/packages/source/M/MACS2/MACS2-2.1.0.20140616.tar.gz</action>
+	      <!-- Install environment for main & test toolsheds -->
+              <action type="set_environment_for_install">
+		<repository changeset_revision="84e97f5cd3ab" name="package_numpy_1_9" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu">
+		  <package name="numpy" version="1.9" />
+		</repository>
+	      </action>
+              <action type="make_directory">$INSTALL_DIR/lib/python</action>
+              <action type="shell_command">
+                export PYTHONPATH=$PYTHONPATH:$INSTALL_DIR/lib/python &amp;&amp; 
+                python setup.py install --install-lib $INSTALL_DIR/lib/python --install-scripts $INSTALL_DIR/bin
+              </action>
+              <action type="set_environment">
+                <environment_variable action="prepend_to" name="PYTHONPATH">$INSTALL_DIR/lib/python</environment_variable>
+                <environment_variable action="prepend_to" name="PATH">$INSTALL_DIR/bin</environment_variable>
+              </action>
+            </actions>
+      </install>
+      <readme>Macs2.1 depends on having python2.7 and numpy 1.8 installed on all nodes of the work cluster</readme>
+    </package>
+</tool_dependency>