Workflow Error - "list indices must be integers, not str"
1
0
Entering edit mode
6.4 years ago
ttom ▴ 220

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 • 2.2k views
ADD COMMENT
0
Entering edit mode

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 REPLY
0
Entering edit mode

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 REPLY
3
Entering edit mode
6.4 years ago
ttom ▴ 220

The issue was the presence of this line

- entry: $(inputs.spladder_bams)
ADD COMMENT

Login before adding your answer.

Traffic: 1650 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6