# Difficulty using fgbio with CWL

**URL:** <https://cwl.discourse.group/t/difficulty-using-fgbio-with-cwl/1004>\
**Category:** CWL Questions\
**Created:** [June 9, 2025, 7:36pm UTC](https://cwl.discourse.group/t/difficulty-using-fgbio-with-cwl/1004 "2025-06-09T19:36:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![skgo](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@skgo](https://cwl.discourse.group/u/skgo)\
**Post date:** [June 9, 2025, 7:36pm UTC](https://cwl.discourse.group/t/difficulty-using-fgbio-with-cwl/1004/1 "2025-06-09T19:36:34Z")

</div>

I’m trying to write a tool for running `fgbio ExtractUmisFromBam` and am having some difficulty with a particular argument. The `molecular_index_tags` argument expects a string of SAM tags of any length. When I provide a string I receive the error `Error: SAM tags must be of length two` so I have tried instead to have my tool accept an array of strings, but that also fails with the same error. When running fgbio manually without using CWL I do not encounter this issue. Clearly I am not providing the input string properly in CWL, but I’m at a loss as to what else to do. Any help would be appreciated.

My tool so far is:

```auto
cwlVersion: v1.2
class: CommandLineTool

hints:
  DockerRequirement:
    dockerPull: quay.io/biocontainers/fgbio

baseCommand: ["fgbio", "ExtractUmisFromBam"]

arguments:
  - prefix: "--output"
    valueFrom: $(inputs.sampleID).fgbio.bam

inputs:
  input:
    type: File
    inputBinding:
      position: 1
      prefix: "--input"
  sampleID:
    type: string
  read_structure:
    type: string
    inputBinding:
      position: 2
      prefix: "--read-structure"
  molecular_index_tags:
    type: string[]
    inputBinding:
      position: 3
      itemSeparator: ' '
      shellQuote: false
      prefix: "--molecular-index-tags"
  single_tag:
    type: string
    inputBinding:
      position: 4
      prefix: "--single-tag"

outputs:
  output_bam:
    type: File
    outputBinding:
      glob: "*.fgbio.bam"

```

My input is structured like so

```auto
input:
    class: File
    format: edam:format_2572
    path: ./test_files/input.bam
sampleID: "test_sample"
read_structure: "8M143T 8M143T"
molecular_index_tags:
    - "ZA"
    - "ZB"
single_tag: "RX"

```

The error I’m receiving is

```auto
Exception: ValidationException
Error: SAM tags must be of length two: ZA ZB

```

---

<div class="post-metadata">

**Author:** ![alexiswl](https://yyz2.discourse-cdn.com/free1/user_avatar/cwl.discourse.group/alexiswl/32/93_2.png) [@alexiswl](https://cwl.discourse.group/u/alexiswl)\
**Post date:** [June 10, 2025, 11:20am UTC](https://cwl.discourse.group/t/difficulty-using-fgbio-with-cwl/1004/2 "2025-06-10T11:20:28Z")

</div>

This is very interesting, can you try using the --debug parameter for cwltool to see what the actual shell script command is underneath?

---

<div class="post-metadata">

**Author:** ![alexiswl](https://yyz2.discourse-cdn.com/free1/user_avatar/cwl.discourse.group/alexiswl/32/93_2.png) [@alexiswl](https://cwl.discourse.group/u/alexiswl)\
**Post date:** [June 10, 2025, 12:05pm UTC](https://cwl.discourse.group/t/difficulty-using-fgbio-with-cwl/1004/3 "2025-06-10T12:05:46Z")

</div>

From the [array inputs guide](https://www.commonwl.org/user_guide/topics/inputs.html#array-inputs), the most appropriate solution should just be to mimic the `filesA` input in the guide

```yaml
  molecular_index_tags:
    type: string[]
    inputBinding:
      prefix: "--molecular-index-tags"

```
