I am trying to run an R script as a task in WDL in a docker image. Since this is my first time working with these, I am stuck in something very simple (and in the initial stage) and am hoping somebody here can point me in the right direction. Here is my dockerfile.
FROM rocker/r-base:latest
RUN Rscript ...r-docker/install_packages.R
Here is my WDL script
version 1.0
workflow Rpipe {
input {
String name
}
call PrintNameR{
input:
name = name
}
output {
File outfile = PrintNameR.output_R
}
}
task PrintNameR {
input {
String name
}
command<<<
R --no-save --args name <<Rscript
args <- commandArgs(trailingOnly = TRUE)
for (i in args){
print(i)}
Rscript
>>>
runtime {
docker: "firsttrydocker"
}
output {
File output_R = stdout()
}
}
I validated, generated an input json file - edited it to include the string I want "Smith", and ran it.
java -jar ../cromwell/womtool-77.jar validate rtry1.wdl
java -jar ..cromwell/womtool-77.jar inputs rtry1.wdl > rtry1.json
java -jar ..cromwell/cromwell-77.jar run rtry1.wdl --inputs rtry1.json
I get an output:
> args <- commandArgs(trailingOnly = TRUE)
> for (i in args){
+ print(i)}
[1] "name"
I get "name", I wanted to get "Smith" because that's what my input is.
What am I doing wrong? Clearly, it seems that I am not passing the WDL task input to the WDL task command -in the Rscript. What is the proper way to do it?