Skip to content

Commit 2b9e676

Browse files
ignore duplicate options for selects
1 parent e0385fa commit 2b9e676

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

ctdconverter/galaxy/converter.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -454,13 +454,10 @@ def _convert_internal(parsed_ctds, **kwargs):
454454
# overwrite attributes of the parsed ctd parameters as specified in hardcoded parameters json
455455
for param in utils.extract_and_flatten_parameters(model):
456456
hardcoded_attributes = parameter_hardcoder.get_hardcoded_attributes(utils.extract_param_name(param), model.name, 'CTD')
457-
logger.error(f"hardcoded_attributes {hardcoded_attributes}")
458457
if hardcoded_attributes is not None:
459458
for a in hardcoded_attributes:
460459
if not hasattr(param, a):
461-
logger.error(f"no attr {a} {dir(param)}")
462460
continue
463-
logger.error(f"HERE")
464461
if a == "type":
465462
try:
466463
t = GALAXY_TYPE_TO_TYPE[hardcoded_attributes[a]]
@@ -481,7 +478,6 @@ def _convert_internal(parsed_ctds, **kwargs):
481478
else:
482479
setattr(param, a, hardcoded_attributes[a])
483480
else:
484-
logger.error(f"set a {a}")
485481
setattr(param, a, hardcoded_attributes[a])
486482

487483
if "test_only" in kwargs and kwargs["test_only"]:
@@ -900,7 +896,7 @@ def get_galaxy_parameter_path(param, separator=".", suffix=None, fix_underscore=
900896
if len(path) > 1:
901897
path = path[:-1] + [p]
902898
elif param.advanced and (param.type is not _OutFile or suffix):
903-
return ADVANCED_OPTIONS_NAME + p
899+
path = [ADVANCED_OPTIONS_NAME, p]
904900
else:
905901
path = [p]
906902
# data input params with multiple="true" are in a (batch mode) conditional
@@ -1268,7 +1264,13 @@ def create_param_attribute_list(param, model, supported_file_formats, parameter_
12681264
if is_default(fmt, param):
12691265
option_node.attrib["selected"] = "true"
12701266
else:
1267+
unique_choices = set()
12711268
for choice in param.restrictions.choices:
1269+
if str(choice) in unique_choices:
1270+
logger.warning(f"Option {choice} of {utils.extract_param_name(param)} is not unique.")
1271+
continue
1272+
else:
1273+
unique_choices.add(str(choice))
12721274
option_node = add_child_node(param_node, "option",
12731275
OrderedDict([("value", str(choice))]),
12741276
text=str(choice))

0 commit comments

Comments
 (0)