Filtering number of outputs with a conditional
Hello Galaxians, I am currently working on a tool to format reports but I have a problem with the <filter> tag. A little example is easier to figure than a long explanation so... My xml looks like this: <tool name="My tool" id="my tool"> <command interpreter="python">$SCRIPTTYPE.SCRIPT $REPORT $SECONDPARAM $OUTFILE $MAP</command> <inputs> <param type="data" label="My input file" name="REPORT" help="Just for the example"/> <conditional name="SCRIPTTYPE"> <param type="select" label="Script to use" name="SCRIPT"> <option value="script_x.py">X</option> <option value="script_y.py">Y</option> <option value="script_z.py">Z</option> </param> <when value="script_x.py"> <param type="select" name="SECONDPARAM" label="My parameter"> <option value="foo">foo</option> <option value="bar">bar</option> </param> </when> <when value="script_y.py"> <param type="select" name="SECONDPARAM" label="My parameter"> <option value="A">A</option> <option value="B">B</option> </param> </when> <when value="script_z.py"> <param type="select" name="SECONDPARAM" label="My parameter"> <option value="1">1</option> <option value="2">2</option> </param> </when> </conditional> </inputs> <outputs> <data type="data" format="tabular" name="OUTFILE" label="My outfile"> <filter> SCRIPTTYPE['SCRIPT'] == script_x.py</filter> </data> <data type="data" name="OUTFILE" label="My_outfile.tgz"> <filter> SCRIPTTYPE['SCRIPT'] == script_y.py</filter> </data> <data type="data" format="tabular" name="OUTFILE" label="My other outfile"> <filter> SCRIPTTYPE['SCRIPT'] == script_z.py</filter> </data> <data type="data" format="tabular" name="MAPFILE" label="My map"> <filter> SCRIPTTYPE['SCRIPT'] == script_z.py</filter> </data> </outputs> </tool> ===================== I try to make my xml work that way: When I select my script x, there is only one output labeled "my outfile". When I select my script y, there is only one output labeled "My_outfile.tgz" When I select my script z, there are two outputs. I had it working properly with just x or y, but when I add z to my xml, the thing gets all buggy. Instead of having one output when I select x or y, I always have two outputs "my other outfile" and "my map" as if I had selected z. Do you have any idea how I could solve that? Thank you, best regards, Alexandre
On Thu, Oct 31, 2013 at 10:41 AM, Alexandre Loywick <a.loywick@gmail.com> wrote:
Hello Galaxians,
I am currently working on a tool to format reports but I have a problem with the <filter> tag.
A little example is easier to figure than a long explanation so... My xml looks like this:
...
Do you have any idea how I could solve that?
Personally, I would probably have three separate XML files, one for each script. Since they are doing different jobs and producing different sets of output that seems much clearer (and will make life easier in the workflow editor too later on). If there is a lot of commonality you can use macros in the XML to avoid repeating things like input parameters. Peter
Thank you for your fast answer Peter, The thing is I have some constraints about this developpement and creating multiple tools for similar processes is a bit annoying so... I'm not really aware of macros in the xml, I'll go read the wiki again about that. bests, Alexandre 2013/10/31 Peter Cock <p.j.a.cock@googlemail.com>
On Thu, Oct 31, 2013 at 10:41 AM, Alexandre Loywick <a.loywick@gmail.com> wrote:
Hello Galaxians,
I am currently working on a tool to format reports but I have a problem with the <filter> tag.
A little example is easier to figure than a long explanation so... My xml looks like this:
...
Do you have any idea how I could solve that?
Personally, I would probably have three separate XML files, one for each script. Since they are doing different jobs and producing different sets of output that seems much clearer (and will make life easier in the workflow editor too later on).
If there is a lot of commonality you can use macros in the XML to avoid repeating things like input parameters.
Peter
On Thu, Oct 31, 2013 at 11:02 AM, Alexandre Loywick <a.loywick@gmail.com> wrote:
Thank you for your fast answer Peter,
The thing is I have some constraints about this developpement and creating multiple tools for similar processes is a bit annoying so...
I'm not really aware of macros in the xml, I'll go read the wiki again about that.
bests, Alexandre
In addition to the wiki documentation, for a complex set of examples Bjoern and John have used the macros to remove a LOT of duplication in the BLAST+ XML files, https://github.com/peterjc/galaxy_blast/tree/master/tools/ncbi_blast_plus The repeated snippets are defined here: https://github.com/peterjc/galaxy_blast/blob/master/tools/ncbi_blast_plus/nc... Note there are two kinds, XML and tokens - the tokens are new and not yet on the wiki. They can be used inside the Cheetah syntax for the <command> tag and also the RST markup for the <help> tag. In a simple case (and the older BLAST+ versions) we'd just reference the macros file from the individual tools with: <macros> <import>ncbi_macros.xml</import> </macros> You insert the XML macros with lines like this: <expand macro="input_conditional_choose_db_type" /> This is fairly easy (although it can be harder to debug). Peter
participants (2)
-
Alexandre Loywick
-
Peter Cock