Skip to content

Instantly share code, notes, and snippets.

@thanhleviet
Forked from kantale/example_tool.py
Created March 8, 2016 04:47
Show Gist options
  • Save thanhleviet/47ade6ef627f59edb983 to your computer and use it in GitHub Desktop.
Save thanhleviet/47ade6ef627f59edb983 to your computer and use it in GitHub Desktop.
How to setup galaxy with TORQUE in Amazon's cloud
#!/usr/bin/python
import sys
'''
Just a simple tool that adds the line number at
the end of each line
'''
with open(sys.argv[1]) as f_in, open(sys.argv[2], 'w') as f_out:
c = 0
for l in f_in:
c += 1
f_out.write(l.replace('\n', '') + '\t%i'%c + '\n')
<tool id="custom_tool_1" name="Custom Tool 1" version="0.1.0">
<description>Experimental tool 1</description>
<command interpreter="python">example_tool.py $input $output</command>
<inputs>
<param format="tabular" name="input" type="data" label="Source file"/>
</inputs>
<outputs>
<data format="tabular" name="output" />
</outputs>
<tests>
<test>
<param name="input" value="test_input.txt"/>
<output name="output" file="test_output.txt"/>
</test>
</tests>
<help>
The best tool ever.
</help>
</tool>

The location of the files

  • example_tool.py tools/mytools
  • example_tool.xml tools/mytools
  • my_tool_conf.xml config/
  • my_job_conf.xml config/
<?xml version="1.0"?>
<!-- A sample job config that explicitly configures job running the way it is configured by default (if there is no explicit config). -->
<job_conf>
<plugins>
<plugin id="local"
type="runner"
load="galaxy.jobs.runners.local:LocalJobRunner"
workers="4"/>
<plugin id="torque1" type="runner"
load="galaxy.jobs.runners.pbs:PBSJobRunner"
workers="2"/>
</plugins>
<handlers>
<handler id="main"/>
</handlers>
<destinations default="local">
<destination id="local" runner="local"/>
<destination id="torque1_dst" runner="torque1"/>
</destinations>
<tools>
<tool id="custom_tool_1" destination="torque1_dst"/>
</tools>
</job_conf>
<section name="MyTools" id="mTools">
<tool file="mytools/example_tool.xml" />
</section>
a b c
e f g
h i j
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment