编辑我现在将此问题作为问题发布在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
选项一起使用。
Snakemake doesn't allow using --use-conda
with run
block,这是原因:
规则的运行块(请参阅规则)可以访问Snakefile中定义的任何规则之外的内容。因此,它必须与主要的Snakemake过程共享conda环境。因此,为了避免混淆,我们禁止conda指令与run块一起使用。建议改用脚本指令(请参阅外部脚本)。
出于同样的原因,我不能在--use-conda
块中使用run
。