-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix https://cwl-utils.readthedocs.io/ #57
Comments
Hi @nyue, this issue on cwlgen has a rough guide on how cwl-utils can be used to generate CWL: common-workflow-lab/python-cwlgen#27 In essence, you can do something like the following: import cwl_utils.parser_v1_2 as cwl
clt = cwl.CommandLineTool(
# eg: keys from https://github.com/common-workflow-language/cwl-utils/blob/c7308efbbbd4d64f5d479f27bf46ca6041cfb7b2/cwl_utils/parser_v1_2.py#L7000-L7021
id="mytoolid",
inputs=[
cwl. CommandInputParameter(**fields)
]
)
dict_representation = clt.save() |
Thanks Michael. I am making some progress. After the call to save() [I get a dictionary], what calls/method is there to write that out to a CWL file I can test with cwltool/cromwell ? Cheers |
This is a rough excerpt of the code I've used in the past: def convert_tool_to_yaml(tool):
# Convert dict to YAML
import ruamel.yaml
yaml = ruamel.yaml.YAML()
tool_dict = tool.save()
io = StringIO()
yaml.dump(tool_dict, io)
return io.getvalue() |
Thank you, got it writing out CWL/YAML file. |
Glad you found a solution! I'm reopening this to remind us to improve the docs |
This issue has been mentioned on Common Workflow Language Discourse. There might be relevant details there: https://cwl.discourse.group/t/how-to-implement-a-reduce-method-in-cwl/294/3 |
This was super helpful. |
I am looking at the possibility of using cwl-utils to generate CWL files programmatically in Python
I discover cwl-utils when browsing python-cwlgen
I am hoping to find example that illustrate how CommandLineTool and CommandInputParameter should be put together via cwl-utils
I have not found any examples thus far.
Cheers
The text was updated successfully, but these errors were encountered: