Input parameter validation dependent on another parameter?
Hello all, I'm currently trying to define a pair of integer parameters for min/max values: <param name="min_size" type="integer" optional="true" min="0" value="" label="Minimum" help="Optional, but if used you must also supply a maximum value." /> <param name="max_size" type="integer" optional="true" min="0" value="" label="Maximum" help="Optional, but if used you must also supply a minimum value." /> As far as I can tell from the documentation, there is no way to write a validator which links the two parameters, for example in order to insist that min_size <= max_size? http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax Alternatively, is it possible in the Cheetah section to raise an exception? That way at least the error should happen almost immediately (without having to wait for the cluster queue etc), e.g. raise ValueError("Requires minimum size is less than maximum!") Or, perhaps this particular use-case is common enough to warrant a new param type="integer-range" which shows two text boxes? Thanks, Peter
Hi Peter,
Hello all,
I'm currently trying to define a pair of integer parameters for min/max values:
<param name="min_size" type="integer" optional="true" min="0" value="" label="Minimum" help="Optional, but if used you must also supply a maximum value." /> <param name="max_size" type="integer" optional="true" min="0" value="" label="Maximum" help="Optional, but if used you must also supply a minimum value." />
As far as I can tell from the documentation, there is no way to write a validator which links the two parameters, for example in order to insist that min_size <= max_size?
I think you are right, there is no such easy mechanism. I would vote for a more powerful validator set. In the meantime you can use a code file to check your variables. Please have a look at our wip DeSeq2 warpper: https://github.com/bgruening/galaxytools/tree/master/deseq2 or the excellent blog post from Ross: http://cloudimaging.blogspot.com.au/2013/05/input-validation-in-galaxy.html Hope that helps, Bjoern
http://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax
Alternatively, is it possible in the Cheetah section to raise an exception? That way at least the error should happen almost immediately (without having to wait for the cluster queue etc), e.g.
raise ValueError("Requires minimum size is less than maximum!")
Or, perhaps this particular use-case is common enough to warrant a new param type="integer-range" which shows two text boxes?
Thanks,
Peter ___________________________________________________________ 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/
On Mon, Oct 21, 2013 at 12:22 PM, Bjoern Gruening <bjoern.gruening@gmail.com> wrote:
Hi Peter,
Hello all,
I'm currently trying to define a pair of integer parameters for min/max values:
<param name="min_size" type="integer" optional="true" min="0" value="" label="Minimum" help="Optional, but if used you must also supply a maximum value." /> <param name="max_size" type="integer" optional="true" min="0" value="" label="Maximum" help="Optional, but if used you must also supply a minimum value." />
As far as I can tell from the documentation, there is no way to write a validator which links the two parameters, for example in order to insist that min_size <= max_size?
I think you are right, there is no such easy mechanism. I would vote for a more powerful validator set.
In the meantime you can use a code file to check your variables. Please have a look at our wip DeSeq2 warpper:
https://github.com/bgruening/galaxytools/tree/master/deseq2
or the excellent blog post from Ross:
http://cloudimaging.blogspot.com.au/2013/05/input-validation-in-galaxy.html
Hope that helps, Bjoern
Yes, a helper Python script linked via the <code> tag containing a validate_input function may work here - thanks Bjoern :) However, according to the wiki the <code> tag is deprecated :( Peter
Am Montag, den 21.10.2013, 12:33 +0100 schrieb Peter Cock:
On Mon, Oct 21, 2013 at 12:22 PM, Bjoern Gruening <bjoern.gruening@gmail.com> wrote:
Hi Peter,
Hello all,
I'm currently trying to define a pair of integer parameters for min/max values:
<param name="min_size" type="integer" optional="true" min="0" value="" label="Minimum" help="Optional, but if used you must also supply a maximum value." /> <param name="max_size" type="integer" optional="true" min="0" value="" label="Maximum" help="Optional, but if used you must also supply a minimum value." />
As far as I can tell from the documentation, there is no way to write a validator which links the two parameters, for example in order to insist that min_size <= max_size?
I think you are right, there is no such easy mechanism. I would vote for a more powerful validator set.
In the meantime you can use a code file to check your variables. Please have a look at our wip DeSeq2 warpper:
https://github.com/bgruening/galaxytools/tree/master/deseq2
or the excellent blog post from Ross:
http://cloudimaging.blogspot.com.au/2013/05/input-validation-in-galaxy.html
Hope that helps, Bjoern
Yes, a helper Python script linked via the <code> tag containing a validate_input function may work here - thanks Bjoern :)
However, according to the wiki the <code> tag is deprecated :(
Yes :( But I don't think it will go away really soon. To much tools using it and no alternative is available. Cheers, Bjoern
Peter
On Mon, Oct 21, 2013 at 1:55 PM, Bjoern Gruening wrote:
On 21.10.2013, Peter Cock wrote:
On Mon, Oct 21, 2013 at 12:22 PM, Bjoern Gruening wrote:
In the meantime you can use a code file to check your variables. Please have a look at our wip DeSeq2 warpper:
https://github.com/bgruening/galaxytools/tree/master/deseq2
or the excellent blog post from Ross:
http://cloudimaging.blogspot.com.au/2013/05/input-validation-in-galaxy.html
Hope that helps, Bjoern
Yes, a helper Python script linked via the <code> tag containing a validate_input function may work here - thanks Bjoern :)
However, according to the wiki the <code> tag is deprecated :(
Yes :( But I don't think it will go away really soon. To much tools using it and no alternative is available.
Thank you for those example links Bjoern. Ross mentioned on the blog post that we should see a "Log messages" popup from printing with the validate_input() function - I didn't, should that still work? I also found if I returned a non-empty dictionary in error_map (even with no error messages) then this was treated as a failure. Even with some working code to refer to this wasn't very straightforward, but I managed to get this to work: https://github.com/peterjc/pico_galaxy/commit/fee450c0bcee6935cc3e65da3e3281... (I would love to write some unit tests for error conditions, something we talked about at GCC2013, but sadly that is still not possible yet.) Regards, Peter P.S. I wonder if the <code> validate_input function is still used when running a tool via the API...
participants (2)
-
Bjoern Gruening
-
Peter Cock