replacing XML fragments in mycustomtool.xml
This question was cross-posted on https://biostar.usegalaxy.org/p/7619/ "Adding custom tools: resolving (external ) XML entities" I'd like to replace fragments of XML code in my custom tool declaration. My first idea was to use XML entities but it seems that the XML engine doesn't resolve them. (BTW: I know I can replace/declare things in $PATH and tool_dependencies.xml ) Another idea was to use <macros><token...> but I cannot make it work (see https://gist.github.com/lindenb/b2a04e0fefd4d295dba9 ) my macros definition: <?xml version="1.0"?> <macros> <token name="@JAVA_EXE@">/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java</token> <token name="@JVM_OPTIONS@">-Xmx500m</token> </macros> my tool definition: as a test, I echoed the value of @JAVA_EXE@ in /tmp/galaxy.txt (the macro was *not replaced* ) <?xml version="1.0" encoding="UTF-8"?> <tool id="com_github_lindenb_jvarkit_tools_misc_VcfHead" name="VcfHead" version="e098748b85acd5158a1ce612bd3d46e60948b9db" hidden="false"> <description>Print the first lines of a VCF</description> <macros> <import>jvarkit_macros.xml</import> </macros> <command>echo "@JAVA_EXE@" > /tmp/galaxy.txt && zcat -f ${input} | @JAVA_EXE@ @JVM_OPTIONS@ -cp /commun/data/packages/htsjdk/dist/apache-ant-1.8.2-bzip2.jar:/commun/data/packages/htsjdk/dist/htsjdk-1.112.jar:/commun/data/packages/htsjdk/dist/commons-jexl-2.1.1.jar:/commun/data/packages/htsjdk/dist/commons-logging-1.1.1.jar:/commun/data/packages/jvarkit-git/vcfhead.jar com.github.lindenb.jvarkit.tools.misc.VcfHead -n ${number} 2> /dev/null > ${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>see https://github.com/lindenb/jvarkit/wiki/VcfHead</help> </tool> the output of 'hg tip' changeset: 9312:788cd3d06541 tag: tip parent: 9310:19f6e62bd372 parent: 9311:d7f37a2fe690 user: Nate Coraor <nate@bx.psu.edu> date: Mon Apr 08 12:30:08 2013 -0400 summary: Merged stable. what's wrong in my <macros> definition ? Thanks. Pierre
On Mon, May 19, 2014 at 9:29 AM, Pierre Lindenbaum <pierre.lindenbaum@univ-nantes.fr> wrote:
This question was cross-posted on https://biostar.usegalaxy.org/p/7619/ "Adding custom tools: resolving (external ) XML entities"
I'd like to replace fragments of XML code in my custom tool declaration.
My first idea was to use XML entities but it seems that the XML engine doesn't resolve them.
(BTW: I know I can replace/declare things in $PATH and tool_dependencies.xml )
Another idea was to use <macros><token...> but I cannot make it work (see https://gist.github.com/lindenb/b2a04e0fefd4d295dba9 )
my macros definition:
<?xml version="1.0"?> <macros> <token name="@JAVA_EXE@">/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java</token> <token name="@JVM_OPTIONS@">-Xmx500m</token> </macros> my tool definition: as a test, I echoed the value of @JAVA_EXE@ in /tmp/galaxy.txt (the macro was *not replaced* )
<?xml version="1.0" encoding="UTF-8"?> <tool id="com_github_lindenb_jvarkit_tools_misc_VcfHead" name="VcfHead" version="e098748b85acd5158a1ce612bd3d46e60948b9db" hidden="false"> <description>Print the first lines of a VCF</description> <macros> <import>jvarkit_macros.xml</import> </macros> <command>echo "@JAVA_EXE@" > /tmp/galaxy.txt && zcat -f ${input} | @JAVA_EXE@ @JVM_OPTIONS@ -cp /commun/data/packages/htsjdk/dist/apache-ant-1.8.2-bzip2.jar:/commun/data/packages/htsjdk/dist/htsjdk-1.112.jar:/commun/data/packages/htsjdk/dist/commons-jexl-2.1.1.jar:/commun/data/packages/htsjdk/dist/commons-logging-1.1.1.jar:/commun/data/packages/jvarkit-git/vcfhead.jar com.github.lindenb.jvarkit.tools.misc.VcfHead -n ${number} 2> /dev/null > ${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>see https://github.com/lindenb/jvarkit/wiki/VcfHead</help> </tool> the output of 'hg tip'
changeset: 9312:788cd3d06541 tag: tip parent: 9310:19f6e62bd372 parent: 9311:d7f37a2fe690 user: Nate Coraor <nate@bx.psu.edu> date: Mon Apr 08 12:30:08 2013 -0400 summary: Merged stable. what's wrong in my <macros> definition ? Thanks.
Pierre
Pierre - can you update to the current stable release and retest? John suggested on Twitter that your Galaxy might be too old and perhaps pre-dates the macro support: https://twitter.com/jmchilton/status/468381976911556608 That seems to fit - you appear to have a Galaxy from April 2013. We started using the XML macros for the NCBI BLAST+ wrappers in August 2013, so even if they were only on the development branch (galaxy-central) at that point, they would surely have been in the stable branch (galaxy-dist) by the close of 2013. Regards, Peter
participants (2)
-
Peter Cock
-
Pierre Lindenbaum