Repository 'homer'
hg clone https://toolshed.g2.bx.psu.edu/repos/kevyin/homer

Changeset 10:7efeace8bd32 (2012-12-17)
Previous changeset 9:22b7d878f3d0 (2012-12-17) Next changeset 11:83dffd6d7733 (2012-12-17)
Commit message:
Uploaded
added:
README
annotatePeaks.xml
bed2pos.xml
findPeaks.xml
makeTagDirectory.py
makeTagDirectory.xml
pos2bed.xml
tool_dependencies.xml
b
diff -r 22b7d878f3d0 -r 7efeace8bd32 README
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/README Mon Dec 17 00:22:39 2012 -0500
b
@@ -0,0 +1,13 @@
+Homer wrapper for Galaxy
+
+Code repo: https://bitbucket.org/gvl/homer
+
+=========================================:
+LICENSE for this wrapper: 
+=========================================:
+Kevin Ying
+Garvan Institute: http://www.garvan.org.au
+GVL: https://genome.edu.au/wiki/GVL
+
+http://opensource.org/licenses/mit-license.php
+
b
diff -r 22b7d878f3d0 -r 7efeace8bd32 annotatePeaks.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/annotatePeaks.xml Mon Dec 17 00:22:39 2012 -0500
[
@@ -0,0 +1,55 @@
+<tool id="homer_annotatePeaks" name="homer_annotatePeaks" version="0.0.4">
+    <requirements>
+        <requirement type="package">homer</requirement>
+    </requirements>
+    <description></description>
+    <!--<version_command></version_command>-->
+    <command>
+        annotatePeaks.pl $input_bed $genome_selector 1&gt; $out_annotated
+        2&gt; $out_log || echo "Error running annotatePeaks." >&amp;2
+    </command>
+    <inputs>
+        <param format="tabular,bed" name="input_bed" type="data" label="Homer peaks OR BED format"/>
+        <param name="genome_selector" type="select" label="Genome version">
+            <option value="hg19" selected="true">hg19</option>
+        </param>
+        <param type="text" name="options" label="Extra options" value="" help="Go to link below for more options">
+          <sanitizer>
+            <valid initial="string.printable">
+             <remove value="&apos;"/>
+             <remove value="/"/>
+            </valid>
+            <mapping initial="none">
+              <add source="&apos;" target="__sq__"/>
+            </mapping>
+          </sanitizer>
+        </param>
+    </inputs>
+    <outputs>
+        <!--<data format="html" name="html_outfile" label="index" />-->
+        <!--<data format="html" hidden="True" name="html_outfile" label="index.html" />-->
+        <data format="csv" name="out_annotated" label="${tool.name} on #echo os.path.splitext(str($input_bed.name))[0]#_genome_${genome_selector}" />
+        <data format="txt" name="out_log" label="${tool.name} on #echo os.path.splitext(str($input_bed.name))[0]#_genome_${genome_selector}.log" />
+    </outputs>
+    <tests>
+        <test>
+            <!--<param name="input_file" value="extract_genomic_dna.fa" />-->
+            <!--<output name="html_file" file="sample_output.html" ftype="html" />-->
+        </test>
+    </tests>
+
+    <help>
+
+        .. class:: infomark
+
+        **Homer annoatePeaks**
+
+        More information on accepted formats and options
+
+        http://biowhat.ucsd.edu/homer/ngs/annotation.html
+
+        TIP: use homer_bed2pos and homer_pos2bed to convert between the homer peak positions and the BED format.
+
+    </help>
+</tool>
+
b
diff -r 22b7d878f3d0 -r 7efeace8bd32 bed2pos.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bed2pos.xml Mon Dec 17 00:22:39 2012 -0500
[
@@ -0,0 +1,37 @@
+<tool id="homer_bed2pos" name="homer_bed2pos" version="0.0.3">
+    <requirements>
+        <requirement type="package">homer</requirement>
+    </requirements>
+    <description></description>
+    <!--<version_command></version_command>-->
+    <command>
+        bed2pos.pl $input_bed 1&gt; $out_pos
+        2&gt; $out_log || echo "Error running bed2pos." >&amp;2
+    </command>
+    <inputs>
+        <param format="tabular,bed" name="input_bed" type="data" label="BED file" />
+    </inputs>
+    <outputs>
+        <!--<data format="html" name="html_outfile" label="index" />-->
+        <!--<data format="html" hidden="True" name="html_outfile" label="index.html" />-->
+        <data format="tabular" name="out_pos" label="${tool.name} on #echo os.path.splitext(str($input_bed.name))[0]#" />
+        <data format="txt" name="out_log" label="${tool.name} on #echo os.path.splitext(str($input_bed.name))[0]#.log" />
+    </outputs>
+    <tests>
+        <test>
+            <!--<param name="input_file" value="extract_genomic_dna.fa" />-->
+            <!--<output name="html_file" file="sample_output.html" ftype="html" />-->
+        </test>
+    </tests>
+
+    <help>
+        .. class:: infomark
+
+        Converts: BED -(to)-> homer peak positions
+
+        **Homer bed2pos.pl**
+
+        http://biowhat.ucsd.edu/homer/ngs/miscellaneous.html
+    </help>
+</tool>
+
b
diff -r 22b7d878f3d0 -r 7efeace8bd32 findPeaks.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/findPeaks.xml Mon Dec 17 00:22:39 2012 -0500
[
@@ -0,0 +1,58 @@
+<tool id="homer_findPeaks" name="homer_findPeaks" version="0.1.2">
+    <requirements>
+        <requirement type="package">homer</requirement>
+    </requirements>
+    <description>Homer's peakcaller. Requires tag directories (see makeTagDirectory)</description>
+    <!--<version_command></version_command>-->
+    <command>
+        findPeaks $tagDir.extra_files_path $options -o $outputPeakFile
+
+    #if $control_tagDir:
+        -i $control_tagDir.extra_files_path
+    #end if
+
+        2&gt; $out_log || echo "Error running findPeaks." >&amp;2
+    </command>
+    <inputs>
+        <param format="homerTagDirectory" name="tagDir" type="data" label="tag directory" help="Must be made with homer_makeTagDirectory" />
+        <param format="homerTagDirectory" name="control_tagDir" type="data" optional="True" label="Control tag directory" help="Must be made with homer_makeTagDirectory" />
+        <param type="text" name="options" label="Extra options" value="" help="Go to link below for more options">
+          <sanitizer>
+            <valid initial="string.printable">
+             <remove value="&apos;"/>
+             <remove value="/"/>
+            </valid>
+            <mapping initial="none">
+              <add source="&apos;" target="__sq__"/>
+            </mapping>
+          </sanitizer>
+        </param>
+    </inputs>
+    <outputs>
+        <!--<data format="html" name="html_outfile" label="index" />-->
+        <!--<data format="html" hidden="True" name="html_outfile" label="index.html" />-->
+        <data format="txt" name="outputPeakFile" label="${tool.name} on #echo os.path.splitext(str($tagDir.name))[0]#.txt" />
+        <data format="txt" name="out_log" label="${tool.name} on #echo os.path.splitext(str($tagDir.name))[0]#.log" />
+    </outputs>
+    <tests>
+        <test>
+            <!--<param name="input_file" value="extract_genomic_dna.fa" />-->
+            <!--<output name="html_file" file="sample_output.html" ftype="html" />-->
+        </test>
+    </tests>
+
+    <help>
+
+  .. class:: infomark
+
+  **Homer findPeaks**
+
+  For more options, look under: "Command line options for findPeaks"
+
+  http://biowhat.ucsd.edu/homer/ngs/peaks.html
+
+  TIP: use homer_bed2pos and homer_pos2bed to convert between the homer peak positions and the BED format.
+
+    </help>
+</tool>
+
b
diff -r 22b7d878f3d0 -r 7efeace8bd32 makeTagDirectory.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/makeTagDirectory.py Mon Dec 17 00:22:39 2012 -0500
[
@@ -0,0 +1,94 @@
+"""
+
+
+"""
+import re
+import os
+import sys
+import subprocess
+import optparse
+import shutil
+import tempfile
+
+def getFileString(fpath, outpath):
+    """
+    format a nice file size string
+    """
+    size = ''
+    fp = os.path.join(outpath, fpath)
+    s = '? ?'
+    if os.path.isfile(fp):
+        n = float(os.path.getsize(fp))
+        if n > 2**20:
+            size = ' (%1.1f MB)' % (n/2**20)
+        elif n > 2**10:
+            size = ' (%1.1f KB)' % (n/2**10)
+        elif n > 0:
+            size = ' (%d B)' % (int(n))
+        s = '%s %s' % (fpath, size) 
+    return s
+
+class makeTagDirectory():
+    """wrapper
+    """
+
+    def __init__(self,opts=None, args=None):
+        self.opts = opts
+        self.args = args
+        
+    def run_makeTagDirectory(self):
+        """
+        makeTagDirectory <Output Directory Name> [options] <alignment file1> [alignment file 2] 
+
+        """
+        if self.opts.format != "bam":
+            cl = [self.opts.executable] + args + ["-format" , self.opts.format]
+        else:
+            cl = [self.opts.executable] + args
+        print cl
+        p = subprocess.Popen(cl)
+        retval = p.wait()
+
+
+        html = self.gen_html(args[0])
+        #html = self.gen_html()
+        return html,retval
+
+    def gen_html(self, dr=os.getcwd()):
+        flist = os.listdir(dr)
+        print flist
+        """ add a list of all files in the tagdirectory
+        """
+        res = ['<div class="module"><h2>Files created by makeTagDirectory</h2><table cellspacing="2" cellpadding="2">\n']
+
+        flist.sort()
+        for i,f in enumerate(flist):
+             if not(os.path.isdir(f)):
+                 fn = os.path.split(f)[-1]
+                 res.append('<tr><td><a href="%s">%s</a></td></tr>\n' % (fn,getFileString(fn, dr)))
+
+        res.append('</table>\n') 
+
+        return res
+
+if __name__ == '__main__':
+    op = optparse.OptionParser()
+    op.add_option('-e', '--executable', default='makeTagDirectory')
+    op.add_option('-o', '--htmloutput', default=None)
+    op.add_option('-f', '--format', default="sam")
+    opts, args = op.parse_args()
+    #assert os.path.isfile(opts.executable),'## makeTagDirectory.py error - cannot find executable %s' % opts.executable
+
+    #if not os.path.exists(opts.outputdir): 
+        #os.makedirs(opts.outputdir)
+    f = makeTagDirectory(opts, args)
+
+    html,retval = f.run_makeTagDirectory()
+    f = open(opts.htmloutput, 'w')
+    f.write(''.join(html))
+    f.close()
+    if retval <> 0:
+         print >> sys.stderr, serr # indicate failure
+    
+
+
b
diff -r 22b7d878f3d0 -r 7efeace8bd32 makeTagDirectory.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/makeTagDirectory.xml Mon Dec 17 00:22:39 2012 -0500
b
@@ -0,0 +1,61 @@
+<tool id="homer_makeTagDirectory" name="homer_makeTagDirectory" version="1.0.1">
+    <requirements>
+        <requirement type="package" >homer</requirement>
+    </requirements>
+    <description>Simple wrapper for makeTagDirectory. Used by findPeaks</description>
+    <!--<version_command></version_command>-->
+    <command interpreter="python">makeTagDirectory.py ${tagDir.files_path} 
+        #for $alignF in $alignmentFiles
+          $alignF.file -f $alignF.file.ext
+        #end for
+          -o $tagDir
+        2&gt; $out_log || echo "Error running homer_makeTagDirectory." >&amp;2
+
+    </command>
+    <inputs>
+        <param name="title" label="Name for the output tag directory" type="text" default="Homer TagDirectory" />
+        <param type="text" name="options" label="Extra options" value="" help="Go to link below for more options">
+          <sanitizer>
+            <valid initial="string.printable">
+             <remove value="&apos;"/>
+             <remove value="/"/>
+            </valid>
+            <mapping initial="none">
+              <add source="&apos;" target="__sq__"/>
+            </mapping>
+          </sanitizer>
+        </param>
+        <repeat name="alignmentFiles" title="Alignment Files">
+          <param name="file" label="Add file" type="data" format="sam,bed" />
+        </repeat>
+    </inputs>
+    <outputs>
+        <!--<data format="homerTagDirectory" name="tagDir" label="${title} tag directory" />-->
+        <data format="html" name="tagDir" label="${title} tag directory" />
+        <data format="txt" name="out_log" label="${title}.log" />
+        <!--<data format="html" name="html_outfile" label="index" />-->
+        <!--<data format="html" hidden="True" name="html_outfile" label="index.html" />-->
+    </outputs>
+
+
+    <tests>
+        <!--<test>-->
+            <!--<param name="input_file" value="extract_genomic_dna.fa" />-->
+            <!--<output name="html_file" file="sample_output.html" ftype="html" />-->
+        <!--</test>-->
+    </tests>
+
+    <help>
+
+  .. class:: infomark
+
+  **Homer makeTagDirectory**
+
+  For more options, look under: "Command line options"
+
+  http://biowhat.ucsd.edu/homer/ngs/tagDir.html
+
+
+    </help>
+</tool>
+
b
diff -r 22b7d878f3d0 -r 7efeace8bd32 pos2bed.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pos2bed.xml Mon Dec 17 00:22:39 2012 -0500
[
@@ -0,0 +1,37 @@
+<tool id="homer_pos2bed" name="homer_pos2bed" version="0.0.3">
+    <requirements>
+        <requirement type="package">homer</requirement>
+    </requirements>
+    <description></description>
+    <!--<version_command></version_command>-->
+    <command>
+        pos2bed.pl $input_peak 1&gt; $out_bed
+        2&gt; $out_log || echo "Error running pos2bed." >&amp;2
+    </command>
+    <inputs>
+        <param format="tabular" name="input_peak" type="data" label="Homer peak positions" />
+    </inputs>
+    <outputs>
+        <!--<data format="html" name="html_outfile" label="index" />-->
+        <!--<data format="html" hidden="True" name="html_outfile" label="index.html" />-->
+        <data format="bed" name="out_bed" label="${tool.name} on #echo os.path.splitext(str($input_peak.name))[0]#.bed" />
+        <data format="txt" name="out_log" label="${tool.name} on #echo os.path.splitext(str($input_peak.name))[0]#.log" />
+    </outputs>
+    <tests>
+        <test>
+            <!--<param name="input_file" value="extract_genomic_dna.fa" />-->
+            <!--<output name="html_file" file="sample_output.html" ftype="html" />-->
+        </test>
+    </tests>
+
+    <help>
+        .. class:: infomark
+
+        Converts: homer peak positions -(to)-> BED format
+
+        **Homer pos2bed.pl**
+
+        http://biowhat.ucsd.edu/homer/ngs/miscellaneous.html
+    </help>
+</tool>
+
b
diff -r 22b7d878f3d0 -r 7efeace8bd32 tool_dependencies.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml Mon Dec 17 00:22:39 2012 -0500
b
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<tool_dependency>
+  <package name="homer">
+    <install version="1.0">
+      <actions>
+        <action type="download_by_url">http://biowhat.ucsd.edu/homer/configureHomer.pl</action>
+        <action type="shell_command">perl ./configureHomer.pl -install</action>
+        <action type="shell_command">perl ./configureHomer.pl -install hg19</action>
+        <action type="set_environment">
+          <environment_variable name="PATH" action="prepend_to">$INSTALL_DIR/bin</environment_variable>
+        </action>
+      </actions>
+    </install>
+    <readme>
+      Installs homer
+    </readme>
+  </package>
+</tool_dependency>
+