comparison extract_workflow_connections.py @ 5:4f7e6612906b draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/recommendation_training/tools/tool_recommendation_model commit 5eebc0cb44e71f581d548b7e842002705dd155eb"
author bgruening
date Fri, 06 May 2022 09:05:18 +0000
parents 5b3c08710e47
children e94dc7945639
comparison
equal deleted inserted replaced
4:afec8c595124 5:4f7e6612906b
8 8
9 import utils 9 import utils
10 10
11 11
12 class ExtractWorkflowConnections: 12 class ExtractWorkflowConnections:
13
14 def __init__(self): 13 def __init__(self):
15 """ Init method. """ 14 """ Init method. """
16 15
17 def collect_standard_connections(self, row): 16 def collect_standard_connections(self, row):
18 published = row[8] 17 published = row[8]
31 workflow_paths_dup = "" 30 workflow_paths_dup = ""
32 workflow_parents = dict() 31 workflow_parents = dict()
33 workflow_paths = list() 32 workflow_paths = list()
34 unique_paths = dict() 33 unique_paths = dict()
35 standard_connections = dict() 34 standard_connections = dict()
36 with open(raw_file_path, 'rt') as workflow_connections_file: 35 with open(raw_file_path, "rt") as workflow_connections_file:
37 workflow_connections = csv.reader(workflow_connections_file, delimiter='\t') 36 workflow_connections = csv.reader(workflow_connections_file, delimiter="\t")
38 for index, row in enumerate(workflow_connections): 37 for index, row in enumerate(workflow_connections):
39 wf_id = str(row[0]) 38 wf_id = str(row[0])
40 in_tool = row[3] 39 in_tool = row[3].strip()
41 out_tool = row[6] 40 out_tool = row[6].strip()
42 if wf_id not in workflows: 41 if wf_id not in workflows:
43 workflows[wf_id] = list() 42 workflows[wf_id] = list()
44 if out_tool and in_tool and out_tool != in_tool: 43 if out_tool and in_tool and out_tool != in_tool:
45 workflows[wf_id].append((out_tool, in_tool)) 44 workflows[wf_id].append((out_tool, in_tool))
46 qc = self.collect_standard_connections(row) 45 qc = self.collect_standard_connections(row)
142 return [path] 141 return [path]
143 path_list = list() 142 path_list = list()
144 if end in graph: 143 if end in graph:
145 for node in graph[end]: 144 for node in graph[end]:
146 if node not in path: 145 if node not in path:
147 new_tools_paths = self.find_tool_paths_workflow(graph, start, node, path) 146 new_tools_paths = self.find_tool_paths_workflow(
147 graph, start, node, path
148 )
148 for tool_path in new_tools_paths: 149 for tool_path in new_tools_paths:
149 path_list.append(tool_path) 150 path_list.append(tool_path)
150 return path_list 151 return path_list