I have a nextflow DSL2 workflow which uses an Rscript in one of the processes. However when running the workflow (on a HPC cluster), the .Rmd file is not found. I tried various ways of referring to the file/path.
The path to the .Rmd file is defined as a param in the config file.
params {
rscript = "./myscript.Rmd"
}
process {
withName: run_report {
conda = './env_R.yml'
}
}
Process like this:
rscript = file(params.rscript)
...
process run_report {
...
input:
...
path(rscript)
output:
...
script:
"""
Rscript -e "rmarkdown::render("$rscript")"
"""
}
I also tried this, directly referencing the .Rmd file and a variation like Rscript -e "rmarkdown::render("./myscript.Rmd")"
process run_report {
...
script:
"""
Rscript -e "rmarkdown::render("myscript.Rmd")"
"""
}
Env file
name: R_kn
channels:
- defaults
- conda-forge
dependencies:
- r-base=4.2.2
- r-rmarkdown
Could you try with absolute path to file?
1) Does it work on your local machine? 2) What is the exact error message you get? 3) Could you please share your .nextflow.log file? 4) Can you share the tree structure of your work dir? (Use the
tree
command)Hi. Thank you for the tips. The accepted answer resolved my issue. It was due to the wrong use of quotes.