shell()函数在运行时不使用奇点

时间:2019-07-17 15:15:58

标签: snakemake

编辑 鉴于这似乎是未知行为,我现在在Snakemake bitbucket上将此问题作为问题发布。


我正在使用带有--use-singularity选项的snakemake。

当我使用以下形式的经典规则时:

singularity: mycontainer

rule myrule:
  input:
  output:
  shell:
    "somecommand"

somecommand仅存在于奇点容器中,一切正常。

但是,当我需要在规则的运行部分中使用一些python代码时,找不到该命令。

rule myrule:
  input:
  output:
  run:
    some python code here
    shell("somecommand")

我发现的唯一解决方法是使用

shell("singularity exec mycontainer somecommand")

但这不是最佳选择。

我要么缺少某些东西(例如选项),要么这是snakemake中缺少的功能。

我想获得的是将shell()函数与--use-singularity选项一起使用。

1 个答案:

答案 0 :(得分:1)

Snakemake doesn't allow using --use-conda with run block,这就是原因:

规则的运行块(请参见规则)可以访问Snakefile中定义的任何规则之外的内容。因此,它必须与主要的Snakemake过程共享conda环境。因此,为避免混淆,我们禁止conda指令与run块一起使用。建议改用script指令(请参阅外部脚本)。

出于同样的原因,我押注--use-singularity不能用于run区块。