common-workflow-lab/python-cwlgen

Unable to add SoftwareRequirement

matthdsm opened this issue · 9 comments

Hi,

I'm trying to add SoftwareRequirement to a CommandLineTool instance like so

tool.hints.extend([
    cwlgen.SoftwareRequirement().SoftwarePackage(
       "bcl2fastq", version="2.20.0", specs=["https://identifiers.org/rrid/RRID:SCR_015058"]),
])

which seems to work, but produces invalid CWL where the SoftwareRequirement key is missing.

How do you recommend adding SoftwarePackages to the CommandLineTool def?

Thanks
M

Or do you recommend going with cwl-utils instead of this project?

M

Hey @matthdsm, you can add it to the requirements.py file.

There’s one issue with CWL Utils #27 before I see it as a viable replacement, but the intention is to deprecate this project as it supports different specs (where this is limited to CWL v1.0).

Hi @illusional

Thanks for the quick reply!
The fact is, it's already there (great work on your part), but I'm unable to call it, since SoftwareRequirement takes no arguments.
How should I call cwlgen.SoftwareRequirement, so I can add a SoftwarePackage to it?

Thanks again
M

Ah @matthdsm, you're absolutely right! I've added a quick fix to #37 for solve this. You can install it with pip3 install git+https://github.com/common-workflow-language/python-cwlgen.git, and then I'll release it if that's it.

In the currently released version, you could do eg:

sreq = cwlgen.SoftwareRequirement()
sreq.packages = [cwlgen.SoftwareRequirement.SoftwarePackage(**kwargs)]

In the new version (in Git master) you can do:

sreq = cwlgen.SoftwareRequirement([cwlgen.SoftwareRequirement.SoftwarePackage(**kwargs)])

I can kick off a point release if this is all good.

Awesome! Thanks for the quick fix!

M

Actually fixed now.

Thanks for the fixes, but it seems we're not quite there yet.
using

# hints
bcl2fastq_tool.hints.extend([
    cwlgen.SoftwareRequirement([cwlgen.SoftwareRequirement.SoftwarePackage(
        "bcl2fastq",
        version=["2.20.0"],
        specs=["https://identifiers.org/rrid/RRID:SCR_015058"]
    )])
])

yields the following yaml

hints:
- packages:
  - package: bcl2fastq
    specs:
    - https://identifiers.org/rrid/RRID:SCR_015058
    version:
    - 2.20.0

which is missing the SoftwareRequirement key and is invalid according to cwltool
The following formatting registers as correct

hints:
  SoftwareRequirement:
    packages:
      bcl2fastq:
        specs: ["https://identifiers.org/rrid/RRID:SCR_015058"]
        version: ["2.20.0"]

It seems to me the SoftwareRequirement key needs to be added and the package key from SoftwarePackage needs to be dropped.

Cheers
M

Hi @matthdsm, there was some special handling for requirements that didn't happen for hints. Could you give the current master another look, I've added #39 to address this separate issue?

Magnificent! Everything work great!

Thanks a lot, and thanks for the quick responses!

Cheers
M