Alex,

I've looked into your question and there appear to be a couple of separate things. In this example, you gave your conditional the name "tool", which causes a certain set of problems. However, in your original example, the problem seems to be in how you were referring to the variable and also (possibly) the fact that the output should only exist when that particular options was selected.

I've included some sample code below, where the conditional is named "Xtool". This code has the following results when run with conditional parameters as specified:

1.
Arguments:
Xtool.cmd = "show-snps"
Output:
1 output file, named "1 'Xtool.cmd': show-snps", is produced

2.
Arguments:
Xtool.cmd = "show-aligns"
Xtool.extra1 = "IdR RRRRR"
Xtool.extra2 = "IdQ QQQQQ"
Output:
4 output files (listed below) are produced:
1 'Xtool.cmd': show-aligns
2 'Xtool.extra1': IdR RRRRR
3 'Xtool.extra2': IdQ QQQQQ
4 'Xtool.extra1, Xtool.extra2': IdR RRRRR, IdQ QQQQQ

The labels as specified for out_tool5 and out_tool6 caused errors.

Note that if you change the conditional name to "tool", the run equivalent to the two tests above results in:
 NotFound: cannot find 'cmd' while searching for 'tool.cmd'

"tool" refers to the tool instance itself, not your conditional variable.

Successful code:

<tool id="tooltest2Xtool" name="Tool Test 2 (condition=Xtool)" version="0.1.0">
  <description></description>
  <command interpreter="python">
    tooltest2.py
      $Xtool.cmd
      #if $Xtool.cmd == "show-aligns"
        $Xtool.extra1
        $Xtool.extra2
      #end if
      $input_delta
      $cmd_extra
      $out_tool1
      $out_tool2
      $out_tool3
      $out_tool4
##      $out_tool5
##      $out_tool6
  </command>
  <inputs>
    <conditional name="Xtool">
      <param name="cmd" type="select" value="show-snps" label="Select tool">
        <option value="show-snps">show snps</option>
        <option value="show-aligns">show aligns</option>
      </param>
      <when value="show-aligns">
        <param name="extra1" type="text" size="40" value="" label="IdR" help="FastA header ref sequence" />
        <param name="extra2" type="text" size="40" value="" label="IdQ" help="FastA header query sequence" />
      </when>
      <when value="show-snps" />
    </conditional>
    <param name="input_delta" type="data" format="tabular" label="MUMmer delta file" />
    <param name="cmd_extra" type="text" size="40" value="" label="Extra cmd line options" help="see specific cmd line options below for each tool" />
  </inputs>
  <outputs>
    <data name="out_tool1" format="text" label="1 'Xtool.cmd': ${Xtool.cmd}" />
    <data name="out_tool2" format="text" label="2 'Xtool.extra1': ${Xtool.extra1}">
      <filter>Xtool['cmd'] == "show-aligns"</filter>
    </data>
    <data name="out_tool3" format="text" label="3 'Xtool.extra2': ${Xtool.extra2}">
      <filter>Xtool['cmd'] == "show-aligns"</filter>
    </data>
    <data name="out_tool4" format="text" label="4 'Xtool.extra1, Xtool.extra2': ${Xtool.extra1}, ${Xtool.extra2}">
      <filter>Xtool['cmd'] == "show-aligns"</filter>
    </data>
<!--     <data name="out_tool5" format="text" label="5 'Xtool.cmd.value_label': ${Xtool.value_label}" />    -->
<!--     <data name="out_tool6" format="text" label="6 'Xtool.value_label': ${Xtool.value_label}" />   -->
  </outputs>
</tool>

  

Let me know if this doesn't help.

Regards,
Kelly


On Oct 23, 2010, at 2:20 PM, Bossers, Alex wrote:

Hi Jennifer,

sorry this doesn't work for me. If I use just the ${input} I get a reference to some memory location instead of the actual value. Therefore I was using the ${input.value_label} thing (on suggestion of the galaxy dev team :) ). But as mentioned this doesn't work for a conditional.
Below I have a sample tool_xml just to illustrate the current tool_config and what I want to do. Using it like this give me a history box with something like: "Tool output <galaxy.tools.Tool instance at 0x6c186c8>". Obvious this is not what I want. Also using ${cmd} or ${tol.cmd} or ${tool.value_label} don't work.
Any help or direction appreciated.
Alex

<tool id="testtool" name="test" version="0.1.alx" force_history_refresh="True">
 <description>: Var test</description>
 <command>
   /opt/someTooldir/$tool.cmd
       $input1
       #if $tool.cmd=="opt_2":
           -idr $tool.extra1
           -idq $tool.extra2
       #end if
       &gt; $out_tool
 </command>
   <inputs>
     <conditional name="tool">
       <param name="cmd" type="select" label="Tool to run" help="blablabla" >
           <option value="opt_1">option1</option>
           <option value="opt_2">option2</option>
           <option value="opt_3">option3</option>
       </param>
       <when value="opt_2">
           <param name="extra1" type="text" value="0.05" label="IdR" />
           <param name="extra2" type="text" value="50" label="IdQ" />
       </when>
       <when value="opt_1" />
       <when value="opt_3" />
      </conditional>
     <param name="input1" type="data" format="tabular" label="MUMmer delta file" />
   </inputs>
   <outputs>
       <data name="out_tool" format="text" label="Tool output ${tool}" />
   </outputs>
   <requirements>
   </requirements>
   <tests>
       <test>
       </test>
   </tests>
   <help>
   </help>
   </help>
</tool>


________________________________________
Van: Jennifer Jackson [jen@bx.psu.edu]
Verzonden: vrijdag 22 oktober 2010 21:50
Aan: Bossers, Alex
CC: galaxy-dev@lists.bx.psu.edu
Onderwerp: Re: [galaxy-dev] Variabels in label elements

Hi Alex,

Conditional usage/data return is possible, but not for the exact syntax
that you are using. Modifying the query by removing the ".value_label"
from the key should help:

change: ${input1.value_label}
to be: ${input1}

Please let us know if this works or not and we can help more from there,

Best,

Jen
Galaxy team

On 10/14/10 4:13 AM, Bossers, Alex wrote:
Hi All,
Does someone know how to get the value of a type="select" param_name displayed in the output file label?

I know how to do it if its just a non-nested param setup-up using ${input1.value_label} where the input1 is the select_name. But this fails if the select is inside a conditional..... From cheetah script I can call these values like IF $tool.cmd=="something":.....
But whatever I try in the<outputs><data>  fails (I though it to be ${tool.cmd.value_label} but that complains on cmd not defined.... All possible iteration tried :(
Snippet of a generalised tool.xml below.
Any suggestions or hints where to get documentation on this syntax is welcomed!
Alex

<command>
  /opt/tools/$tool.cmd
       $cmd_extra
       $input_delta
       #if $tool.cmd=="show-aligns":
             $tool.extra1
             $tool.extra2
       #end if
$out_tool
  </command>
 <inputs>
   <conditional name="tool">
       <param name="cmd" type="select" value="show-snps" label="Select tool">
             <option value="show-snps">show snps</option>
             <option value="show-aligns">show aligns</option>
       </param>
  <when value="show-aligns">
        <param name="extra1" type="text" size="40" value="" label="IdR" help="FastA header ref sequence" />
        <param name="extra2" type="text" size="40" value="" label="IdQ" help="FastA header query sequence" />
       </when>
       <when value="show-snps" />
   </conditional>
  <param name="input_delta" type="data" format="tabular" label="MUMmer delta file" />
  <param name="cmd_extra" type="text" size="40" value="" label="Extra cmd line options" help="see specific cmd line options below for each tool" />
</inputs>
<outputs>
  <data name="out_tool" format="text" label="tool ${tool.cmd.value_label}" />
 </outputs>

_______________________________________________
galaxy-dev mailing list
galaxy-dev@lists.bx.psu.edu
http://lists.bx.psu.edu/listinfo/galaxy-dev

--
Jennifer Jackson
http://usegalaxy.org

_______________________________________________
galaxy-dev mailing list
galaxy-dev@lists.bx.psu.edu
http://lists.bx.psu.edu/listinfo/galaxy-dev