Snakemake 访问Snakefile中的--default远程前缀

Snakemake 访问Snakefile中的--default远程前缀,snakemake,Snakemake,当我在google life sciences executor上运行snakemake时,我会运行类似于: snakemake --google-lifesciences --default-remote-prefix my_bucket_name --preemption-default 10 --use-conda 现在,my_bucket\u name将添加到所有输入和输出路径中 但出于某些原因,我需要在Snakefile代码中重新创建完整路径,因此我希望能够访问代码中传递给--默

当我在google life sciences executor上运行snakemake时,我会运行类似于:

snakemake  --google-lifesciences --default-remote-prefix my_bucket_name  --preemption-default 10 --use-conda
现在,
my_bucket\u name
将添加到所有输入和输出路径中

但出于某些原因,我需要在Snakefile代码中重新创建完整路径,因此我希望能够访问代码中传递给
--默认远程前缀
的任何内容

有办法做到这一点吗

我希望能够访问传递给的任何内容——代码中的默认远程前缀

可以使用以下对象:

print(workflow.default_remote_prefix) # Will print my_bucket_name in your example

rule all:
    input: ...
我不能100%确定
工作流
对象是否应该由用户使用,或者它是否是snakemake的私有对象,如果是这样,将来可以在没有警告的情况下更改它。但是我觉得没关系,我一直使用
workflow.basedir
来获取蛇文件所在的目录

或者,您可以解析
sys.argv
列表,但我认为这更具黑客性


另一种选择:

bucket_name=foo
snakemake --default-remote-prefix $bucket_name --config bucket_name=$bucket_name ...
然后在代码中使用
config[“bucket\u name”]
获取值
foo
。但我仍然更喜欢
工作流
解决方案