I try to write a script in R, which requires to modify a .cwl file. Take a minimal example of test.cwl file:
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: Workflow
requirements:
- class: StepInputExpressionRequirement
inputs:
- id: submissionId
type: int
outputs: []
Ideally, I want to read this test.cwl and modify the inputs$id. Finally, write out to an updated new_test.cwl file. However, I can't find a way to read this test.cwl file in R? I have tried tidycwl, but it can only read files with ymal or json extension.
If any packages from python will do the trick, I would also be happy to use it with reticulate.
Thank you!
Based on @nuno-carvalho's answer, I added ruamel.yaml to fix indent for arrays:
Output:
I am not good at python, please feel to suggest