Handling SIGPIPE error in snakemake

后端 未结 2 606
感动是毒
感动是毒 2021-01-14 01:40

The following snakemake script:

rule all:
    input:
        \'test.done\'

rule pipe:
   output:
       \'test.done\'
   shell:
        \"\"\"
        seq 1         


        
相关标签:
2条回答
  • 2021-01-14 02:14

    Yes, Snakemake sets pipefail by default, because in most cases this is what people implicitly expect. You can always deactivate it for specific commands by prepending set +o pipefail; to the shell command.

    0 讨论(0)
  • 2021-01-14 02:20

    A somehow clunky solution is to append || true to the script. This will make the command always exit cleanly, which is not acceptable. To check whether the script actually succeded you can query the array variable ${PIPESTATUS[@]} to ensure it contains the expected exit codes:

    This script is ok:

    seq 1 10000 | head | grep 1 > test.done || true
    echo ${PIPESTATUS[@]}
    141 0 0
    

    This is not ok:

    seq 1 10000 | head | FOOBAR > test.done || true
    echo ${PIPESTATUS[@]}
    0
    
    0 讨论(0)
提交回复
热议问题