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

Hello,

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


python Platypus.py <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
envDef:
  - envName: "PLATYPUS"
    envValue: "/path/to/Platypus_0.8.1"

In my platypus.cwl, I have


baseCommand: [python, $PLATYPUS/Platypus.py]

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/Platypus.py' '--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/Platypus.py': [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
1
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 Platypus.py an executable and invoke it like this:

baseCommand: [Platypus.py]

or if cwl-runner cannot find it:

baseCommand: [(absolute path)/Platypus.py]

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.

Help
Access

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