Question: CWL: Array of strings in workflow
0
gravatar for mkher
11 months ago by
mkher50
mkher50 wrote:

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 • 415 views
ADD COMMENTlink modified 11 months ago • written 11 months ago by mkher50
1
gravatar for Tom
11 months ago by
Tom530
Tom530 wrote:

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 COMMENTlink modified 11 months ago • written 11 months ago by Tom530
0
gravatar for mkher
11 months ago by
mkher50
mkher50 wrote:

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 COMMENTlink written 11 months ago by mkher50

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 REPLYlink modified 11 months ago • written 11 months ago by Tom530
2

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

ADD REPLYlink written 11 months ago by mkher50

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 REPLYlink modified 11 months ago • written 11 months ago by Tom530
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1873 users visited in the last hour