Update: July 26, 2019
This section of the forum is now closed; we are working on a new support model for WDL that we will share here shortly. For Cromwell-specific issues, see the Cromwell docs and post questions on Github.

Using variables that are result of unix commands

Hi! I have a task where I am naming the file according to the first line in the file i.e. the result of the command "head -1 FILENAME". I successfully passed it to my command line, but I cannot grab the file with the output:

task suppa_psi {

  File gtf
  File abund

  command {
    suppa.py psiPerIsoform -g ${gtf} -e ${abund} -o $(head -1 ${abund})
  }

  output {
    File psi_file = "$(head -1 ${abund})_isoform.psi"
  }

  runtime {
      docker:"ognjen/suppa:2.3"
  }
}

The output filename is interpreted literally, which I suppose happens because there is no shell to perform the expression.
I also tried creating a new variable in the definitions "String name = head -1 ${abund}" or "String name = $(head -1 ${abund})" and neither was parsed properly.
How can I grab this file?
Thanks!

Sign In or Register to comment.