This is a test version of Biostars. For the public version, visit https://www.biostars.org.
CWL NO JSON object could be decoded

I run CWL as cwl-runner bwa_index.cwl index.yml And get ERROR Message as following /Users/yifanwang/Test/CWL_work/venv_cwl/bin/cwl-runner 1.0.20181217162649 Resolved 'bwa_index.cwl' to 'file:///Users/yifanwang/Test/CWL_work/bwa_index.cwl' Workflow error, try again with --debug for more information: Expression evaluation error:

No JSON object could be decoded
  
script was:
01 "use strict";
02 var inputs = {
03     "block_size": null,
04     "algorithm": null,
05     "reference": {
06         "basename": "reference.fa",
07         "nameroot": "reference",
08         "nameext": ".fa",
09         "location": "file:///Users/yifanwang/Test/CWL_work/reference.fa",
10         "path": "/private/var/folders/1m/zpv1ttyd3klg2ywkv8c_r4z40000gn/T/tmpjboEOm/stg52a9e9c2-5261-4d37-a158-54a58addce79/reference.fa",
11         "dirname": "/private/var/folders/1m/zpv1ttyd3klg2ywkv8c_r4z40000gn/T/tmpjboEOm/stg52a9e9c2-5261-4d37-a158-54a58addce79",
12         "class": "File",
13         "size": 3249912778
14     }
15 };
16 var self = null;
17 var runtime = {
18     "outdirSize": 1024,
19     "ram": 1024,
20     "cores": 1,
21     "tmpdirSize": 1024,
22     "tmpdir": "/private/var/folders/1m/zpv1ttyd3klg2ywkv8c_r4z40000gn/T/tmp4QfOHd",
23     "outdir": "/private/tmp/docker_tmpIRpon0"
24 };
25 (function(){return ((inputs.sequences));})()
stdout was: 'undefined'
stderr was: ''
cwl json

2 answers

You reference $(inputs.sequences) in your InitialWorkDirRequirement as well as your outputBinding. "seqences" does not show up in your inputs field though. Hence the error occurs.

If i understand the workflow correctly, then it should be $(inputs.reference) / $(inputs.reference.basename).

You're welcome! Please use the checkmark-button on the left to "accept" the answer, so the thread will be marked as solved.

Script## bwa_index.cwl ##

class: CommandLineTool
cwlVersion: v1.0
$namespaces:
  sbg: 'https://www.sevenbridges.com/'
baseCommand:
  - bwa
  - index
inputs:
  - id: algorithm
    type: string?
    inputBinding:
      position: 0
      prefix: '-a'
    doc: |
      BWT construction algorithm: bwtsw or is (Default: auto)
  - id: block_size
    type: int?
    inputBinding:
      position: 0
      prefix: '-b'
    doc: >
      Block size for the bwtsw algorithm (effective with -a bwtsw) (Default:
      10000000)
  - id: reference
    type: File
    inputBinding:
      position: 1
      valueFrom: reference.fa
outputs:
  - id: output
    type: File
    outputBinding:
      glob: $(inputs.sequences.basename)
    secondaryFiles:
      - .amb
      - .ann
      - .bwt
      - .pac
      - .sa
doc: |
  Usage:   bwa index [options] <in.fasta>

  Options: -a STR    BWT construction algorithm: bwtsw or is [auto]
           -p STR    prefix of the index [same as fasta name]
           -b INT    block size for the bwtsw algorithm (effective with -a bwtsw) [10000000]
           -6        index files named as <in.fasta>.64.* instead of <in.fasta>.*

  Warning: `-a bwtsw' does not work for short genomes, while `-a is' and
           `-a div' do not work not for long genomes.
requirements:
  - class: InitialWorkDirRequirement
    listing:
      - $(inputs.sequences)
  - class: InlineJavascriptRequirement

index.yml
reference:
  class: File
  path: reference.fa

Log in to answer this question.