Skip to content

Commit

Permalink
fix docs & add test for discover_datasets sort_by
Browse files Browse the repository at this point in the history
- order of sort_comp and sort_by was wrong for
  sort_by in collections
- sort_by was missing for data output
- adds a test (though we can't check the generated
  order .. I manually tested with `planemo serve`)
  • Loading branch information
bernt-matthias committed Apr 29, 2020
1 parent bb0df4f commit 38e05f2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/galaxy/tool_util/xsd/galaxy.xsd
Expand Up @@ -4214,6 +4214,11 @@ More information can be found on Planemo's documentation for
<xs:documentation xml:lang="en">Format (or datatype) of discovered datasets (an alias with ``format``).</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="sort_by" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation xml:lang="en">A string `[reverse_][SORT_COMP_]SORTBY` describing the desired sort order of the collection elements. `SORTBY` can be `filename`, `name`, `designation`, `dbkey` and the optional `SORT_COMP` can be either `lexical` or `numeric`. Default is lexical sorting by filename.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="visible" type="xs:boolean" use="optional">
<xs:annotation>
<xs:documentation xml:lang="en">Indication if this dataset is visible in output history. This defaults to ``false``, but probably shouldn't - be sure to set to ``true`` if that is your intention.</xs:documentation>
Expand Down Expand Up @@ -4269,7 +4274,7 @@ Galaxy, including:
</xs:attribute>
<xs:attribute name="sort_by" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation xml:lang="en">A string `[reverse_]SORTBY[_SORT_COMP]` describing the desired sort order of the collection elements. `SORTBY` can be `filename`, `name`, `designation`, `dbkey` and the optional `SORT_COMP` can be either `lexical` or `numeric`. Default is lexical sorting by filename.</xs:documentation>
<xs:documentation xml:lang="en">A string `[reverse_][SORT_COMP_]SORTBY` describing the desired sort order of the collection elements. `SORTBY` can be `filename`, `name`, `designation`, `dbkey` and the optional `SORT_COMP` can be either `lexical` or `numeric`. Default is lexical sorting by filename.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="visible" type="xs:boolean" use="optional">
Expand Down
26 changes: 26 additions & 0 deletions test/functional/tools/discover_sort_by.xml
@@ -0,0 +1,26 @@
<tool id="collection_split_on_column" name="collection_split_on_column" version="0.1.0">
<command>
mkdir outputs; cd outputs; awk '{ print \$2 > (\$1 ".tabular") }' $input1
</command>
<inputs>
<param name="input1" type="data" label="Input Table" help="Table to split on first column" format="tabular" />
</inputs>
<outputs>
<collection name="collection_numeric_name" type="list" label="Table split on first column">
<discover_datasets pattern="__name_and_ext__" sort_by="numeric_name" directory="outputs" />
</collection>
<collection name="collection_rev_numeric_name" type="list" label="Table split on first column">
<discover_datasets pattern="__name_and_ext__" sort_by="reverse_numeric_name" directory="outputs" />
</collection>
<data name="data_numeric_name">
<discover_datasets pattern="__name_and_ext__" format="tabular" assign_primary_output="true" sort_by="reverse_numeric_name" directory="outputs" visible="true"/>
</data>
</outputs>
<tests>
<test>
<param name="input1" value="tinywga.fam" />
<output_collection name="collection_numeric_name" type="list" count="11"/>
<output_collection name="collection_rev_numeric_name" type="list" count="11"/>
</test>
</tests>
</tool>
1 change: 1 addition & 0 deletions test/functional/tools/samples_tool_conf.xml
Expand Up @@ -154,6 +154,7 @@
<tool file="collection_creates_dynamic_nested_fail.xml" />
<tool file="collection_cat_group_tag.xml" />
<tool file="collection_cat_group_tag_multiple.xml" />
<tool file="discover_sort_by.xml" />
<tool file="expression_forty_two.xml" />
<tool file="expression_parse_int.xml" />
<tool file="expression_log_line_count.xml" />
Expand Down

0 comments on commit 38e05f2

Please sign in to comment.