Skip to content

Workflow validation fail with secondaryFiles #2139

@r78v10a07

Description

@r78v10a07

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions