考虑以下简单的蛇文件,它尝试在run
指令中写入文件:
rule all:
input:
"test.txt"
rule make_test:
output:
filename = "test.txt"
run:
with open(output.filename) as f:
f.write("test")
运行它会产生以下结果:
Provided cores: 1
Rules claiming more threads will be scaled down.
Job counts:
count jobs
1 all
1 make_test
2
rule make_test:
output: test.txt
Error in job make_test while creating output file test.txt.
RuleException:
FileNotFoundError in line 10 of /tmp/Snakefile:
[Errno 2] No such file or directory: 'test.txt'
File "/tmp/Snakefile", line 10, in __rule_make_test
Will exit after finishing currently running jobs.
Exiting because a job execution failed. Look above for error message
我对此感到惊讶FileNotFoundError
。显然,我没有找到正确的方法告诉snakemake 这是我希望规则make_test
创建的文件。
我还尝试了对输出语法的以下修改:
rule all:
input:
"test.txt"
rule make_test:
output:
"test.txt"
run:
with open(output[0]) as f:
f.write("test")
错误是一样的。
发生了什么?