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

Generate CWL abstract with gxformat2 #35

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ pyld[requests]==1.0.5
requests==2.22.0
urllib3==1.25.6
arcp==0.2.1
galaxy2cwl
gxformat2
jinja2
11 changes: 6 additions & 5 deletions rocrate/rocrate_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@
import atexit
import os
import tempfile
from contextlib import redirect_stdout
from pathlib import Path

import rocrate.rocrate as roc
from rocrate.model import entity
from rocrate.model.workflow import Workflow
from galaxy2cwl import get_cwl_interface

from gxformat2.yaml import ordered_dump, ordered_load
from gxformat2.abstract import from_dict

def make_workflow_rocrate(workflow_path, wf_type, include_files=[],
fetch_remote=False, cwl=None, diagram=None):
Expand Down Expand Up @@ -86,8 +85,10 @@ def make_workflow_rocrate(workflow_path, wf_type, include_files=[],
if not cwl:
# create cwl_abstract
with tempfile.NamedTemporaryFile(mode='w', delete=False, suffix=".cwl") as f:
with redirect_stdout(f):
get_cwl_interface.main(['1', workflow_path])
with open(workflow_path) as orig_f:
wf_dict = ordered_load(orig_f)
abstract_dict = from_dict(wf_dict)
ordered_dump(abstract_dict, f)
atexit.register(os.unlink, f.name)
abstract_wf_id = wf_path.with_suffix(".cwl").name
abstract_wf_file = Workflow(wf_crate, f.name, abstract_wf_id)
Expand Down