Hi all, 

For all the input parameters, we have to explicitly use $source.input, $source.m, etc instead of just using input, m, etc. Please see the code below that works. 

 <command>
    #if $source.source_select=="Use_Snapshot"
        ./cM-snapshot.sh $source.input $output
    #else
        ./cM.sh $source.m $source.b $source.ns $source.w $source.s $source.z $output
    #end if
</command>

<inputs>
 <conditional name="source">
    <param name="source_select" type="select" label="Specify the input">
        <option value="Use_Snapshot">Use Snapshot</option>
        <option value="Set_Values">Set Values</option>
    </param>
    <when value="Use_Snapshot">
     <param name="input" type="data" format="dbm" size="100" label="Input Snapshot"/>
      <sanitizer sanitize="False"/>
    </when>
    <when value="Set_Values">
      <param name="m"  label="Omega_m h^2"  type="float" value="0.1279" min="0.120" max="0.155"/>
      <param name="b"  label="Omega_b h^2"  type="float" value="0.0232" min="0.0215" max="0.0235"/>
      <param name="ns" label="n_s"          type="float" value="0.8629" min="0.85" max="1.05"/>
      <param name="w"  label="w"            type="float" value="-1.184" min="-1.30" max="-0.70"/>
      <param name="s"  label="sigma_8"      type="float" value="0.6159" min="0.61" max="0.9"/>
      <param name="z"  label="z"            type="float" value="1.0"    min="0.0" max="1.0"/>
      <sanitizer sanitize="False"/>
    </when>
 </conditional>

Thanks,
Saba

On Mar 20, 2014, at 5:35 AM, Peter Cock <p.j.a.cock@googlemail.com> wrote:

Hi all,

It may be the comparison, I've sometimes found an
explicit cast to str is required in this kind of situation.
So, I would try:

<command>
   #if str($source.source_select)=="Use_Snapshot":
       cM-snapshot.sh $input $output
   #else
       cM.sh $m $b $ns $w $s $z $output
   #end if
</command>

Regards,

Peter


On Thu, Mar 20, 2014 at 10:17 AM, Nicola Soranzo <soranzo@crs4.it> wrote:
Hi Saba and Jens,
":" are not needed, they are optional, see

http://www.cheetahtemplate.org/docs/users_guide_html/users_guide.html#SECTION000680000000000000000

Maybe it's a problem with the left quotes around Use_Snapshot in the #if
line?

Nicola

Il 2014-03-20 06:26 Keilwagen, Jens ha scritto:

Hi Saba,

there is a syntax error in the line of the "#if". Please add ":" at
the end and report whether the error still occurs.

All the best, Jens

VON: galaxy-dev-bounces@lists.bx.psu.edu
[mailto:galaxy-dev-bounces@lists.bx.psu.edu] IM AUFTRAG VON Saba
Sehrish
GESENDET: Mittwoch, 19. März 2014 23:07
AN: galaxy-dev@lists.bx.psu.edu
BETREFF: [galaxy-dev] Running a different command based on selection

in the tool

Hi all,

I am trying to write a tool that based on user criteria will run a
different script.

In the code below, If I select Use_Snapshot, I see the right interface
but somehow galaxy tries to execute the #else part and look for "m"
input parameter. The example I have seen in documentation is using the
script with same name in both if and else and the number of input
arguments is the same as well. Any suggestions/ideas why always #else
part gets executed although right interface appears based on user
selection.

Thanks,

Saba

<command>

#if $source.source_select=="Use_Snapshot"

cM-snapshot.sh $input $output

#else

cM.sh $m $b $ns $w $s $z $output

#end if

</command>

<inputs>

<conditional name="source">

<param name="source_select" type="select" label="Specify the input">

<option value="Use_Snapshot">Use Snapshot</option>

<option value="Set_Values">Set Values</option>

</param>

<when value="Use_Snapshot">

<param name="input" type="data" format="dbm" size="100" label="Input
Snapshot"/>

<sanitizer sanitize="False"/>

</when>

<when value="Set_Values">

<param name="m" label="Omega_m h^2" type="float" value="0.1279"
min="0.120" max="0.155"/>

<param name="b" label="Omega_b h^2" type="float" value="0.0232"
min="0.0215" max="0.0235"/>

<param name="ns" label="n_s" type="float" value="0.8629" min="0.85"
max="1.05"/>

<param name="w" label="w" type="float" value="-1.184" min="-1.30"
max="-0.70"/>

<param name="s" label="sigma_8" type="float" value="0.6159"
min="0.61" max="0.9"/>

<param name="z" label="z" type="float" value="1.0" min="0.0"
max="1.0"/>

<sanitizer sanitize="False"/>

</when>

</conditional>

</inputs>


___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
http://galaxyproject.org/search/mailinglists/