Skip to content

Commit 578cd95

Browse files
authored
Merge pull request #170 from cat-bro/wtt-subworkflows2
workflow-to-tools: get tools from subworkflows
2 parents 3be983e + 5b629a3 commit 578cd95

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

src/ephemeris/generate_tool_list_from_ga_workflow_files.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,12 @@ def _parser():
4747

4848
def get_workflow_dictionary(json_file):
4949
with open(json_file, "r") as File:
50-
mydict = json.load(File)[u'steps']
50+
mydict = json.load(File)
5151
return mydict
5252

5353

54-
def translate_workflow_dictionary_to_tool_list(tool_dictionary, panel_label):
55-
starting_tool_list = []
56-
for step in tool_dictionary.values():
57-
tsr = step.get("tool_shed_repository")
58-
if tsr:
59-
starting_tool_list.append(tsr)
54+
def translate_workflow_dictionary_to_tool_list(workflow_dictionary, panel_label):
55+
starting_tool_list = extract_tool_shed_repositories_from_workflow_dict(workflow_dictionary)
6056
tool_list = []
6157
for tool in starting_tool_list:
6258
sub_dic = {
@@ -69,6 +65,18 @@ def translate_workflow_dictionary_to_tool_list(tool_dictionary, panel_label):
6965
return tool_list
7066

7167

68+
def extract_tool_shed_repositories_from_workflow_dict(workflow_dictionary):
69+
tool_list = []
70+
for step in workflow_dictionary['steps'].values():
71+
subworkflow = step.get("subworkflow")
72+
if subworkflow:
73+
tool_list.extend(extract_tool_shed_repositories_from_workflow_dict(subworkflow))
74+
tsr = step.get("tool_shed_repository")
75+
if tsr:
76+
tool_list.append(tsr)
77+
return tool_list
78+
79+
7280
def print_yaml_tool_list(tool_dictionary, output_file):
7381
with open(output_file, 'w') as F:
7482
F.write("\n".join([INSTALL_TOOL_DEPENDENCIES, INSTALL_REPOSITORY_DEPENDENCIES, INSTALL_RESOLVER_DEPENDENCIES, "", ""]))
@@ -93,7 +101,6 @@ def reduce_tool_list(tool_list):
93101

94102
def generate_tool_list_from_workflow(workflow_files, panel_label, output_file):
95103
"""
96-
97104
:rtype: object
98105
"""
99106
intermediate_tool_list = []

0 commit comments

Comments
 (0)