繁体   English   中英

Snakemake:执行R脚本时忽略Rprofile

[英]Snakemake: Ignore Rprofile when executing an R script

我在snakemake工作流程中执行R脚本遇到了一些问题。 似乎我的个人.Rprofile被加载到R脚本中。 作业在一个奇点容器内运行,问题是我自动加载了我的R配置文件中没有安装在容器中的一些软件包。 我当然可以通过编辑我的R配置文件来解决这个问题,但是其他想要使用管道的人必须做同样的事情,这是我不喜欢的事情。 有人知道如何解决这个问题吗?

谢谢!

你会发现Rscript

$ Rscript
Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args]

--options accepted are
  --no-environ        Don't read the site and user environment files
  --no-site-file      Don't read the site-wide Rprofile
  --no-init-file      Don't read the user R profile
  --vanilla           Combine --no-save, --no-restore, --no-site-file
                        --no-init-file and --no-environ

R有一些选项来帮助你:

$ R --help

Usage: R [options] [< infile] [> outfile]
   or: R CMD command [arguments]

Start R, a system for statistical computation and graphics, with the
specified options, or invoke an R tool via the 'R CMD' interface.

Options:
  --no-environ          Don't read the site and user environment files
  --no-site-file        Don't read the site-wide Rprofile
  --no-init-file        Don't read the user R profile
  --vanilla   Combine --no-save, --no-restore, --no-site-file,
      --no-init-file and --no-environ

(为简洁起见,省略了其他选项)

正如@hrbrmstr已经建议的那样, - --vanilla是我想要使用的参数。 但是,我仍然找不到在snakemake中传递此参数的方法,同时仍然将R脚本作为脚本运行(其优点是在R环境中可以使用所有snakemake参数)。 相反,我去了源代码并编辑了script.py文件.../lib/python3.6/site-packages/snakemake/script.py

shell("Rscript {f.name}", bench_record=bench_record)

shell("Rscript --vanilla {f.name}", bench_record=bench_record)

现在可以使用。

干杯!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM