我已经开始完成snakemake教程,并且从那里开始的第一个工作流程不起作用。这是我使用的规则:
rule make_a_copy:
input:
"a.txt"
output:
"a_copy.txt"
shell:
"""
copy {input} {output}
"""
然后我使用以下方法运行工作流程
snakemake -p a_copy.txt
这将产生以下输出:
Building DAG of jobs...
Provided cores: 1
Rules claiming more threads will be scaled down.
Job counts:
count jobs
1 convert_to_upper_case
1
[Thu Nov 21 15:33:18 2019]
rule convert_to_upper_case:
input: a.txt
output: a_copy.txt
jobid: 0
copy a.txt a_copy.txt
Waiting at most 5 seconds for missing files.
MissingOutputException in line 1 of D:\OneDrive\projects\reproducible_research_course\snakemake\Snakefile:
Missing files after 5 seconds:
a_copy.txt
This might be due to filesystem latency. If that is the case, consider to increase the wait time with --latency-wait.
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Complete log: D:\OneDrive\projects\reproducible_research_course\snakemake\.snakemake\log\2019-11-21T153318.425144.snakemake.log
如果我在cmd中运行copy a.txt a_copy.txt
(我在Windows上),该命令的确会生成一个a.upper.txt
文件。
我想念什么?
答案 0 :(得分:4)
由于@ the-unfun-cat和@Colin的评论,我发现了问题所在。仅执行shell命令字符串的第一行。因此,这些将起作用:
shell:
"copy a.txt a_copy.txt"
shell:
" copy a.txt a_copy.txt "
shell:
"""copy a.txt a_copy.txt"""
但是
shell:
"""
copy a.txt a_copy.txt
"""
等效于
shell:
"\n copy a.txt a_copy.txt"
将不起作用,因为仅执行第一行(为空)。
Here是个比特桶问题,在2013年讨论了这个问题。snakemake的作者建议使用run
代替shell
:
rule:
...
run:
shell(" & ".join(xx))
这当然使代码不可移植,但他认为shell命令无论如何都不可移植。