"While"-style reccurent step (feature request ?)

Hi,

Would it be possible to build a workflow with a recurring step like below.

Here is a simple example to find the greatest common divisor from two integers.

The keyword while would make the inputs in to be splitted into initiation with the listing of inputs for the first step and reccurencewith the listing of inputs for each recurrence where the reccurent_step/x allow to get the output from the last run of the step.

Maybe there is already a kind of implementation for this ?

Bests,

class: Workflow
cwlVersion: v1.?
inputs:
  a: int
  b: int

steps:
  reccurent_step:
    in:
      initiation:
          a: a
          b: b
      recurrence:
          a: reccurent_step/last_b
          b: reccurent_step/a_modulo_b
    run: eulidian_division_a_b.cwl
    while: $(inputs.b !=0 )
    out: 
      a_modulo_b
      last_b

outputs:
  all_a_modulo_b:
    type: int[]
    outputSource:
      - reccurent_step/a_modulo_b

# NOTE: We could get the last value using a javascript expression

requirements:
  InlineJavascriptRequirement: {}
  MultipleInputFeatureRequirement: {}

Hi @jfouret

This isn’t a feature in the current CWL, although it has been discussed for a while:

1 Like