common-workflow-language / common-workflow-language/cwl-v1.2

Workflow validation fail with secondaryFiles

Open
#296 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Common Workflow Language
Stars
45
Forks
28
PR merge metrics
No merged PRs in 30d

Description

I have a tool:

```
cwlVersion: v1.2
class: CommandLineTool

label: Samtools-index-bam
doc: Samtools is a suite of programs for interacting with high-throughput sequencing data

requirements:
InlineJavascriptRequirement: {}
InitialWorkDirRequirement:
listing:
- $(inputs.bam)

hints:
- $import: samtools-docker.yml
- $import: samtools-bioconda.yml

inputs:
bam:
type: File
inputBinding:
position: 1

outputs:
indexed_bam:
type: File
secondaryFiles: .bai
outputBinding:
glob: $(inputs.bam.basename)

baseCommand: [samtools, index, -b]
```

The workflow:

```
class: Workflow
cwlVersion: v1.2

id: bwa_alignment_sort
doc: This workflow aligns the fastq files using bwa, sort and index the BAM file
label: bwa alignment workflow

requirements:
InlineJavascriptRequirement: {}
StepInputExpressionRequirement: {}
SubworkflowFeatureRequirement: {}

inputs:
bam: File
threads: int

outputs:
sorted_indexed_bam:
outputSource: bam_index/indexed_bam
type: File
secondaryFiles: .bai

steps:
bam_sort:
run: ../../tools/samtools/samtools-sort.cwl
label: Samtools-sort
in:
in_bam: bam
out_bam:
valueFrom: ${ return inputs.in_bam.nameroot.replace('Aligned.out', '') + "_sorted.bam";}
threads: threads
out: [out_sam]
bam_index:
run: ../../tools/samtools/samtools-index-bam.cwl
label: Samtools-index
in:
bam: bam_sort/out_sam
out: [indexed_bam]
```

I'm getting this error:

```
(cwltool) hydra:Variant-calling> cwltool --debug --validate samtools-sort_index.cwl
INFO /opt/miniconda3/envs/cwltool/bin/cwltool 3.1.20250715140722
INFO Resolved 'samtools-sort_index.cwl' to 'file:///Users/veraalva/Work/Developer/Python/cwl-ngs-workflows-cbb/workflows/Variant-calling/samtools-sort_index.cwl'
ERROR I'm sorry, I couldn't load this CWL file.
The error was:
Traceback (most recent call last):
File "cwltool/main.py", line 1134, in main
File "cwltool/load_tool.py", line 588, in make_tool
File "cwltool/workflow.py", line 44, in default_make_tool
File "cwltool/workflow.py", line 125, in __init__
File "cwltool/checker.py", line 185, in static_checker
File "cwltool/checker.py", line 429, in _check_all_types
File "cwltool/checker.py", line 37, in check_types
File "cwltool/checker.py", line 88, in can_assign_src_to_sink
TypeError: list object expected; got ruamel.yaml.comments.CommentedMap
```

Python 3.12.11

The CWL gets validated if in the workflow output the line "secondaryFiles: .bai" get's commented

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with cwltool --debug --validate samtools-sort_index.cwl, using the shown workflow and tool files. Start in cwltool/checker.py at static_checker and check_types, then determine why the workflow output's secondaryFiles: .bai triggers the type error; done means validation handles this case consistently with the specification.

Written by the indexing model from the issue text.

Assessment

Tech stack
yaml
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.