From 7dc87aed78de749e2226049a503627c36d644d7c Mon Sep 17 00:00:00 2001 From: M Bernt Date: Fri, 31 Jan 2020 13:38:36 +0100 Subject: [PATCH 1/6] data_column use_header_names test and docs - add a test (also as example) - clarify in the docs --- lib/galaxy/tool_util/xsd/galaxy.xsd | 8 +++++--- test/functional/tools/column_param.xml | 10 ++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/galaxy/tool_util/xsd/galaxy.xsd b/lib/galaxy/tool_util/xsd/galaxy.xsd index 6ae0e3e102c..f994bc85272 100644 --- a/lib/galaxy/tool_util/xsd/galaxy.xsd +++ b/lib/galaxy/tool_util/xsd/galaxy.xsd @@ -2563,8 +2563,10 @@ Set to ``false`` to not force user to select an option in the list.Used only if the ``type`` attribute value is ``data_column``, if ``true`` Galaxy assumes first row of ``data_ref`` is a header and builds the select list with these values rather than the more -generic ``c1`` ... ``cN``. - +generic ``c1`` ... ``cN`` (i.e. it will be ``c1: head1`` ... ``cN: headN``). +Note that the content of the Cheetah variable is still +the column index. + @@ -4830,7 +4832,7 @@ write out a JSON representation of the tool parameters. *Example* -The following will create a cheetah variable that can be evaluated as ``$inputs`` that +The following will create a Cheetah variable that can be evaluated as ``$inputs`` that will contain the tool parameter inputs. ```xml diff --git a/test/functional/tools/column_param.xml b/test/functional/tools/column_param.xml index 92b979210e7..f89979179df 100644 --- a/test/functional/tools/column_param.xml +++ b/test/functional/tools/column_param.xml @@ -1,10 +1,13 @@ - + '$output1' - + ]]> + @@ -13,8 +16,11 @@ + + + From b5b4f0955627408205509eeded6ff818f1db602b Mon Sep 17 00:00:00 2001 From: M Bernt Date: Fri, 31 Jan 2020 13:41:49 +0100 Subject: [PATCH 2/6] fix potential bug empty columns must not be stripped --- lib/galaxy/tools/parameters/basic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index 5fc67474e97..b6cecb959f5 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -1271,7 +1271,7 @@ class ColumnListParameter(SelectToolParameter): try: with open(dataset.get_file_name(), 'r') as f: head = f.readline() - cnames = head.rstrip().split('\t') + cnames = head.rstrip("\n\r ").split('\t') column_list = [('%d' % (i + 1), 'c%d: %s' % (i + 1, x)) for i, x in enumerate(cnames)] if self.numerical: # If numerical was requested, filter columns based on metadata if hasattr(dataset, 'metadata') and hasattr(dataset.metadata, 'column_types'): From 61e227dd855db95cee23d4e15015a91b606dee2e Mon Sep 17 00:00:00 2001 From: M Bernt Date: Fri, 31 Jan 2020 15:53:32 +0100 Subject: [PATCH 3/6] add missing tool output --- test/functional/tools/column_param.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/functional/tools/column_param.xml b/test/functional/tools/column_param.xml index f89979179df..dad77b65b6b 100644 --- a/test/functional/tools/column_param.xml +++ b/test/functional/tools/column_param.xml @@ -1,8 +1,8 @@ '$output1' + echo "col $col" >> '$output1' && + echo "col_names $col_names" >> '$output1' && + cut -f '$col' '$input1' >> '$output1' ]]> From 3015b398868bd6bb66ffe60949e096372cbfb9c0 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Mon, 20 Apr 2020 19:24:12 +0200 Subject: [PATCH 4/6] split test outputs --- test/functional/tools/column_param.xml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/test/functional/tools/column_param.xml b/test/functional/tools/column_param.xml index dad77b65b6b..5c39402bfdf 100644 --- a/test/functional/tools/column_param.xml +++ b/test/functional/tools/column_param.xml @@ -1,8 +1,8 @@ > '$output1' && - echo "col_names $col_names" >> '$output1' && - cut -f '$col' '$input1' >> '$output1' + cut -f '$col' '$input1' >> '$output1' + echo "col $col" >> '$output2' && + echo "col_names $col_names" >> '$output2' && ]]> @@ -11,6 +11,7 @@ + @@ -18,10 +19,14 @@ + + + + + - From 4be1232a59761a17cf892ca6d21f145b9bd5ee75 Mon Sep 17 00:00:00 2001 From: M Bernt Date: Tue, 21 Apr 2020 14:34:51 +0200 Subject: [PATCH 5/6] remove indentation Co-Authored-By: Nicola Soranzo --- test/functional/tools/column_param.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/functional/tools/column_param.xml b/test/functional/tools/column_param.xml index 5c39402bfdf..66c9c66491d 100644 --- a/test/functional/tools/column_param.xml +++ b/test/functional/tools/column_param.xml @@ -1,8 +1,8 @@ > '$output1' - echo "col $col" >> '$output2' && - echo "col_names $col_names" >> '$output2' && +cut -f '$col' '$input1' > '$output1' && +echo "col $col" > '$output2' && +echo "col_names $col_names" >> '$output2' ]]> From 505b3b32a5c0aba3341d19506c3cebec8ad4e3cd Mon Sep 17 00:00:00 2001 From: M Bernt Date: Tue, 21 Apr 2020 16:13:53 +0200 Subject: [PATCH 6/6] Apply suggestions from code review Co-Authored-By: Nicola Soranzo --- lib/galaxy/tool_util/xsd/galaxy.xsd | 2 +- test/functional/tools/column_param.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/tool_util/xsd/galaxy.xsd b/lib/galaxy/tool_util/xsd/galaxy.xsd index f994bc85272..51450ab95fb 100644 --- a/lib/galaxy/tool_util/xsd/galaxy.xsd +++ b/lib/galaxy/tool_util/xsd/galaxy.xsd @@ -2561,7 +2561,7 @@ Set to ``false`` to not force user to select an option in the list. Used only if the ``type`` attribute -value is ``data_column``, if ``true`` Galaxy assumes first row of ``data_ref`` +value is ``data_column``. If ``true``, Galaxy assumes the first row of ``data_ref`` is a header and builds the select list with these values rather than the more generic ``c1`` ... ``cN`` (i.e. it will be ``c1: head1`` ... ``cN: headN``). Note that the content of the Cheetah variable is still diff --git a/test/functional/tools/column_param.xml b/test/functional/tools/column_param.xml index 66c9c66491d..b5933606e48 100644 --- a/test/functional/tools/column_param.xml +++ b/test/functional/tools/column_param.xml @@ -11,7 +11,7 @@ echo "col_names $col_names" >> '$output2' - +