如何在共享计算群集上的R中调用系统命令?

问题描述

我正在尝试从R脚本中调用系统命令。我要调用的系统命令是我作为模块加载到共享计算群集上的软件的名称(使用奇异性)。我遇到的问题是,当我使用系统命令时,该软件无法运行。

system_trial.R)只有一行:

system('STAR')

hostname[1] Rscript system_trial.R
sh: STAR: command not found
Warning message:
In system("STAR") : error in running command

当然,如果我直接从外壳中调用该软件,则该软件可以工作。

hostname[2] STAR
Usage: STAR  [options]... --genomeDir /path/to/genome/index/   --readFilesIn R1.fq R2.fq
Spliced Transcripts Alignment to a Reference (c) Alexander dobin,2009-2020
  • 如果我运行which STAR,我将得到singularity exec /apps/singularity-3/star/star-2.7.5a--0.sif STAR $@

  • system('STAR')代替system('singularity exec /apps/singularity-3/star/star-2.7.5a--0.sif STAR $@')实际上可以执行软件。

  • system('STAR')替换为system('which STAR'),返回which: no STAR in (/bin:etc...)

  • 使用system2('STAR')会得到sh: STAR: command not found

我只想使用system('STAR')。我该如何实现?

相关文章无答案:R: calling a system command

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)