CWL: Array of strings in workflow
2
0
Entering edit mode
5.3 years ago
mkher ▴ 50

I have a command line tool that expect an input that is an array of strings.

 programs:
    type:
      type: array
      items: string
      inputBinding: {prefix: PROGRAM=, separate: false}
    inputBinding:
      position: 10

I can run this with a job yaml file:

programs: ["CollectAlignmentSummaryMetrics"]

Now I'm trying to use this tool in a workflow and I can't figure out how to pass that value. It is not an input to the workflow. I always want to pass the same value to the tool, when called from this particular workflow. I'm probably missing something obvious.

Thank you. Manisha

CWL • 2.2k views
ADD COMMENT
1
Entering edit mode
5.3 years ago
Tom ▴ 540

You can tackle this at tool-level, by adding this as an argument to your CommandLineTool (see field arguments here)

arguments:
  - valueFrom: ["CollectAlignmentSummaryMetrics"]
    prefix: PROGRAM=
    separate: false
    position: 10

Alternatively, use StepInputExpressionRequirement to define a static WorkflowStepInput using valueFrom. Something like this:

step-giraffe-collect:
  run: giraffe.cwl
  in:
    [...]
    programs:
      valueFrom: ["CollectAlignmentSummaryMetrics"]
  out: [...]

*edit: Added example for the step input expression variant.

ADD COMMENT
0
Entering edit mode
5.3 years ago
mkher ▴ 50

Thank you, but that is not what I want to do. The tool is used in multiple contexts and the list of programs varies in each context. In my workflow there's a step where I call it with programs set to [CollectAlignementSummaryMetrics] and another step which calls the same tool with programs set to [MeanQualityByCycle, QualityScoreDistribution].

I have tested the steps individually and they work. In the process, I learned that I don't need the quotes to mark the values as strings. My difficulty is in passing the value from the workflow to the step at the above steps.

ADD COMMENT
0
Entering edit mode

I'm not sure i understand. If the arrays are not inputs to the workflow but different for different steps, then you want to hard-code them into the workflow, right? Shouldn't a StepInputExpression be what you are looking for? (I have added an example to my suggestion from yesterday to make it more clear.)

If hard-coding them like this is not sufficient, please explain in more detail what is supposed to happen in the workflow.

Best Regards, Tom

ADD REPLY
2
Entering edit mode

I'm sorry, my mistake. I missed your second suggestion of adding StepInputExpressionRequirement. That looks like exactly what I'm missing.

ADD REPLY
0
Entering edit mode

Great, glad i could help! Feel free to ask if there is any problem implementing this. When first using StepInputExpressionRequirement i struggled for quite a while.

If you were successful, please remember to mark the thread as solved by clicking on the appropriate button next to an answer that solved it.

Cheers,

Tom

ADD REPLY

Login before adding your answer.

Traffic: 2754 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6