On Wed, Sep 22, 2010 at 10:03 AM, Peter <peter@maubp.freeserve.co.uk> wrote:
On Tue, Sep 21, 2010 at 2:34 PM, Jesse Erdmann <jerdmann@umn.edu> wrote:
An easy way to do this is using conditionals and a select parameter. The select would have two (or more) options like "Default Options" and "Advanced Options". When "Advanced Options" is selected, then display the previously hidden options.
On Tue, Sep 21, 2010 at 8:13 PM, Jeremy Goecks <jeremy.goecks@emory.edu> wrote:
The Bowtie and Tophat wrappers--which are included in the Galaxy distribution--provide nice examples of this approach. J.
Thanks for the tip - it is a bit of a hack, but it will do the job :)
Having this built into Galaxy as a feature would allow for a more intuitive interface, but it isn't essential by any means.
I thought it would be more intuitive if these used the checkbox support, "Show advanced options: tick here", rather than a drop down with two choices. I've tried doing this by modifying one of the simpler examples, the FASTQ groomer - originally like this: <conditional name="options_type"> <param name="options_type_selector" type="select" label="Advanced Options"> <option value="basic" selected="True">Hide Advanced Options</option> <option value="advanced">Show Advanced Options</option> </param> <when value="basic"> <!-- no options --> </when> <when value="advanced"> ... </when> </conditional> Interestingly, using a condition based on a text field worked (the toggle takes effect when press enter, not as you type): <conditional name="options_type"> <param name="options_type_selector" type="text" label="Show advanced Options" value="advanced" /> <when value="basic"> <!-- no options --> </when> <when value="advanced"> ... </when> </conditional> However, I have been unsucessful in trying to use a checkbox: <conditional name="options_type"> <param name="options_type_selector" type="boolean" label="Show advanced Options" truevalue="advanced" falsevalue="basic" checked="false" /> <when value="basic"> <!-- no options --> </when> <when value="advanced"> ... </when> </conditional> I suspect that part of the problem is in lib/galaxy/tools/parameters/basic.py that the class BooleanToolParameter method get_initial_value returns a boolean (True/False) and not a string (the value given in the XML file, in my example "advanced" or "basic") like the other parameter classes. This change made some difference, but is not enough in itself (and I fear has side effects): --- a/lib/galaxy/tools/parameters/basic.py Fri Sep 24 10:38:45 2010 +0100 +++ b/lib/galaxy/tools/parameters/basic.py Fri Sep 24 11:42:38 2010 +0100 @@ -283,7 +283,10 @@ def to_python( self, value, app ): return ( value == 'True' ) def get_initial_value( self, trans, context ): - return self.checked + if self.checked: + return self.truevalue + else: + return self.falsevalue def to_param_dict_string( self, value, other_values={} ): if value: return self.truevalue Should <conditional> work with a checkbox (boolean) parameter? Thanks, Peter