Snakemake:在 YAML 配置文件中指定工作目录
Snakemake: specifying a workdir in YAML config file
我在 YAML 配置文件中指定了一个工作目录以与 snakemake 一起使用,如下所示:
$> cat config.yaml
workdir: "/home/lina/test_output"
id: 1234
$> cat Snakefile
rule all:
input:
data_out = expand("cat_out/{id}_times_two.txt", id = config['id'])
rule double_print:
input:
data = expand("data/{id}.txt", id = config['id'])
output:
data_out = expand("cat_out/{id}_times_two.txt", id = config['id'])
shell:
'cat {input.data} {input.data} > {output.data_out}'
$> snakemake --configfile=config.yaml
但是,一旦我 运行 我的 snakemake 命令,输出就会在 snakefile 所在的目录中生成。我的 snakefile 能够利用我在配置文件中指定的 id
参数,因此它能够读取配置文件并至少解释 id
参数。
我应该如何修改配置文件或我的 snakemake 命令以确保输出以我指定的 workdir
结尾?
非常感谢!
您需要add workdir
to the snakefile,而不是配置。
但是你可以动态设置,所以在snakefile中,写:
workdir: config['workdir']
我在 YAML 配置文件中指定了一个工作目录以与 snakemake 一起使用,如下所示:
$> cat config.yaml
workdir: "/home/lina/test_output"
id: 1234
$> cat Snakefile
rule all:
input:
data_out = expand("cat_out/{id}_times_two.txt", id = config['id'])
rule double_print:
input:
data = expand("data/{id}.txt", id = config['id'])
output:
data_out = expand("cat_out/{id}_times_two.txt", id = config['id'])
shell:
'cat {input.data} {input.data} > {output.data_out}'
$> snakemake --configfile=config.yaml
但是,一旦我 运行 我的 snakemake 命令,输出就会在 snakefile 所在的目录中生成。我的 snakefile 能够利用我在配置文件中指定的 id
参数,因此它能够读取配置文件并至少解释 id
参数。
我应该如何修改配置文件或我的 snakemake 命令以确保输出以我指定的 workdir
结尾?
非常感谢!
您需要add workdir
to the snakefile,而不是配置。
但是你可以动态设置,所以在snakefile中,写:
workdir: config['workdir']