mox*_*mox 6 docker snakemake singularity-container
让我们有一个简单的蛇文件
rule targets:
input:
"plots/dataset1.pdf",
"plots/dataset2.pdf"
rule plot:
input:
"raw/{dataset}.csv"
output:
"plots/{dataset}.pdf"
shell:
"somecommand {input} {output}"
Run Code Online (Sandbox Code Playgroud)
我想归纳出绘图规则,以便它可以在docker容器中运行,
rule targets:
input:
"plots/dataset1.pdf",
"plots/dataset2.pdf"
rule plot:
input:
"raw/{dataset}.csv"
output:
"plots/{dataset}.pdf"
singularity:
"docker://joseespinosa/docker-r-ggplot2"
shell:
"somecommand {input} {output}"
Run Code Online (Sandbox Code Playgroud)
如果我了解得很好,当我运行时,我会在docker容器中snakemake --use-singularity获得该somecommand运行,如果不对容器进行一些卷配置,则无法找到输入的csv文件。
您能否提供一个小的工作示例,说明如何在Snakefile或其他Snakemake文件中配置卷?
当您运行 Snakemake 并告诉它使用奇点图像时,您可以执行以下操作:
snakemake --use-singularity
您还可以向奇点传递其他参数,包括绑定点,如下所示:
snakemake --use-singularity --singularity-args "-B /path/outside/container/:/path/inside/container/"
现在,如果您的 csv 文件位于 中/path/outside/container/,则可以通过某些命令查看它,不会出现问题。
请记住,如果您的内部和外部路径不相同,您将需要在您的 Snakemake 规则中的不同部分使用这两个路径。我就是这样做的:
rule targets:
input:
"plots/dataset1.pdf",
"plots/dataset2.pdf"
rule plot:
input:
"raw/{dataset}.csv"
output:
"plots/{dataset}.pdf"
params:
i = "inside/container/input/{dataset}.csv",
o = "inside/container/output/{dataset}.pdf"
singularity:
"docker://joseespinosa/docker-r-ggplot2"
shell:
"somecommand {params.i} {params.o}"
Run Code Online (Sandbox Code Playgroud)
当您运行此蛇文件时,绑定raw/到inside/container/input/,并绑定plots/到inside/container/output/. Snakemake 将在本地计算机上查找输入/输出文件,但会给容器提供使用容器内部路径运行的命令,一切都会很棒。
TL;DR:输入和输出中的本地路径,params 和 shell 中的容器路径。在命令行调用中绑定本地和容器路径。
| 归档时间: |
|
| 查看次数: |
663 次 |
| 最近记录: |