diff --git a/lib/galaxy/tool_util/xsd/galaxy.xsd b/lib/galaxy/tool_util/xsd/galaxy.xsd index 388642ea275..9498af6a835 100644 --- a/lib/galaxy/tool_util/xsd/galaxy.xsd +++ b/lib/galaxy/tool_util/xsd/galaxy.xsd @@ -4676,10 +4676,10 @@ In both cases the desired metadata is selected by ``key``. The ``static_value`` and ``regexp`` filters can be inverted by setting ``keep`` to true. -* ``add_value``: add an option with a given ``name`` and ``value`` to the options. By default the new option is appended, with ``index`` the insertion position can be specified. -* ``remove_value``: remove a value from the options. Either specified explicitly with ``value``, the value of another input specifified with ``ref``, or the metatdata ``key`` of another input ``meta_ref``. +* ``add_value``: add an option with a given ``name`` and ``value`` to the options. By default, the new option is appended, with ``index`` the insertion position can be specified. +* ``remove_value``: remove a value from the options. Either specified explicitly with ``value``, the value of another input specified with ``ref``, or the metadata ``key`` of another input ``meta_ref``. * ``unique_value``: remove options that have duplicate entries in the given ``column``. -* ``sort_by``: sort options by the entries of a given ``column``. +* ``sort_by``: sort options by the entries of a given ``column``. If ``reverse_sort_order`` is set to ``true``, reverse sort order from ascending to descending. * ``multiple_splitter``: split the entries of the specified ``column``(s) in the referenced file using a ``separator``. Thereby the number of columns is increased. ### Examples @@ -4868,6 +4868,13 @@ added to the end of the list. from the list. + + + Used when ``type`` is ``sort_by``, if set to + ``true`` it will reverse the sort order from ascending to descending. Default + is ``false``. + + diff --git a/lib/galaxy/tools/parameters/dynamic_options.py b/lib/galaxy/tools/parameters/dynamic_options.py index 6e99da51b5c..896ba8f1c14 100644 --- a/lib/galaxy/tools/parameters/dynamic_options.py +++ b/lib/galaxy/tools/parameters/dynamic_options.py @@ -516,9 +516,10 @@ class SortByColumnFilter(Filter): column = elem.get("column", None) assert column is not None, "Required 'column' attribute missing from filter" self.column = d_option.column_spec_to_index(column) + self.reverse = string_as_bool(elem.get("reverse_sort_order", "False")) def filter_options(self, options, trans, other_values): - return sorted(options, key=lambda x: x[self.column]) + return sorted(options, key=lambda x: x[self.column], reverse=self.reverse) filter_types = dict(