Skip to content

Commit

Permalink
Merge pull request #19162 from mvdbeek/optimize_converter_order
Browse files Browse the repository at this point in the history
[24.1] Prefer auto-decompressed datatype when picking conversion target
  • Loading branch information
nsoranzo authored Nov 20, 2024
2 parents da31407 + 974d7e5 commit f382305
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion lib/galaxy/datatypes/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,16 @@ def find_conversion_destination_for_dataset_by_extensions(
if datatype and datatype.matches_any(accepted_datatypes):
return True, None, None

for convert_ext in self.get_converters_by_datatype(ext):
converter_extensions = self.get_converters_by_datatype(ext)
uncompressed_instance = getattr(datatype, "uncompressed_datatype_instance", None)
if uncompressed_instance and uncompressed_instance.file_ext in converter_extensions:
# sort uncompressed instance ahead of other possible conversions
converter_extensions = [
uncompressed_instance.file_ext,
*(ext for ext in converter_extensions if ext != uncompressed_instance.file_ext),
]

for convert_ext in converter_extensions:
convert_ext_datatype = self.get_datatype_by_extension(convert_ext)
if convert_ext_datatype is None:
self.log.warning(
Expand Down
2 changes: 1 addition & 1 deletion test/functional/tools/implicit_conversion_format_input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
cut -f 1 '$input1' > '$output1'
</command>
<inputs>
<param type="data" format="fasta" name="input1" label="Input 1" />
<param type="data" format="txt" name="input1" label="Input 1" />
</inputs>
<outputs>
<data name="output1" format="input" />
Expand Down

0 comments on commit f382305

Please sign in to comment.