r - how to pass environment variable to snakemake markdown script
问题描述
I like the convenience of using the rmd script option in snakemake, like
script:
"scripts/report.Rmd"
But I'm having some trouble working out the best way to pass an environment variable to the script before the script is run. The problem I have is that I run this on a cluster, using PBS pro, and also use singularity to run the job.
In my case, I need to set the variable http_proxy
before I start the script, so I can't pass it into the Rmd file.
I can do it if I export the variable first and use qsub -V
option in my cluster submission section (Declares that all environment variables in the qsub command's environment are to be exported to the batch job
), but I'd like to keep the workflow as self-contained as possible, so I don't really want to export all my variables to the batch job. Ideally, I'd like to specify the proxy as a variable either in a conig.yaml file, and pass it do the Rmd script.
Looking at the code, the Rmd script part executes it like:
self._execute_cmd("Rscript --vanilla {fname:q}", fname=fname)
Any suggestions would be welcome.
解决方案
推荐阅读
- r - ColorNumeric 的“无法确定域范围”
- javascript - 在 Typescript 中以编程方式折叠引导导航栏
- android - 调用函数未捕获来自另一个类的 Flutter 错误
- docusignapi - 如何在 DocuSign 中为通过 SDK 创建的所有信封和通知设置语言?
- javascript - .Net Core 单选按钮总是返回 false
- file - 使用 Kotlin 检查文件是否存在于 Android 设备上
- powerapps - 将 powerapps 应用程序共享给多个用户
- python - 如何在不使用 iframe 的情况下结合 Dash 和 Flask 登录?
- javascript - 使用独立代码确定浏览器宽度
- c# - 保持表格可编辑,直到单击保存或取消按钮