Skip to content

Commit d00f055

Browse files
add documentation for output action attributes
- document that tool provided metadata should be preferred over the ``actions`` tag. galaxyproject/planemo#1167 should be merged first - add documentation for tags - + 2 TODOs in tool_util/parser/output_actions.py
1 parent 7c34b05 commit d00f055

File tree

2 files changed

+120
-17
lines changed

2 files changed

+120
-17
lines changed

lib/galaxy/tool_util/parser/output_actions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ def __init__(self, parent, elem):
400400
self.column = elem.get('column', None) # None is append
401401
if self.column:
402402
self.column = int(self.column)
403+
# TODO not supported in xsd
403404
self.iterate = util.string_as_bool(elem.get("iterate", 'False'))
404405

405406
def filter_options(self, options, other_values):
@@ -583,6 +584,7 @@ def filter_options(self, options, other_values):
583584

584585
# helper classes
585586
# determine cast function
587+
# TODO add float
586588
def parse_cast_attribute(cast):
587589
if cast == 'string_as_bool':
588590
cast = util.string_as_bool

lib/galaxy/tool_util/xsd/galaxy.xsd

Lines changed: 118 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4857,6 +4857,8 @@ Galaxy, including:
48574857
<xs:complexType name="Actions">
48584858
<xs:annotation>
48594859
<xs:documentation xml:lang="en"><![CDATA[
4860+
The functionality of the ``actions`` tag should be replaced by
4861+
[tool provided metadata](https://planemo.readthedocs.io/en/latest/writing_advanced.html#tool-provided-metadata).
48604862
48614863
The ``actions`` directive allows tools to dynamically take actions related to an
48624864
``output`` either unconditionally or conditionally based on inputs. These
@@ -5066,14 +5068,31 @@ if none of the nested options apply.</xs:documentation>
50665068
</xs:complexType>
50675069
<xs:complexType name="ActionsOption">
50685070
<xs:annotation>
5069-
<xs:documentation xml:lang="en"></xs:documentation>
5071+
<xs:documentation xml:lang="en"><![CDATA[
5072+
1. Load options from a data table, a parameter (or its metadata), or a file
5073+
2. Filter the options using all filters defined by the contained ``filter`` tags.
5074+
3. Chose a value in a given line (``offset``) and ``column``
5075+
5076+
The options can be considered as a table where each line is an option. The values
5077+
in the columns can be used for filtering.
5078+
5079+
The different data sources can be loaded as follows:
5080+
5081+
- ``from_data_table``: load the options from the data table with the given ``name``.
5082+
- ``from_param``: Initialize a single option containing the value of the
5083+
referred parameter (``name``) or its metadata (``param_attribute``)
5084+
- ``from_file``: Load the file the given ``name`` (in Galaxy's tool data path), columns
5085+
are defined by the given ``separator`` (default is tab).
5086+
]]></xs:documentation>
50705087
</xs:annotation>
50715088
<xs:sequence>
50725089
<xs:element name="filter" type="ActionsConditionalFilter" minOccurs="0" maxOccurs="unbounded"/>
50735090
</xs:sequence>
5074-
<xs:attribute name="type" type="ActionsOptionType">
5091+
<xs:attribute name="type" type="ActionsOptionType" use="required">
50755092
<xs:annotation>
5076-
<xs:documentation xml:lang="en"></xs:documentation>
5093+
<xs:documentation xml:lang="en"><![CDATA[
5094+
Source of the tabular data ``from_data_table``, ``from_param``, or ``from_file``.
5095+
]]></xs:documentation>
50775096
</xs:annotation>
50785097
</xs:attribute>
50795098
<xs:attribute name="name" type="xs:string">
@@ -5152,72 +5171,154 @@ against.</xs:documentation>
51525171
</xs:annotation>
51535172
<xs:attribute name="type" type="ActionsConditionalFilterType" use="required">
51545173
<xs:annotation>
5155-
<xs:documentation xml:lang="en"><![CDATA[]]></xs:documentation>
5174+
<xs:documentation xml:lang="en"><![CDATA[
5175+
``param_value``
5176+
5177+
- get the value of a refered parameter (``ref``) or the value given by ``value``
5178+
- if ``param_attribute`` is given the corresponding attribute of the value of the reffered parameter is used ``ref``
5179+
- cast this value with the function given by ``cast``
5180+
- compare the each the value in the column given by ``column`` (also casted) with the determined value using the function given by ``compare``
5181+
- if the result of the comparison is equal to the boolean given by ``keep`` the value is kept
5182+
5183+
``insert_column``
5184+
5185+
- insert a column with a value in the options
5186+
- if ``column`` is given then the column is inserted before this column, otherwise the column is appended
5187+
- the value can be given by ``ref`` or ``value``
5188+
5189+
``column_strip``
5190+
5191+
Strip (remove certain characters from the suffix / prefix) values in a column.
5192+
The characters to strip can be given by ``strip`` (deafult is whitespace
5193+
characters)
5194+
5195+
``multiple_splitter``
5196+
5197+
Split the values in a ``column`` by a given ``separator``. And replace the
5198+
original column with the with columns containing the result of splitting.
5199+
5200+
``column_replace``
5201+
5202+
Replace values in a column. The old and new values can be given
5203+
5204+
- as static values ``old_value`` or ``new_value``
5205+
- dynamically by the contents in (another) column ``old_column`` or ``new_colum``
5206+
5207+
``metadata_value``
5208+
5209+
Filter values in ``column`` by the metadata element ``name`` of the referred
5210+
parameter ``ref`` depending on the results of the comparison function given by
5211+
with ``compare`` and the value of ``keep`` (i.e. if the result of the
5212+
comparision is equal to ``keep`` then keep the option).
5213+
5214+
``boolean``
5215+
5216+
Cast the values in ``column`` using the cast function given by ``cast``
5217+
(unaccessible / uncastable values are interpreted as False). The result of this
5218+
cast is then casted with the bool function. If the final result is equal to
5219+
``keep`` the option.
5220+
5221+
``string_function``
5222+
5223+
Apply a string function to the values in ``column``. The string function is given by ``name``.
5224+
5225+
]]></xs:documentation>
51565226
</xs:annotation>
51575227
</xs:attribute>
51585228
<xs:attribute name="compare" type="CompareType">
51595229
<xs:annotation>
5160-
<xs:documentation xml:lang="en"></xs:documentation>
5230+
<!-- TOOD xsd only allows startswith and re_search code also supports eq, neq, gt, gte, lt, lte, in, endswith -->
5231+
<xs:documentation xml:lang="en"><![CDATA[
5232+
Function to use for the comparision. One of startswith, re_search.
5233+
Applies to: ``param_value``, ``metadata_value``
5234+
]]></xs:documentation>
51615235
</xs:annotation>
51625236
</xs:attribute>
51635237
<xs:attribute name="ref" type="xs:string">
51645238
<xs:annotation>
5165-
<xs:documentation xml:lang="en"></xs:documentation>
5239+
<xs:documentation xml:lang="en"><![CDATA[
5240+
Name of an input parameter (parameters in conditionals or sections are referred using the dot syntax, e.g. ``cond.paramname``).
5241+
Applies to ``param_value``, ``insert_column``, ``metadata_value``
5242+
]]></xs:documentation>
51665243
</xs:annotation>
51675244
</xs:attribute>
51685245
<xs:attribute name="value" type="xs:string">
51695246
<xs:annotation>
5170-
<xs:documentation xml:lang="en"></xs:documentation>
5247+
<xs:documentation xml:lang="en"><![CDATA[
5248+
Fixed value to use for the comparison.
5249+
Applies to ``param_value``, ``insert_column``
5250+
]]></xs:documentation>
51715251
</xs:annotation>
51725252
</xs:attribute>
51735253
<xs:attribute name="column" type="xs:integer">
51745254
<xs:annotation>
5175-
<xs:documentation xml:lang="en"></xs:documentation>
5255+
<xs:documentation xml:lang="en"><![CDATA[
5256+
Column of the options (0 based).
5257+
Applies to ``param_value``, ``insert_column``, ``column_strip``, ``multiple_splitter``, ``column_replace``, ``metadata_value``, ``boolean``, ``string_function``
5258+
]]></xs:documentation>
51765259
</xs:annotation>
51775260
</xs:attribute>
51785261
<xs:attribute name="keep" type="PermissiveBoolean">
51795262
<xs:annotation>
5180-
<xs:documentation xml:lang="en"></xs:documentation>
5263+
<xs:documentation xml:lang="en"><![CDATA[
5264+
Keep the value if the filter condition is met. default: true
5265+
Applies to ``param_value``, ``metadata_value``, ``boolean``
5266+
]]></xs:documentation>
51815267
</xs:annotation>
51825268
</xs:attribute>
51835269
<xs:attribute name="cast" type="xs:string">
51845270
<xs:annotation>
5185-
<xs:documentation xml:lang="en"></xs:documentation>
5271+
<!-- float might be nice -->
5272+
<xs:documentation xml:lang="en"><![CDATA[
5273+
one of string_as_bool, int, str function used for casting the value.
5274+
Applies to ``param_value``, ``boolean``</xs:documentation>
5275+
]]></xs:documentation>
51865276
</xs:annotation>
51875277
</xs:attribute>
51885278
<xs:attribute name="param_attribute" type="xs:string">
51895279
<xs:annotation>
5190-
<xs:documentation xml:lang="en"></xs:documentation>
5280+
<xs:documentation xml:lang="en">
5281+
Which atttribute of the parameter value referred by ``ref`` to use. Separate with ``.``.
5282+
Applies to ``param_value``</xs:documentation>
51915283
</xs:annotation>
51925284
</xs:attribute>
51935285
<xs:attribute name="separator" type="xs:string">
51945286
<xs:annotation>
5195-
<xs:documentation xml:lang="en"></xs:documentation>
5287+
<xs:documentation xml:lang="en">Applies to ``multiple_splitter``</xs:documentation>
51965288
</xs:annotation>
51975289
</xs:attribute>
51985290
<xs:attribute name="strip" type="PermissiveBoolean">
51995291
<xs:annotation>
5200-
<xs:documentation xml:lang="en"></xs:documentation>
5292+
<xs:documentation xml:lang="en">Applies to ``column_strip``</xs:documentation>
52015293
</xs:annotation>
52025294
</xs:attribute>
52035295
<xs:attribute name="old_column" type="xs:string">
52045296
<xs:annotation>
5205-
<xs:documentation xml:lang="en"></xs:documentation>
5297+
<xs:documentation xml:lang="en">Applies to ``column_replace``</xs:documentation>
52065298
</xs:annotation>
52075299
</xs:attribute>
52085300
<xs:attribute name="old_value" type="xs:string">
52095301
<xs:annotation>
5210-
<xs:documentation xml:lang="en"></xs:documentation>
5302+
<xs:documentation xml:lang="en">Applies to ``column_replace``</xs:documentation>
52115303
</xs:annotation>
52125304
</xs:attribute>
52135305
<xs:attribute name="new_column" type="xs:string">
52145306
<xs:annotation>
5215-
<xs:documentation xml:lang="en"></xs:documentation>
5307+
<xs:documentation xml:lang="en">Applies to ``column_replace``</xs:documentation>
52165308
</xs:annotation>
52175309
</xs:attribute>
52185310
<xs:attribute name="new_value" type="xs:string">
52195311
<xs:annotation>
5220-
<xs:documentation xml:lang="en"></xs:documentation>
5312+
<xs:documentation xml:lang="en">Applies to ``column_replace``</xs:documentation>
5313+
</xs:annotation>
5314+
</xs:attribute>
5315+
<xs:attribute name="name" type="xs:string">
5316+
<xs:annotation>
5317+
<xs:documentation xml:lang="en"><![CDATA[
5318+
For ``metadata_value`` this is the name of the metadata to use. For ``string``
5319+
function the string function to use (currently ``lower`` or ``upper``).
5320+
Applies to ``metadata_value``, ``string_function``
5321+
]]></xs:documentation>
52215322
</xs:annotation>
52225323
</xs:attribute>
52235324
</xs:complexType>

0 commit comments

Comments
 (0)