Skip to content
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

Implementat a small subset of the Common Workflow Language tool format. #24

Closed
wants to merge 1 commit into from

Commits on Mar 16, 2015

  1. Implementat a small subset of the Common Workflow Language tool format.

     - Draft 2 currently, but stuff is stubbed out for draft 1 as well - shouldn't be too hard to support both.
     - Implemented integer params, data parameter, and arrays thereof.
     - Semantics of required versus optional parameters needs so work (may be subtlely difficult to mesh with Galaxy). Union types, null types, etc... are not implemented yet.
     - Docker integration is only partial - for simple things pull right from docker hub it works (so cat3-tool.cwl works). Full semantics of CWL docker stuff not yet implemented - so for instance bwa-mem image pulled from SBG does not yet work.
    
    Implementation:
    
    The reference implementation Python library (mainly developed by Peter Amstutz - https://github.com/common-workflow-language/common-workflow-language/tree/master/reference) is used to load tool files ending with ".json" or ".cwl" and proxy objects are created to adapt these tools to Galaxy representations. In particular input and output descriptions are loaded from the tool.
    
    When the tool is submitted, a special specialized tool class is used to build a cwltool compatible job description from the supplied Galaxy inputs and the CWL reference implementation is used to generate a CWL reference implementation Job object. A command-line is generated from this Job object.
    
    As a result of this - Galaxy largely does not need to worry about the details of command-line adapters, expressions, etc....
    
    Galaxy writes a description of the CWL job that it can reload to the job working directory. After the process is complete (on the Galaxy compute server, but outside the Docker container) this representation is reloaded and the dynamic outputs are discovered and moved to fixed locations as expected by Galaxy (CWL allows for much more expressive output locations than Galaxy - for better or worse).
    
    Unfortunatley, none of the outputs have datatypes so Galaxy view of the datasets is quite limitted. They cannot really be used within the rest of the Galaxy ecosystem, no preview or visualization of the datasets is enabled, etc.... The fix is three fold -
    
      1) Galaxy's metadata collection needs to be extended so datasets can be marked as requiring sniffing before metadata collection.
      2) CWL should support EDAM declaration of types and Galaxy should provide a mapping to core datasets to skip sniffing is types are found.
      3) For finer grain control within Galaxy, extensions to CWL should allow setting actual Galaxy output types on outputs. (Distinction between fastq and fastqsanger in Galaxy is very important for instance.)
    
    Testing:
    
        % git clone https://github.com/jmchilton/galaxy.git
        % git checkout cwl
        % cd galaxy
        % virtualenv galaxy/.venv
        % . galaxy/.venv/bin/activate
        % git clone https://github.com/common-workflow-language/common-workflow-language.git
        % cd common-workflow-language/reference
        % easy_install .
        % cd ../galaxy
        % cp -r test/unit/tools/cwl_tools tools/
        % cp config/galaxy.ini.sample config/galaxy.ini
        % cp config/tool_conf.xml.sample config/tool_conf.xml
        % vi config/tool_conf.xml
    
    Add the following section
    
        <section id="cwl_test" name="CWL Test Tools">
            <tool file="cwl_tools/cat3-tool.cwl" />
            <tool file="cwl_tools/bwa-mem-tool.cwl" />
        </section>
    
    Start Galaxy.
    
        % GALAXY_CONFIG_ENABLE_BETA_TOOL_FORMATS=True run.sh --reload
    
    Open http://localhost:8080/ and see CWL Test Tools in left hand tool panel.
    
    To go a step further and actually run CWL jobs within their designated Docker containers, copy the following minimal Galaxy job configuration file to config/job_conf.xml. (Adjust the docker_sudo parameter based on how you execute Docker).
    
    https://gist.github.com/jmchilton/3997fa471d1b4c556966
    
    Run an API test demonstrating the cat3 demo tool with the following command.
    
        ./run_tests.sh -with_framework_test_tools -api test/api/test_tools.py:ToolsTestCase.test_cwl_cat3
    
    Rework output collection.
    
    Set outputs to work dir outputs and relocate them before metadata generation occurs, this way metadata collection happens on the outputs.
    
    Enable docker containers.
    jmchilton committed Mar 16, 2015
    Configuration menu
    Copy the full SHA
    be6d14b View commit details
    Browse the repository at this point in the history