GithubHelp home page GithubHelp logo

illusional / python-cwlgen Goto Github PK

View Code? Open in Web Editor NEW

This project forked from common-workflow-lab/python-cwlgen

1.0 1.0 0.0 322 KB

Generation of CWL programmatically. Available types: CommandLineTool, Workflow and Requirements

License: MIT License

Python 97.80% Common Workflow Language 2.20%

python-cwlgen's Introduction

python-cwlgen

Build Status codecov Documentation Status PyPI version

Python-cwlgen is a python library for the generation of CWL programmatically. It supports the generation of CommandLineTool, Workflow and DockerRequirement. The library works for both Python 2.7.12+ and 3.6.0.


Common Workflow Language

Common Workflow Language (CWL) is a language to describe workflows. The user guide gives a gentle explanation of what its goals are, but broadly:

  1. Stop writing bash scripts for long complex jobs.
  2. Take pipelines anywhere (portability).
  3. Enforce reproducibility guidelines.

This python repository is a python wrapper for most of the classes (work in progress), allowing you to build the structure of the workflow in Python and have this module generate and export CWL for you.

Nb: This doesn't check the logic of Workflows or CommandLineTools for you.
CWLTool has a --validate mode that you can use.

Quick-start guide

You can install python-cwlgen through pip with the following command:

pip install cwlgen

How it works?

This repository contains a number of python classes that mirror the CWL specifications (Workflow| CommandLineTool). In essence, each class's initializer has all of the properties it expects, which may be another object. The classes include the relevant docstrings to give you context of classes and their properties.

The examples/ folder contains some simple examples, however in essence you simply initialize the class you're trying to build. An initializer for a class has all of the properties it expects which may be another object.

Creating a CommandLineTool

import cwlgen

tool_object = cwlgen.CommandLineTool(tool_id="echo-tool", base_command="echo", label=None, doc=None,
                 cwl_version="v1.0", stdin=None, stderr=None, stdout=None, path=None)
tool_object.inputs.append(
    cwlgen.CommandInputParameter("myParamId", param_type="string", label=None, secondary_files=None, param_format=None,
                 streamable=None, doc=None, input_binding=None, default=None)
)

# to get the dictionary representation:
dict_to_export = tool_object.get_dict()

# to get the string representation (YAML)
yaml_export = tool_object.export_string()

# print to console
tool_object.export()

# print to file
tool_object.export("echotool.cwl")

References

CWL is developed by an informal, multi-vendor working group consisting of organizations and individuals aiming to enable scientists to share data analysis workflows. The CWL project is on Github.

Known issues

  • SchemaDefRequirement doesn't parse the types subfield into the specific types (InputRecordSchema | InputEnumSchema | InputArraySchema), but leaves them as a simple dictionary.

python-cwlgen's People

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.