# HG changeset patch # User kevyin # Date 1355723189 18000 # Node ID d9658163c29e645eaa2c3198a7eb8799091b9ea0 # Parent d0220fea2b5100215b5b5d25c5c9a368232f9bd7 Uploaded diff -r d0220fea2b51 -r d9658163c29e README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README Mon Dec 17 00:46:29 2012 -0500 @@ -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 + diff -r d0220fea2b51 -r d9658163c29e annotatePeaks.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/annotatePeaks.xml Mon Dec 17 00:46:29 2012 -0500 @@ -0,0 +1,55 @@ + + + homer + + + + + annotatePeaks.pl $input_bed $genome_selector 1> $out_annotated + 2> $out_log || echo "Error running annotatePeaks." >&2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + .. 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. + + + + diff -r d0220fea2b51 -r d9658163c29e bed2pos.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bed2pos.xml Mon Dec 17 00:46:29 2012 -0500 @@ -0,0 +1,37 @@ + + + homer + + + + + bed2pos.pl $input_bed 1> $out_pos + 2> $out_log || echo "Error running bed2pos." >&2 + + + + + + + + + + + + + + + + + + + .. class:: infomark + + Converts: BED -(to)-> homer peak positions + + **Homer bed2pos.pl** + + http://biowhat.ucsd.edu/homer/ngs/miscellaneous.html + + + diff -r d0220fea2b51 -r d9658163c29e findPeaks.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/findPeaks.xml Mon Dec 17 00:46:29 2012 -0500 @@ -0,0 +1,58 @@ + + + homer + + Homer's peakcaller. Requires tag directories (see makeTagDirectory) + + + findPeaks $tagDir.extra_files_path $options -o $outputPeakFile + + #if $control_tagDir: + -i $control_tagDir.extra_files_path + #end if + + 2> $out_log || echo "Error running findPeaks." >&2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + .. 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. + + + + diff -r d0220fea2b51 -r d9658163c29e makeTagDirectory.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/makeTagDirectory.py Mon Dec 17 00:46:29 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 [options] [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 = ['

Files created by makeTagDirectory

\n'] + + flist.sort() + for i,f in enumerate(flist): + if not(os.path.isdir(f)): + fn = os.path.split(f)[-1] + res.append('\n' % (fn,getFileString(fn, dr))) + + res.append('
%s
\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 + + + diff -r d0220fea2b51 -r d9658163c29e makeTagDirectory.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/makeTagDirectory.xml Mon Dec 17 00:46:29 2012 -0500 @@ -0,0 +1,61 @@ + + + homer + + Simple wrapper for makeTagDirectory. Used by findPeaks + + makeTagDirectory.py ${tagDir.files_path} + #for $alignF in $alignmentFiles + $alignF.file -f $alignF.file.ext + #end for + -o $tagDir + 2> $out_log || echo "Error running homer_makeTagDirectory." >&2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + .. class:: infomark + + **Homer makeTagDirectory** + + For more options, look under: "Command line options" + + http://biowhat.ucsd.edu/homer/ngs/tagDir.html + + + + + diff -r d0220fea2b51 -r d9658163c29e pos2bed.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pos2bed.xml Mon Dec 17 00:46:29 2012 -0500 @@ -0,0 +1,37 @@ + + + homer + + + + + pos2bed.pl $input_peak 1> $out_bed + 2> $out_log || echo "Error running pos2bed." >&2 + + + + + + + + + + + + + + + + + + + .. class:: infomark + + Converts: homer peak positions -(to)-> BED format + + **Homer pos2bed.pl** + + http://biowhat.ucsd.edu/homer/ngs/miscellaneous.html + + + diff -r d0220fea2b51 -r d9658163c29e tool_dependencies.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_dependencies.xml Mon Dec 17 00:46:29 2012 -0500 @@ -0,0 +1,19 @@ + + + + + + http://biowhat.ucsd.edu/homer/configureHomer.pl + perl ./configureHomer.pl -install + perl ./configureHomer.pl -install hg19 + + $INSTALL_DIR/bin + + + + + Installs homer + + + +