diff extract_workflow_connections.py @ 4:f0da532be419 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:04:44 +0000
parents 50753817983a
children 9ec705bd11cb
line wrap: on
line diff
--- a/extract_workflow_connections.py	Tue Jul 07 07:24:21 2020 +0000
+++ b/extract_workflow_connections.py	Fri May 06 09:04:44 2022 +0000
@@ -10,7 +10,6 @@
 
 
 class ExtractWorkflowConnections:
-
     def __init__(self):
         """ Init method. """
 
@@ -33,12 +32,12 @@
         workflow_paths = list()
         unique_paths = dict()
         standard_connections = dict()
-        with open(raw_file_path, 'rt') as workflow_connections_file:
-            workflow_connections = csv.reader(workflow_connections_file, delimiter='\t')
+        with open(raw_file_path, "rt") as workflow_connections_file:
+            workflow_connections = csv.reader(workflow_connections_file, delimiter="\t")
             for index, row in enumerate(workflow_connections):
                 wf_id = str(row[0])
-                in_tool = row[3]
-                out_tool = row[6]
+                in_tool = row[3].strip()
+                out_tool = row[6].strip()
                 if wf_id not in workflows:
                     workflows[wf_id] = list()
                 if out_tool and in_tool and out_tool != in_tool:
@@ -144,7 +143,9 @@
         if end in graph:
             for node in graph[end]:
                 if node not in path:
-                    new_tools_paths = self.find_tool_paths_workflow(graph, start, node, path)
+                    new_tools_paths = self.find_tool_paths_workflow(
+                        graph, start, node, path
+                    )
                     for tool_path in new_tools_paths:
                         path_list.append(tool_path)
         return path_list