Geting integer value from InputValueWrapper in plugin xml file
Hi, I am a new galaxy developer playing with writing my first plugins In my plugin xml configaration file: I want to be able to increase the value of one parameter based on another using <command interpreter="python"> #if $rows.option =="header_ignore" #set $data_start = $rows.ignore + 1 but I get: unsupported operand type(s) for +: 'InputValueWrapper' and 'int' A hack workaround I found was: #set $data_start = int(str($rows.ignore)) + 1 I just wondered if there was a cleaner way to get the integer value from a InputValueWrapper object. Which is set to integer by: <param name="ignore" size="4" type="integer" value="1" .... If documentation exist somwere please send me an RTFM link. (I didn't find it in https://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax) Thanks in advance Christian Brenninkmeijer University of Manchester Ps. If you want to see exactly what I am playing with see https://github.com/Christian-B/galaxy_tools/tree/master/summary (Note that is subject to change as I learn)
On Thu, Apr 16, 2015 at 1:59 PM, Christian Brenninkmeijer <christian.brenninkmeijer@manchester.ac.uk> wrote:
Hi, I am a new galaxy developer playing with writing my first plugins
In my plugin xml configaration file: I want to be able to increase the value of one parameter based on another using
<command interpreter="python"> #if $rows.option =="header_ignore" #set $data_start = $rows.ignore + 1
but I get: unsupported operand type(s) for +: 'InputValueWrapper' and 'int'
A hack workaround I found was: #set $data_start = int(str($rows.ignore)) + 1
I just wondered if there was a cleaner way to get the integer value from a InputValueWrapper object.
That is exactly what I would have tried. Probably with a little work on Galaxy we could get int($rows.ignore) to work too by defining an __int__ method on the InputValueWrapper class (see file lib/galaxy/tools/wrappers.py for details), but that would not work on older Galaxy installations which may or may not bother you? Design wise, it would be nice if these wrapper classes offered more Python base object behaviour directly, but that is a design choice worth wider discussion?
Which is set to integer by: <param name="ignore" size="4" type="integer" value="1" ....
If documentation exist somwere please send me an RTFM link. (I didn't find it in https://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax)
Thanks in advance Christian Brenninkmeijer University of Manchester
Ps. If you want to see exactly what I am playing with see https://github.com/Christian-B/galaxy_tools/tree/master/summary (Note that is subject to change as I learn)
Regards, Peter
On Thu, Apr 16, 2015 at 9:10 AM, Peter Cock <p.j.a.cock@googlemail.com> wrote:
On Thu, Apr 16, 2015 at 1:59 PM, Christian Brenninkmeijer <christian.brenninkmeijer@manchester.ac.uk> wrote:
Hi, I am a new galaxy developer playing with writing my first plugins
In my plugin xml configaration file: I want to be able to increase the value of one parameter based on another using
<command interpreter="python"> #if $rows.option =="header_ignore" #set $data_start = $rows.ignore + 1
but I get: unsupported operand type(s) for +: 'InputValueWrapper' and 'int'
A hack workaround I found was: #set $data_start = int(str($rows.ignore)) + 1
I just wondered if there was a cleaner way to get the integer value from a InputValueWrapper object.
That is exactly what I would have tried.
Probably with a little work on Galaxy we could get int($rows.ignore) to work too by defining an __int__ method on the InputValueWrapper class (see file lib/galaxy/tools/wrappers.py for details), but that would not work on older Galaxy installations which may or may not bother you?
Good idea Peter - I have opened a pull request here with this functionality: https://github.com/galaxyproject/galaxy/pull/121 Christian - sorry I don't have a more clever workaround for this hack in the meantime. -John
Design wise, it would be nice if these wrapper classes offered more Python base object behaviour directly, but that is a design choice worth wider discussion?
Which is set to integer by: <param name="ignore" size="4" type="integer" value="1" ....
If documentation exist somwere please send me an RTFM link. (I didn't find it in https://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax)
Thanks in advance Christian Brenninkmeijer University of Manchester
Ps. If you want to see exactly what I am playing with see https://github.com/Christian-B/galaxy_tools/tree/master/summary (Note that is subject to change as I learn)
Regards,
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: https://lists.galaxyproject.org/
To search Galaxy mailing lists use the unified search at: http://galaxyproject.org/search/mailinglists/
participants (3)
-
Christian Brenninkmeijer
-
John Chilton
-
Peter Cock