Question: Workflow Error - "list indices must be integers, not str"
0
gravatar for ttom
13 months ago by
ttom210
ttom210 wrote:

Not sure, what I am missing here or doing wrong here

cat spladder.cwl

cwlVersion: v1.0

class: CommandLineTool
baseCommand: [python, spladder.py]

requirements:
 - class: InitialWorkDirRequirement
   listing:
    - entry: $(inputs.spladder_outDir)
    - entry: $(inputs.spladder_bams)
      writable: true

inputs:
 spladder_gtf:
  type: File
  inputBinding:
   position: 1
   prefix: -a
 spladder_bams:
  type: File[]
  inputBinding:
   position: 2
   prefix: -b
   itemSeparator: ","
  secondaryFiles: .bai
 spladder_outDir:
  type: Directory
  inputBinding:
   position: 3
   prefix: -o
 spladder_phase2:
  type: string
  inputBinding:
   position: 4
   prefix: -T

outputs:
 spladder_out_dir1:
  type: Directory
  outputBinding:
   glob: $(inputs.spladder_outDir.basename)/spladder
 spladder_out_dir2:
   type: Directory
   outputBinding:
    glob: $(inputs.spladder_outDir.basename)

cat spladder.yml

spladder_gtf:
 class: File
 path: annotation/gencode.v19.annotation.hs37d5_chr.spladder.gtf

spladder_outDir: 
 class: Directory
 location: spladder_TEST

spladder_bams: [
  {class: File, path: sampleA.bam},
  {class: File, path: sampleB.bam}
]
spladder_phase2: y

ERROR

cwl-runner spladder.cwl spladder.yml

conda/bin/cwl-runner 1.0.20180521150620
Resolved 'spladder.cwl' to 'file:///spladder.cwl'
Got workflow error
Traceback (most recent call last):
  File "conda/lib/python2.7/site-packages/cwltool/executors.py", line 100, in run_jobs
    for r in jobiter:
  File "conda/lib/python2.7/site-packages/cwltool/command_line_tool.py", line 414, in job
    t["entry"]["writable"] = t.get("writable")
TypeError: list indices must be integers, not str
Workflow error, try again with --debug for more information:
list indices must be integers, not str

ERROR (with '--debug' option)

 cwl-runner spladder.cwl spladder.yml --debug
  conda/bin/cwl-runner 1.0.20180521150620
    Resolved 'spladder.cwl' to 'file:///spladder.cwl'
    usage: spladder.cwl [-h] --spladder_bams SPLADDER_BAMS --spladder_gtf
                        SPLADDER_GTF --spladder_outDir SPLADDER_OUTDIR
                        --spladder_phase2 SPLADDER_PHASE2
                        [job_order]
    spladder.cwl: error: argument --spladder_bams is required
cwl • 734 views
ADD COMMENTlink modified 13 months ago • written 13 months ago by ttom210

For your spladder.yml file and your cwl file you could try to make the following changes:

spladder_bams:
  type: File[]
  inputBinding:
    position: 2
    prefix: -b
  secondaryFiles: .bai

So just take off item separator, then modify your .yml file:

spladder_bams:
 - {class: File, path: sampleA.bam}
 - {class: File, path: sampleB.bam}

It looks like the python code is interpreting your list of bam files as a list of strings. In this format it should resolve to a list of indices for file path locations. I didn't post as an answer because I'm not 100% sure on this but give it a try and let me know how it goes.

ADD REPLYlink written 13 months ago by drkennetz380

Yes, I tried the changes mentioned in both the CWL and YAML files. But getting the same error.

I have given File list like below in other YAML files and they seemed to work. Also here when spladder bams is changed to type File and given just one bam as input, instead of File[], it is working

spladder_bams: [
  {class: File, path: sampleA.bam},
  {class: File, path: sampleB.bam}
]
ADD REPLYlink modified 13 months ago • written 13 months ago by ttom210
3
gravatar for ttom
13 months ago by
ttom210
ttom210 wrote:

The issue was the presence of this line

- entry: $(inputs.spladder_bams)
ADD COMMENTlink written 13 months ago by ttom210
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 790 users visited in the last hour