Setting multiple parameters for a workflow (API)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting multiple parameters for a workflow (API)

Carlos del Ojo
Hi all,

I am working in a project that requires running workflows with multiple parameter by using the Galaxy API.

However I realised that /api/workflows webservice does not allow to set several parameters for one sigle step.

You can check that ingalaxy-dist/lib/galaxy/workflow/run.py
  _update_step_parameters __doc__ string:

      PARAM_DICT = {'param': NAME, 'value': VALUE}

    Note that this format allows only one parameter to be set per step.

I've done a change in the script so it allows setting multiple parameters per step.

So the format of the PARAM_DICT would be:
PARAM_DICT={'param': ['threshold','path'], 'value': [2.3,'/tmp/kYzoax02.tmp']

a list of parameters and a list of values, that will be combined and assigned to the step.

I'm attaching a patch to the run.py file.
Is there any thought to fix that?
Could that be integrated in the main repository?
We have been patching the same part of the code for the last 2 months and I think it would be interesting to add this feature permanently.

Thanks,
C

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

run.py.patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Setting multiple parameters for a workflow (API)

John Chilton-4
Thanks for the contribution Carlos. The limitation that workflows only
can set one parameter be step is old at this point - the workflow API
definitely allows setting any number of parameters on any step - with
steps specified by individual step id or by tool id. This seems to
repeatedly trip people up. We need to be better about updating stale
documentation, sorry about that.

More information on setting parameters can be found on this biostar
post - https://biostar.usegalaxy.org/p/7598/

And here is the documentation in the code:

"""
    Update ``step`` parameters based on the user-provided ``param_map`` dict.

    ``param_map`` should be structured as follows::

      PARAM_MAP = {STEP_ID: PARAM_DICT, ...}
      PARAM_DICT = {NAME: VALUE, ...}

    For backwards compatibility, the following (deprecated) format is
    also supported for ``param_map``::

      PARAM_MAP = {TOOL_ID: PARAM_DICT, ...}

    in which case PARAM_DICT affects all steps with the given tool id.
    If both by-tool-id and by-step-id specifications are used, the
    latter takes precedence.

    Finally (again, for backwards compatibility), PARAM_DICT can also
    be specified as::

      PARAM_DICT = {'param': NAME, 'value': VALUE}

    Note that this format allows only one parameter to be set per step.
"""

The variant of parameter setting you modified is only there for
backward compatibility (I would consider it deprecated at this point)
- and since your change breaks that backward compatibility I don't
think we should really merge it into Galaxy - sorry.

Thanks again,
-John

On Wed, Jun 11, 2014 at 6:54 AM, Carlos del Ojo <[hidden email]> wrote:

> Hi all,
>
> I am working in a project that requires running workflows with multiple
> parameter by using the Galaxy API.
>
> However I realised that /api/workflows webservice does not allow to set
> several parameters for one sigle step.
>
> You can check that ingalaxy-dist/lib/galaxy/workflow/run.py
>   _update_step_parameters __doc__ string:
>
>       PARAM_DICT = {'param': NAME, 'value': VALUE}
>
>     Note that this format allows only one parameter to be set per step.
>
> I've done a change in the script so it allows setting multiple parameters
> per step.
>
> So the format of the PARAM_DICT would be:
> PARAM_DICT={'param': ['threshold','path'], 'value':
> [2.3,'/tmp/kYzoax02.tmp']
>
> a list of parameters and a list of values, that will be combined and
> assigned to the step.
>
> I'm attaching a patch to the run.py file.
> Is there any thought to fix that?
> Could that be integrated in the main repository?
> We have been patching the same part of the code for the last 2 months and I
> think it would be interesting to add this feature permanently.
>
> Thanks,
> C
>
> ___________________________________________________________
> 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/
___________________________________________________________
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/