common-workflow-language / common-workflow-language/cwltool

cwltool --pack generates an invalid json when input contains a nested optional multi-type schema

Open
#2,126 0 comments 0 reactions 1 assignee Claimed by @alexiswl View on GitHub
Dominant language
Python
Stars
376
Forks
255
Avg merge
2d 7h
Merged PRs (30d)
12

Description

## Summary

The workflow provided (when packed), fails to resolve the imports for bam-input and cram-input.
These schemas are nested and imported by the schema dragen-wgts-dna-options-variant-calling-stage__4.4.4.yaml.

There are two imports for both bam-input and cram-input. One under 'alignment_data', which is a mandatory field in the variant calling stage, and the other is under tumor_alignment_data, which is not a mandatory field (since this workflow aims to handle both germline and somatic data inputs).

If I remove the tumor_alignment_data record, then bam-input and cram-input are imported successfully. I have also tried importing both schemas in the workflow and tool but with no success.

I am not blocked on this entirely since this workflow is actually a subworkflow in a larger workflow that is packed by cwltool directly.
I just prefer the workflow graphs generated by a packed image as opposed to those generated by a standard Workflow file.

```yaml
type: record
name: dragen-wgts-dna-options-variant-calling-stage
fields:
# Data inputs
alignment_data:
label: alignment data
doc: |
The data from the alignment stage
type:
- {"$import": "../../bam-input/1.0.0/bam-input__1.0.0.yaml#bam-input"}
- {"$import": "../../cram-input/1.0.0/cram-input__1.0.0.yaml#cram-input"}
tumor_alignment_data:
label: tumor alignment data
doc: |
The data from the tumor alignment stage (optional)
type:
- "null"
- {"$import": "../../bam-input/1.0.0/bam-input__1.0.0.yaml#bam-input"}
- {"$import": "../../cram-input/1.0.0/cram-input__1.0.0.yaml#cram-input"}
ref_tar:
label: ref tar
doc: |
Specifies the tarball containing the reference hash table. If the reference is not already loaded into the DRAGEN card, the option automatically loads the reference.
Note that the actual dragen command is '--ref-dir' but we first need to download and extract the tarball.
type: File
...
```

## Data

[dragen-wgts-dna-variant-calling-stage__4.4.4.zip](https://github.com/user-attachments/files/20785056/dragen-wgts-dna-variant-calling-stage__4.4.4.zip)

[workflow.packed.json](https://github.com/user-attachments/files/20785112/workflow.packed.json)

## Source

https://github.com/umccr/cwl-ica/blob/main/workflows/dragen-wgts-dna-variant-calling-stage/4.4.4/dragen-wgts-dna-variant-calling-stage__4.4.4.cwl

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.