Question: Adding custom tools: newbie
0
gravatar for plindenbaum
4.5 years ago by
plindenbaum • 90
France
plindenbaum • 90 wrote:

Hi all, I'm learning how to create wrap a java program in my galaxy instance:

<?xml version="1.0"?>
<tool id="my_id" name="my_app" version="my_version" hidden="false">
  <description>My tool</description>
  <command interpreter="bash">/usr/bin/java -cp /var/lib1.jar:/var/lib2.jar tool.MyApp  -n ${number} ${input} &gt; ${output}</command>
  <inputs>
    <param format="vcf" name="input" type="data" label="Source VCF" optional="false"/>
    <param name="number" type="integer" value="10" label="Number of rows" optional="true"/>
  </inputs>
  <outputs>
    <data format="input" name="output" metadata_source="input"/>
  </outputs>
  <help>blablabala</help>
</tool>

Questions:

1) the following xml raises an error in galaxy: (why)

/usr/bin/java  : cannot execute binary file

2) where can I find the documentation about defining a global variable/parameter to replace :

/var/lib1.jar:/var/lib2.jar

with

   ${myclasspath}

3) if I fix an error in my tool.xml, do I have to restart my instance of galaxy ?

4) are XML-inclusions (x:include) supported by the XML processing of tools.xml ?

Thank you

Pierre

 

tool java custom • 2.3k views
ADD COMMENT • link • modified 4.5 years ago • written 4.5 years ago by plindenbaum • 90
3
gravatar for Bjoern Gruening
4.5 years ago by
Bjoern Gruening ♦ 5.1k
Germany
Bjoern Gruening ♦ 5.1k wrote:

Hi Pierre,

I do not know why 1) is happening for you but

<command>java -cp /var/... </command>

should work.

2) setting the classpath and with that defining a tool dependency can be done with a tool_dependencies.xml file and the Galaxy Tool Shed. The resulting command will look like that.

<command> java -cp \$MY_JAR_PATH/myjava.jar </command>

Defining tool dependencies can be very elaborated and I would recommend to stick with full paths at the beginning and if you are happy with your tool, dive into the Galaxy Tool Shed. It's worth it!
 

3) If you have made changes to your tool, you need to reload the tool. That can be done either by restarting Galaxy, or reloading your tool via the Admin Panel. The latter is very convenient for development.

If you like have a look at galaxytools, it is a collection of a variety of different Galaxy tools with Tool Shed integration. You will also find Java examples, like GATK, SNPEff or minced, with a different level of complexity.

Have fun and enjoy Galaxy!

Bjoern

 

ADD COMMENT • link written 4.5 years ago by Bjoern Gruening ♦ 5.1k
2

FWIW: 1 is happening, because the interpreter value is prepended to command content, so what you are seeing is:

$ bash /usr/bin/java
/usr/bin/java: /usr/bin/java: cannot execute binary file

ADD REPLY • link written 4.5 years ago by Daniel Blankenberg ♦♦ 1.7k

I see ! thanks, I'll try tomorrow morning !

ADD REPLY • link written 4.5 years ago by plindenbaum • 90

should I wrap my java in a *.bash file or removing the @interpreter="bash" will work ?

ADD REPLY • link written 4.5 years ago by plindenbaum • 90
2

Removing the interpreter will work. Alternatively, you could set the interpreter to java and then remove java from the command text. Historically, with java, people tend to just remove the interpreter bit.

ADD REPLY • link written 4.5 years ago by Daniel Blankenberg ♦♦ 1.7k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 171 users visited in the last hour