Question: cwl and resolution of enviroment variables
gravatar for thomas.e
21 months ago by
thomas.e100 wrote:


I want to make CommandLineTool to wrap the platypus variant caller. Platypus expects to invoked as:

python <arg>

In other words, by default it doesn't have a handy wrapper script. Obviously, I could write one but I thought I ought to be handle a scenario like this in CWL as follows.

In my envar-global.yml I have:

class: EnvVarRequirement
  - envName: "PLATYPUS"
    envValue: "/path/to/Platypus_0.8.1"

In my platypus.cwl, I have

baseCommand: [python, $PLATYPUS/]

However, when the command is invoked it looks the variable $PLATYPUS is not being resolved but inserted literally into the command line.

[step platyus] start
[job platyus] /stornext/HPCScratch/home/thomas.e/tmp/tmpCOMw0f$ /bin/sh \
    -c \
    'python' '$PLATYPUS/' '--bamFiles=/stornext/HPCScratch/home/thomas.e/tmp/tmpJtjVOc/stg695d99c7-792c-4f68-87da-62d472cec7c9/S1_R1.fastq.trimmed.human.sam' '--output=S1_R1.fastq.trimmed.human.vcf' '--refFile=/home/thomas.e/home/dev/Homo_sapiens.GRCh38.dna.toplevel.fa'
python: can't open file '$PLATYPUS/': [Errno 2] No such file or directory

Is the expected behaviour? Is there a correct way to handle this sort of scenario?

cwl • 668 views
ADD COMMENTlink modified 20 months ago by wolfganggerlach198150 • written 21 months ago by thomas.e100
gravatar for wolfganggerlach1981
20 months ago by
USA/Chicago/Argonne National Laboratory
wolfganggerlach198150 wrote:

This should be expected behavior. Values in baseCommand are not executed in a shell and thus environment variables not evaluated. I personally would recommend to make an executable and invoke it like this:

baseCommand: []

or if cwl-runner cannot find it:

baseCommand: [(absolute path)/]

Note: Some programming languages distinguish between ["command", "arg1"] and "command arg1". Only in the second version the command will be executed in shell and environment variables are evaluated.

ADD COMMENTlink modified 20 months ago • written 20 months ago by wolfganggerlach198150
Please log in to add an answer.


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