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

Conversation

jmchilton
Copy link
Member

  • 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.

 - 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 jmchilton closed this Mar 16, 2015
@martenson
Copy link
Member

Not ready for review yet? @jmchilton

@jmchilton
Copy link
Member Author

No - not even close. Accidentally hit open PR on the keyboard while reviewing rendering of Markdown for the commit message (requires previewing a potential PR). This can be ignored for now :).

@dannon
Copy link
Member

dannon commented Mar 16, 2015

This is an automated message. Thanks for your contribution, a Trello card to track this issue has been created. Apply this patch for testing.

guerler referenced this pull request in guerler/galaxy Nov 3, 2016
jmchilton pushed a commit that referenced this pull request Oct 24, 2017
joachimwolff pushed a commit to joachimwolff/galaxy that referenced this pull request Jan 16, 2020
* New changes to tool recommendation 19_09

* Rename model and add config params

* Add new model

* Add yml file for admin recommendations

* Add admin tool recommendation config file

* Update yml files

* Remove whitespace

* Rebuild config and add remote path of trained model

* Add yml file to remove deprecated tools from recommendations and add additional tools proposed by admin

* Add try except block

* Update config schema

* Update config

* Remove model as it is fetched from remote

* Add API test and refactor API

* Update api

* Update config file

* Add config var

* Refactor API and add topk config param
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants