Thanks for the help Alex! I got it working this way:

In the <inputs> section:
<param name="random_seed" type="integer" value="0" optional="true" label="Random seed" help="Seed number to use for the pseudo-random number generator." />

In the <command> section:
      #if $random_seed > 0
        -random_seed    $random_seed
      #end if

Florent



On 14/02/11 01:04, Bossers, Alex wrote:
Florent,
you should be able to do this using cheetah scripting.
Perhaps you can give the seed a specific (nonsense) default value like 0 or -1?
You could check on this with cheetah scripting for this value and if so issue 
the command without additional parameters, otherwise issue the command witht 
the set values....

hope this helps and was your question..
lex

________________________________________
Van: galaxy-user-boun...@lists.bx.psu.edu 
[galaxy-user-boun...@lists.bx.psu.edu] namens Florent Angly 
[florent.an...@gmail.com]
Verzonden: zondag 13 februari 2011 9:13
Aan: galaxy-user@lists.bx.psu.edu
Onderwerp: [galaxy-user] Optional tool arguments

Hi,

I am wondering how to handle optional arguments in a tool wrapper for
Galaxy. I looked at other wrappers but could not find the way to do the
right thing.

The<inputs>  section of my tool contains:
<param name="random_seed" type="integer" optional="true" label="Random
seed" help="Seed number to use for the pseudo-random number generator." />

The<command>  section looks like:
      Grinder -random_seed $random_seed

However, when I run the tool through the webinterface without specifying
a seed value, the jobs starts but fails with the error:

Traceback (most recent call last):
    File "/Users/galaxy/galaxy_dist/lib/galaxy/jobs/runners/local.py", line 56, 
in run_job
      job_wrapper.prepare()
    File "/Users/galaxy/galaxy_dist/lib/galaxy/jobs/__init__.py", line 371, in 
prepare
      self.command_line = self.tool.build_command_line( param_dict )
    File "/Users/galaxy/galaxy_dist/lib/galaxy/tools/__init__.py", line 1525, 
in build_command_line
      command_line = fill_template( self.command, context=param_dict )
    File "/Users/galaxy/galaxy_dist/lib/galaxy/util/template.py", line 9, in 
fill_template
      return str( Template( source=template_text, searchList=[context] ) )
    File 
"/Users/galaxy/galaxy_dist/eggs/Cheetah-2.2.2-py2.6-macosx-10.6-universal-ucs2.egg/Cheetah/Template.py",
 line 1004, in __str__
      return getattr(self, mainMethName)()
    File "DynamicallyCompiledCheetahTemplate.py", line 168, in respond
NotFound: cannot find 'random_seed'
I assume that I need to adjust my<commands>  section so that the
"-random_seed $random_seed" parameter and values are issued only if
$random_seed has been set to a value. Something like:

      Grinder
      #if ??? $random_seed ???
          -random_seed $random_seed
      #end if

The question is: how to do it? I tried a variety of syntaxes without
success.

Thanks,

Florent




_______________________________________________
The Galaxy User list should be used for the discussion of Galaxy analysis and
other features on the public server at usegalaxy.org.  For discussion of local
Galaxy instances and the Galaxy source code, please use the Galaxy Development
list:

   http://lists.bx.psu.edu/listinfo/galaxy-dev

To manage your subscriptions to this and other Galaxy lists, please use the
interface at:

   http://lists.bx.psu.edu/

_______________________________________________
The Galaxy User list should be used for the discussion of Galaxy analysis and
other features on the public server at usegalaxy.org.  For discussion of local
Galaxy instances and the Galaxy source code, please use the Galaxy Development
list:

 http://lists.bx.psu.edu/listinfo/galaxy-dev

To manage your subscriptions to this and other Galaxy lists, please use the
interface at:

 http://lists.bx.psu.edu/

Reply via email to