def to_dict(self, input_connections): # We are to the point where we need a content id for this. We got # figure that out - short term we can load everything up as an # in-memory tool and reference by the JSONLD ID I think. So workflow # proxy should force the loading of a tool. tool_proxy = cwl_tool_object_to_proxy(self.tool_references()[0]) from galaxy.tools.hash import build_tool_hash tool_hash = build_tool_hash(tool_proxy.to_persistent_representation()) # We need to stub out null entries for things getting replaced by # connections. This doesn't seem ideal - consider just making Galaxy # handle this. tool_state = {} for input_name in input_connections.keys(): tool_state[input_name] = None outputs = self.galaxy_workflow_outputs_list() return { "id": self._index, "tool_hash": tool_hash, "label": self.label, "position": {"left": 0, "top": 0}, "type": "tool", "annotation": self._workflow_proxy.cwl_object_to_annotation(self._step.tool), "input_connections": input_connections, "inputs": self.inputs_to_dicts(), "workflow_outputs": outputs, }
def to_dict(self, input_connections): # We are to the point where we need a content id for this. We got # figure that out - short term we can load everything up as an # in-memory tool and reference by the JSONLD ID I think. So workflow # proxy should force the loading of a tool. tool_proxy = cwl_tool_object_to_proxy(self.tool_references()[0]) tool_hash = build_tool_hash(tool_proxy.to_persistent_representation()) # We need to stub out null entries for things getting replaced by # connections. This doesn't seem ideal - consider just making Galaxy # handle this. tool_state = {} for input_name in input_connections.keys(): tool_state[input_name] = None outputs = self.galaxy_workflow_outputs_list() return { "id": self._index, "tool_hash": tool_hash, "label": self.label, "position": {"left": 0, "top": 0}, "type": "tool", "annotation": self._workflow_proxy.cwl_object_to_annotation(self._step.tool), "input_connections": input_connections, "inputs": self.inputs_to_dicts(), "workflow_outputs": outputs, }
def galaxy_id(self): raw_id = self.id tool_id = None # don't reduce "search.cwl#index" to search if raw_id and "#" not in raw_id: tool_id = os.path.splitext(os.path.basename(raw_id))[0] if not tool_id: from galaxy.tools.hash import build_tool_hash tool_id = build_tool_hash(self.to_persistent_representation()) assert tool_id return tool_id
def galaxy_id(self): raw_id = self.id if raw_id: return os.path.splitext(os.path.basename(raw_id))[0] else: return build_tool_hash(self.to_persistent_representation())