Skip to main content

Tool to generate CWL workflows

Project description

codacy_grade codacy_coverage travis documentation pypi_version pypi_supported DOI

scriptcwl is a Python package for creating workflows in Common Workflow Language (CWL). If you give it a number of CWL CommandLineTools, you can create a workflow by writing a Python script. This can be done interactively using Jupyter Notebooks. The full documentation can be found on Read the Docs.

add multiply example workflow

Given CWL CommandLineTools for add and multiply (these are available in scriptcwl), a CWL specification of this workflow can be written as:

from scriptcwl import WorkflowGenerator

with WorkflowGenerator() as wf:
  wf.load(steps_dir='/path_to_scriptcwl/scriptcwl/examples/')

  num1 = wf.add_input(num1='int')
  num2 = wf.add_input(num2='int')

  answer1 = wf.add(x=num1, y=num2)
  answer2 = wf.multiply(x=answer1, y=num2)

  wf.add_outputs(final_answer=answer2)

  wf.save('add_multiply_example_workflow.cwl')

The workflow has two integers as inputs (num1 and num2), and first adds these two numbers (wf.add(x=num1, y=num2)), and then multiplies the answer with the second input (num2). The result of that processing step is the output of the workflow. Finally, the workflow is saved to a file. The result looks like:

#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: Workflow
inputs:
  num1: int
  num2: int
outputs:
  final_answer:
    type: int
    outputSource: multiply/answer
steps:
  add:
    run: add.cwl
    in:
      y: num2
      x: num1
    out:
    - answer
  multiply:
    run: multiply.cwl
    in:
      y: num2
      x: add/answer
    out:
    - answer

The Python and CWL files used in the example can be found in the examples folder.

Installation

Install using pip:

pip install scriptcwl

For development:

git clone git@github.com:NLeSC/scriptcwl.git
cd scriptcwl
python setup.py develop

Run tests (including coverage) with:

python setup.py test

Useful tools

To use scriptcwl for creating CWL workflows, you need CWL CommandLineTools. There are some software packages that help with generating those for existing command line tools written in Python:

  • argparse2tool: Generate CWL CommandLineTool wrappers (and/or Galaxy tool descriptions) from Python programs that use argparse. Also supports the click argument parser.

  • pypi2cwl: Automatically run argparse2cwl on any package in PyPi.

  • python-cwlgen: Generate CommandLineTool and DockerRequirement programmatically

License

Copyright (c) 2016-2018, Netherlands eScience Center, University of Twente

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scriptcwl-0.8.0.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

scriptcwl-0.8.0-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file scriptcwl-0.8.0.tar.gz.

File metadata

  • Download URL: scriptcwl-0.8.0.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

File hashes

Hashes for scriptcwl-0.8.0.tar.gz
Algorithm Hash digest
SHA256 6da133f534bd797a44fca2c198cfbbf016efa95670cdc93927cca3670ab56bae
MD5 10a06f42230523046421f50c1b24c86c
BLAKE2b-256 7884b3b88d993b5f5839e6430a797c732d31195a9c52448f89d8a0cc5ba92748

See more details on using hashes here.

File details

Details for the file scriptcwl-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: scriptcwl-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

File hashes

Hashes for scriptcwl-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84eeaec898cb3947274dfabfc80d78a0144abe49654435bebf68f63654c3eb40
MD5 f6c13d475971b9faecca28f1da0bb52b
BLAKE2b-256 16f3d2749e50f52bb26f621146369a1b0a32628ff03322e726cbe76d98328ae1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page