Next changeset 1:dfb1e66235c5 (2018-11-15) |
Commit message:
Initial version of SPAN for ToolShed |
added:
README.md span.xml span_wrapper.py tool_dependencies.xml |
b |
diff -r 000000000000 -r 1f0c4f0a9c3b README.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.md Thu Nov 15 11:04:49 2018 -0500 |
[ |
@@ -0,0 +1,3 @@ +Release version +=============== +Release is just a `span` snapshot from [https://github.com/JetBrains-Research/galaxy-applications](https://github.com/JetBrains-Research/galaxy-applications) \ No newline at end of file |
b |
diff -r 000000000000 -r 1f0c4f0a9c3b span.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/span.xml Thu Nov 15 11:04:49 2018 -0500 |
[ |
@@ -0,0 +1,69 @@ +<tool id="span" name="SPAN" version="0.7.1.4272"> + <description>ChIP-Seq analysis</description> + <requirements> + <requirement type="package" version="0.7.1.4272">package_span_jar</requirement> + <!--<container type="docker">biolabs/span</container>--> + </requirements> + <stdio> + <!-- Wrapper ensures anything other than zero is an error --> + <exit_code range="1:"/> + <exit_code range=":-1"/> + </stdio> + <command interpreter="python"> +#if str($action.action_selector) == "model" + #if $control.control_selector + span_wrapper.py model with_control "${genome}" "${treatment_file}" "${bin}" "${action.model_file}" "${control.control_file}" + #else + span_wrapper.py model without_control "${genome}" "${treatment_file}" "${bin}" "${action.model_file}" + #end if +#else + #if $control.control_selector + span_wrapper.py peaks with_control "${genome}" "${treatment_file}" "${bin}" "${action.model_file}" "${control.control_file}" "${fdr}" "${gap}" "${action.peaks_file}" + #else + span_wrapper.py peaks without_control "${genome}" "${treatment_file}" "${bin}" "${action.model_file}" "${fdr}" "${gap}" "${action.peaks_file}" + #end if +#end if + </command> + <inputs> + <param name="treatment_file" type="data" format="bam" label="Treatment BAM" + description="Treatment BAM reads to process"/> + <param name="genome" type="data" format="chrom.sizes" label="Genome chrom.sizes" + description="Genome build chrom.sizes file"/> + + <conditional name="control"> + <param name="control_selector" type="boolean" label="Control available" value="false"/> + <when value="true"> + <param name="control_file" type="data" format="bam" label="Control BAM" + description="Control BAM reads to process"/> + </when> + </conditional> + + <conditional name="action"> + <param name="action_selector" type="select" label="Action"> + <option value="model">Compute SPAN model</option> + <option value="peaks">Compute SPAN model and produce peaks file</option> + </param> + <when value="model"> + <param name="model_file" type="text" value="model.span" label="Model name"/> + </when> + <when value="peaks"> + <param name="model_file" type="text" value="model.span" label="Model file name"/> + <param name="fdr" size="5" type="float" value="0.0001" label="FDR"/> + <param name="gap" size="5" type="integer" value="5" label="GAP"/> + <param name="peaks_file" type="text" value="result.peak" label="Peaks file name"/> + </when> + </conditional> + + <param name="bin" size="5" type="integer" value="200" label="Bin size"/> + </inputs> + <outputs> + <data name="${action.model_file}" format="span" label="SPAN model file"/> + <data name="${action.peaks_file}" format="bed" label="SPAN peaks file"> + <filter>action['action_selector'] == "peaks"</filter> + </data> + </outputs> + <help> + SPAN Semi-supervised Peak Analyzer is a tool for analyzing ChIP-seq data. + Details: http://artyomovlab.wustl.edu/aging/span.html + </help> +</tool> |
b |
diff -r 000000000000 -r 1f0c4f0a9c3b span_wrapper.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/span_wrapper.py Thu Nov 15 11:04:49 2018 -0500 |
[ |
@@ -0,0 +1,67 @@ +#!/usr/bin/env python + +import os +import sys +import subprocess +argv = sys.argv[1:] +print 'Arguments {0}'.format(argv) + +SPAN_JAR = os.environ.get("SPAN_JAR") +# span.jar from Docker container +# SPAN_JAR = "/root/span.jar" +print 'Using SPAN Peak Analyzer distributive file {0}'.format(SPAN_JAR) + +# #if $action.action_selector +# #if str($control.control_selector) == "with_control" +# span_wrapper.py model with_control "${genome}" "${treatment_file}" "${bin}" "${action.model_file}" "${control.control_file}" +# #else +# span_wrapper.py model without_control "${genome}" "${treatment_file}" "${bin}" "${action.model_file}" +# #end if +# #else +# #if $control.control_selector +# span_wrapper.py peaks with_control "${genome}" "${treatment_file}" "${bin}" "${action.model_file}" "${control.control_file}" "${fdr}" "${gap}" "${action.peaks_file}" +# #else +# span_wrapper.py peaks without_control "${genome}" "${treatment_file}" "${bin}" "${action.model_file}" "${fdr}" "${gap}" "${action.peaks_file}" +# #end if +# #end if + +# See http://artyomovlab.wustl.edu/aging/span.html for command line options +action = argv[0] +control = argv[1] +if action == 'model': + if control == 'with_control': + (chrom_sizes, treatment_file, bin, model_file, control_file) = argv[2:] + cmd = 'java -jar {} analyze --chrom.sizes {} --treatment {} --control {} --bin {}'.format( + SPAN_JAR, chrom_sizes, treatment_file, control_file, bin + ) + print "MODEL FILE" + model_file + elif control == 'without_control': + (chrom_sizes, treatment_file, bin, model_file) = argv[2:] + cmd = 'java -jar {} analyze --chrom.sizes {} --treatment {} --bin {}'.format( + SPAN_JAR, argv[2], argv[3], argv[4] + ) + print "MODEL FILE" + model_file + else: + raise Exception("Unknown control option {}".format(control)) + +elif action == "peaks": + if control == 'with_control': + (chrom_sizes, treatment_file, bin, model_file, control_file, fdr, gap, peaks_file) = argv[2:] + cmd = 'java -jar {} analyze --chrom.sizes {} --treatment {} --control {} --bin {} --fdr {} --gap {} --peaks {}'.format( + SPAN_JAR, chrom_sizes, treatment_file, control_file, bin, fdr, gap, peaks_file + ) + print "MODEL FILE" + model_file + elif control == 'without_control': + (chrom_sizes, treatment_file, bin, model_file, fdr, gap, peaks_file) = argv[2:] + cmd = 'java -jar {} analyze --chrom.sizes {} --treatment {} --bin {} --fdr {} --gap {} --peaks {}'.format( + SPAN_JAR, chrom_sizes, treatment_file, bin, fdr, gap, peaks_file + ) + print "MODEL FILE" + model_file + else: + raise Exception("Unknown control option {}".format(control)) +else: + raise Exception("Unknown action command {}".format(action)) + + +print 'Launching SPAN: {0}'.format(cmd) +subprocess.check_call(cmd, cwd=None, shell=True) |
b |
diff -r 000000000000 -r 1f0c4f0a9c3b tool_dependencies.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_dependencies.xml Thu Nov 15 11:04:49 2018 -0500 |
b |
@@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<tool_dependency> + <!-- + Package for downloading latest successful development tools. + https://galaxyproject.org/toolshed/tool-dependencies-tag-sets/ + --> + <package name="package_span_jar" version="0.7.1.4272" prior_installation_required="True"> + <install version="1.0"> + <actions> + <action type="download_by_url">https://download.jetbrains.com/biolabs/span/span-0.7.1.4272.jar</action> + <action type="move_directory_files"> + <source_directory>.</source_directory> + <destination_directory>$INSTALL_DIR/</destination_directory> + </action> + <!-- Set environment variable $INTEGRATION_JAR so Python script knows where to look --> + <action type="set_environment"> + <environment_variable name="$SPAN_JAR" action="set_to">$INSTALL_DIR/span-0.7.1.4272.jar</environment_variable> + </action> + </actions> + </install> + <readme> + Downloads SPAN Semi-supervised Peak Analyzer jar distribution file. + </readme> + </package> +</tool_dependency> |