我正在尝试使用我在管道目录(与Snakefile相同的目录)中定义的一些包装器,而不是包装器代码库。
我已经查看了相关文档,当我使用绝对路径时,它工作得很好,但我无法获得相对路径。https://snakemake.readthedocs.io/en/latest/snakefiles/modularization.html#wrappers
例如,通过绝对路径指定,有效
wrapper:
"file:///Users/my_username/my_pipeline_dir/wrappers/wrapper_star-build/"例如,通过相对路径指定,不起作用
wrapper:
"file:/wrappers/wrapper_star-build/"这是我根据文档对相对路径格式的解释。我还尝试了以下所有方法,但都不适用于我:
"file:wrappers/wrapper_star-build/"
"file:./wrappers/wrapper_star-build/"
"wrappers/wrapper_star-build/"我使用了--directory选项,这样我就可以将流水线和输出分别组织起来。
snakemake --directory my_outdir/提前谢谢。
发布于 2020-01-25 06:44:54
显然,我们可以访问workflow.snakefile和workflow.basedir变量。https://groups.google.com/forum/#!msg/snakemake/cp9ZbGQgaic/Vtth6fcRO6cJ
workflow.basedir是snakefile所在的目录。
snake_dir = workflow.basedir
......
wrapper:
f"file:{snake_dir}/wrappers/wrapper_kallisto"发布于 2020-01-24 19:08:08
像这样的东西可以工作吗?
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
rule star_build:
...
wrapper:
f"file:{dir_path}/wrappers/wrapper_star-build/"这样,我们将路径添加到相对路径的前面。
https://stackoverflow.com/questions/59861400
复制相似问题