Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions src/ephemeris/generate_tool_list_from_ga_workflow_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,12 @@ def _parser():

def get_workflow_dictionary(json_file):
with open(json_file, "r") as File:
mydict = json.load(File)[u'steps']
mydict = json.load(File)
return mydict


def translate_workflow_dictionary_to_tool_list(tool_dictionary, panel_label):
starting_tool_list = []
for step in tool_dictionary.values():
tsr = step.get("tool_shed_repository")
if tsr:
starting_tool_list.append(tsr)
def translate_workflow_dictionary_to_tool_list(workflow_dictionary, panel_label):
starting_tool_list = extract_tool_shed_repositories_from_workflow_dict(workflow_dictionary)
tool_list = []
for tool in starting_tool_list:
sub_dic = {
Expand All @@ -69,6 +65,18 @@ def translate_workflow_dictionary_to_tool_list(tool_dictionary, panel_label):
return tool_list


def extract_tool_shed_repositories_from_workflow_dict(workflow_dictionary):
tool_list = []
for step in workflow_dictionary['steps'].values():
subworkflow = step.get("subworkflow")
if subworkflow:
tool_list.extend(extract_tool_shed_repositories_from_workflow_dict(subworkflow))
tsr = step.get("tool_shed_repository")
if tsr:
tool_list.append(tsr)
return tool_list


def print_yaml_tool_list(tool_dictionary, output_file):
with open(output_file, 'w') as F:
F.write("\n".join([INSTALL_TOOL_DEPENDENCIES, INSTALL_REPOSITORY_DEPENDENCIES, INSTALL_RESOLVER_DEPENDENCIES, "", ""]))
Expand All @@ -93,7 +101,6 @@ def reduce_tool_list(tool_list):

def generate_tool_list_from_workflow(workflow_files, panel_label, output_file):
"""

:rtype: object
"""
intermediate_tool_list = []
Expand Down