Skip to content
This repository was archived by the owner on Jun 9, 2020. It is now read-only.

Commit ca06118

Browse files
authored
Merge pull request #21 from illusional/origin-pr
Big PR
2 parents 2ea29cc + a001142 commit ca06118

23 files changed

+1836
-910
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ build/
66
cwlgen.egg*
77
dist/
88
*.pyc
9+
.DS_Store
10+
.idea/
11+
.coverage

README.md

+55-8
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,69 @@ The library works for both Python 2.7.12+ and 3.6.0.
1111

1212
------------------------
1313

14-
# Quick-start guide
1514

16-
## Installation
15+
# Common Workflow Language
1716

18-
You can install python-cwlgen using pip with the following command:
17+
[Common Workflow Language (CWL)](https://www.commonwl.org/v1.0/index.html) is a language to describe workflows.
18+
The [user guide](http://www.commonwl.org/user_guide/01-introduction/index.html)
19+
gives a gentle explanation of what its goals are, but broadly:
20+
21+
1. Stop writing bash scripts for long complex jobs.
22+
2. Take pipelines anywhere (portability).
23+
3. Enforce reproducibility guidelines.
24+
25+
This python repository is a python wrapper for _most_ of the classes (work in progress),
26+
allowing you to build the structure of the workflow in Python and have this module generate and export CWL for you.
27+
28+
**Nb:** This doesn't check the logic of Workflows or CommandLineTools for you.
29+
[CWLTool](https://github.com/common-workflow-language/cwltool) has a `--validate` mode that you can use.
30+
31+
## Quick-start guide
32+
33+
You can install python-cwlgen through pip with the following command:
1934

2035
```bash
2136
pip install cwlgen
2237
```
2338

24-
## How it works ?
39+
### How it works?
40+
41+
This repository contains a number of python classes that mirror the CWL specifications ([Workflow](https://www.commonwl.org/v1.0/Workflow.html)|
42+
[CommandLineTool](https://www.commonwl.org/v1.0/CommandLineTool.html)). In essence, each class's initializer has all
43+
of the properties it expects, which may be another object. The classes include the relevant docstrings to give you
44+
context of classes and their properties.
45+
46+
The `examples/` folder contains some simple examples, however in essence you simply initialize the class you're
47+
trying to build. An initializer for a class has all of the properties it expects which may be another object.
48+
2549

26-
An example of usage is available in the `example/` folder of the repository (more details [here](http://python-cwlgen.readthedocs.io/en/latest/user_guide.html))
50+
_Creating a CommandLineTool_
51+
```python
52+
import cwlgen
53+
54+
tool_object = cwlgen.CommandLineTool(tool_id="echo-tool", base_command="echo", label=None, doc=None,
55+
cwl_version="v1.0", stdin=None, stderr=None, stdout=None, path=None)
56+
tool_object.inputs.append(
57+
cwlgen.CommandInputParameter("myParamId", param_type="string", label=None, secondary_files=None, param_format=None,
58+
streamable=None, doc=None, input_binding=None, default=None)
59+
)
60+
61+
# to get the dictionary representation:
62+
dict_to_export = tool_object.get_dict()
63+
64+
# to get the string representation (YAML)
65+
yaml_export = tool_object.export_string()
66+
67+
# print to console
68+
tool_object.export()
69+
70+
# print to file
71+
with open("echotool.cwl", "w") as f:
72+
tool_object.export(f)
73+
```
2774

2875
## References
2976

30-
CWL is developed by an informal, multi-vendor working group consisting of organizations and
31-
individuals aiming to enable scientists to share data analysis workflows.
32-
[The CWL project is on Github.](https://github.com/common-workflow-language/common-workflow-language)
77+
CWL is developed by an informal, multi-vendor working group consisting of organizations and individuals
78+
aiming to enable scientists to share data analysis workflows.
79+
The [CWL project is on Github](https://github.com/common-workflow-language/common-workflow-language).

0 commit comments

Comments
 (0)