Tim,
AFAIK, tool data parameters are set to the string 'none' if they are
optional and not set by the user, so maybe try:

#if $option != 'none':
-a "$option"
#endif

(I always put quotes around options to prevent errant spaces from
creating havoc with command lines..FWIW)

One great way to figure this sort of stuff out is to use the source
for all the existing tools via grep.
eg:
grep \#if tools/*/*.xml | more

will reveal a wealth of different ways to control command line contents (!)


On Sun, Sep 11, 2011 at 11:53 AM, Timothy Wu <2hug...@gmail.com> wrote:
> Hi,
>
> I'm putting my own tool into Galaxy. Suppose I have an command line option
> that is designated by a switch. Such as
>
> $executable.py -a option input output
>
> The "-a option" is an optional argument. I want to make sure when the option
> is not given, "-a option" is entirely taken out.
>
> I tried Cheetah script like this (this fails):
>
> <command interpreter="python">executable #if $option != None
>                                                  -a $option
>                                                  #end if
>                                                  $input $output</command>
>
> This $option is suppose to be an optional tabular file and is written within
> <param> as:
>  <param name="option" type="data" format="tabular" label="XXX"
> optional="true"/>
>
> Somehow "-a None" is always printed (as seen from the server
> print-to-screen). But I thought I checked explicitly for it to be anything
> but None.
>
> Then I realized that type($option)  <class
> 'galaxy.tools.DatasetFilenameWrapper'>. So I coerced both that and NoneType
> into string prior to checking for equality. Is this the proper way to do it?
>
> Timothy
>
> ___________________________________________________________
> 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/
>



-- 
Ross Lazarus MBBS MPH;
Associate Professor, Harvard Medical School;
Director of Bioinformatics, Channing Lab; Tel: +1 617 505 4850;
Head, Medical Bioinformatics, BakerIDI; Tel: +61 385321444;

___________________________________________________________
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/

Reply via email to