mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #16937 from mvdbeek/fix_merge_collection_input_state_handling
[23.1] Skip state filtering in ``__MERGE_COLLECTION__`` tool
This commit is contained in:
@@ -3383,40 +3383,27 @@ class MergeCollectionTool(DatabaseOperationTool):
|
||||
for copy, input_list in enumerate(input_lists):
|
||||
for dce in input_list.collection.elements:
|
||||
element = dce.element_object
|
||||
valid = False
|
||||
element_identifier = dce.element_identifier
|
||||
identifier_seen = element_identifier in new_element_structure
|
||||
appearances = identifiers_map[element_identifier]
|
||||
add_suffix = False
|
||||
if dupl_actions == "suffix_every":
|
||||
add_suffix = True
|
||||
elif dupl_actions == "suffix_conflict" and len(appearances) > 1:
|
||||
add_suffix = True
|
||||
elif dupl_actions == "suffix_conflict_rest" and len(appearances) > 1 and appearances[0] != copy:
|
||||
add_suffix = True
|
||||
|
||||
# dealing with a single element
|
||||
if hasattr(element, "is_ok"):
|
||||
if element.is_ok:
|
||||
valid = True
|
||||
elif hasattr(element, "dataset_instances"):
|
||||
# we are probably a list:paired dataset, both need to be in non error state
|
||||
forward_o, reverse_o = element.dataset_instances
|
||||
if forward_o.is_ok and reverse_o.is_ok:
|
||||
valid = True
|
||||
if dupl_actions == "keep_first" and identifier_seen:
|
||||
continue
|
||||
|
||||
if valid:
|
||||
element_identifier = dce.element_identifier
|
||||
identifier_seen = element_identifier in new_element_structure
|
||||
appearances = identifiers_map[element_identifier]
|
||||
add_suffix = False
|
||||
if dupl_actions == "suffix_every":
|
||||
add_suffix = True
|
||||
elif dupl_actions == "suffix_conflict" and len(appearances) > 1:
|
||||
add_suffix = True
|
||||
elif dupl_actions == "suffix_conflict_rest" and len(appearances) > 1 and appearances[0] != copy:
|
||||
add_suffix = True
|
||||
if add_suffix and suffix_pattern:
|
||||
suffix = suffix_pattern.replace("#", str(copy + 1))
|
||||
effective_identifer = f"{element_identifier}{suffix}"
|
||||
else:
|
||||
effective_identifer = element_identifier
|
||||
|
||||
if dupl_actions == "keep_first" and identifier_seen:
|
||||
continue
|
||||
|
||||
if add_suffix and suffix_pattern:
|
||||
suffix = suffix_pattern.replace("#", str(copy + 1))
|
||||
effective_identifer = f"{element_identifier}{suffix}"
|
||||
else:
|
||||
effective_identifer = element_identifier
|
||||
|
||||
new_element_structure[effective_identifer] = element
|
||||
new_element_structure[effective_identifer] = element
|
||||
|
||||
# Don't copy until we know everything is fine and we have the structure of the list ready to go.
|
||||
new_elements = {}
|
||||
|
||||
@@ -2976,6 +2976,47 @@ steps:
|
||||
workflow = crate.mainEntity
|
||||
assert workflow
|
||||
|
||||
@skip_without_tool("__MERGE_COLLECTION__")
|
||||
def test_merge_collection_scheduling(self, history_id):
|
||||
summary = self._run_workflow(
|
||||
"""
|
||||
class: GalaxyWorkflow
|
||||
inputs:
|
||||
collection:
|
||||
type: collection
|
||||
collection_type: list
|
||||
outputs:
|
||||
merge_out:
|
||||
outputSource: merge/output
|
||||
steps:
|
||||
sleep:
|
||||
tool_id: cat_data_and_sleep
|
||||
in:
|
||||
input1: collection
|
||||
state:
|
||||
sleep_time: 5
|
||||
merge:
|
||||
tool_id: __MERGE_COLLECTION__
|
||||
in:
|
||||
inputs_1|input: sleep/out_file1
|
||||
inputs_0|input: sleep/out_file1
|
||||
test_data:
|
||||
collection:
|
||||
collection_type: list
|
||||
elements:
|
||||
- identifier: 1
|
||||
content: A
|
||||
""",
|
||||
history_id=history_id,
|
||||
wait=True,
|
||||
assert_ok=True,
|
||||
)
|
||||
invocation = self.workflow_populator.get_invocation(summary.invocation_id, step_details=True)
|
||||
merge_out_id = invocation["output_collections"]["merge_out"]["id"]
|
||||
merge_out = self.dataset_populator.get_history_collection_details(history_id, content_id=merge_out_id)
|
||||
assert merge_out["element_count"] == 1
|
||||
assert merge_out["elements"][0]["object"]["state"] == "ok"
|
||||
|
||||
@skip_without_tool("__MERGE_COLLECTION__")
|
||||
@skip_without_tool("cat_collection")
|
||||
@skip_without_tool("head")
|
||||
@@ -5385,6 +5426,39 @@ input1:
|
||||
# Also check that we don't overwrite the original HDA's datatype
|
||||
assert details2["elements"][0]["object"]["file_ext"] == "fasta"
|
||||
|
||||
@skip_without_tool("__EXTRACT_DATASET__")
|
||||
def test_run_build_list_change_datatype_new_metadata_file_parameter(self):
|
||||
# Regression test for changing datatype to a datatype with a MetadataFileParameter
|
||||
with self.dataset_populator.test_history() as history_id:
|
||||
self._run_workflow(
|
||||
"""
|
||||
class: GalaxyWorkflow
|
||||
inputs:
|
||||
input1: data
|
||||
steps:
|
||||
build_list:
|
||||
tool_id: __BUILD_LIST__
|
||||
in:
|
||||
datasets_0|input: input1
|
||||
extract_dataset:
|
||||
tool_id: __EXTRACT_DATASET__
|
||||
in:
|
||||
input: build_list/output
|
||||
outputs:
|
||||
output:
|
||||
change_datatype: vcf_bgzip
|
||||
""",
|
||||
test_data="""
|
||||
input1:
|
||||
value: test.vcf.gz
|
||||
type: File
|
||||
file_type: vcf_bgzip
|
||||
""",
|
||||
history_id=history_id,
|
||||
assert_ok=True,
|
||||
wait=True,
|
||||
)
|
||||
|
||||
@skip_without_tool("__BUILD_LIST__")
|
||||
def test_run_build_list_rename_collection_output(self):
|
||||
with self.dataset_populator.test_history() as history_id:
|
||||
|
||||
Reference in New Issue
Block a user