Calling Subworkflow from another file

Hello,

I was wondering if it’s possible to call a sub-workflow directly (something like import in python) if it’s not written in the main Workflow file?

This might help to increase the readability when the workflow gets quite long and it needs to do repetitive tasks with the same or different data. Please let me know if we can do something similar or is there any workaround already known.
Thanks in advance!

Hey @HrishiDhondge ; that is totally possible to run a CWL sub-workflow directly. A CWL sub-workflow is just a class: Workflow. You can run it standalong, for sure!

Thanks for the answer!
Yes, but my question was if I can run a sub-workflow (or class workflow) by importing it into a Workflow. So I don’t have to write this sub-workflow explicitly in the workflow file?

The sub workflow will need its own entry under steps, but it can stay in another file. Put the name/path/link to the file in the run line.

Like this:

cwlVersion: v1.0
class: Workflow

inputs: ...

outputs: ...

steps:
  first_tool: ...
  my_sub_workflow_step:
     run: path/to/sub_workflow.cwl
     in:  ...
     out: [ ... ]
1 Like