NLeSC / scriptcwl

Create cwl workflows by writing a simple Python script
https://scriptcwl.readthedocs.io/
Apache License 2.0
40 stars 9 forks source link

Possible to add inputs of type array or record? #110

Closed allanbolipata closed 5 years ago

allanbolipata commented 5 years ago

Trying to see if there is a way to add_input of type array or record, or some combination containing one or more of these with scriptcwl. For example, how would someone add an input like the following to their workflow?

  my_array_of_array_of_strings:
    type:
      type: array
      items:
        type: array
        items: string

I couldn't find anything in the examples.

jvdzwaan commented 5 years ago

You can manually construct the complex input:

complex_input = dict(type=dict(type='array', items=dict(type='array', items='string')))
strings = wf.add_input(my_array_of_array_of_strings=complex_input)

This may be a bit error prone, but you can validate your (partial) workflow at any time using wf.validate(). Also printing your (partial) workflow may help to prevent mistakes.

Any ideas on making this more user friendly are welcome!

I tested a simple workflow with this complex input, and it worked. I'll add an example to the documentation.

allanbolipata commented 5 years ago

This is awesome, thank you!