Snakemake:使用拆分命令时出错?

Snakemake: error when using split command?

当我在 Snakemake 规则的 shell 部分使用 Unix split 命令时出现错误:

rule split:
    input:
            "test_file.txt"
    output:
            directory("split_test_file")
    shell:
            '''
            mkdir {output}
            split -1 3 {input} split_
            mv split_* {output}
            '''

这是错误:

Error in rule split:
jobid: 0
output: split_test_file
shell:
    
    mkdir split_test_file
    split -1 3 test_file.txt split_
    mv split_* split_test_file
    
    (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)

我认为错误发生在 mv split_* split_test_file 行,因为当我 运行 只有前两行没有错误。我似乎无法找到为什么我不能将拆分 test_file.txt 产生的所有文件移动到输出目录中?非常感谢!

  1. split 命令中有一个拼写错误,其中 -1 需要是字母 -l
  2. 您的 mv 命令会导致错误 mv: cannot move ‘split_test_file’ to a subdirectory of itself, ‘split_test_file/split_test_file’。要移动的文件和目标目录都以相同的字符串 split_ 开头,这会导致此错误。修改其中任何一个都可以解决此问题。