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

Workflow validation fail with secondaryFiles

Open
#2,139 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
376
Forks
255
Avg merge
2d 7h
Merged PRs (30d)
12

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

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.