问题
I need to make a checkpoint in Snakemake at the step where chromosomes are scattered to call copy number variants with GATK:
rule all:
input:
'aggregated/chr1'
# step that gives non-zero exit code error
checkpoint scattering:
input:
interval = 'gcfiltered_{chr}.interval_list'
output:
directory('scatter_{chr}')
shell:
'mkdir -p {output} && '
'gatk --java-options "-Xmx8G" IntervalListTools '
'--INPUT {input.interval} '
'--SUBDIVISION_MODE INTERVAL_COUNT '
'--SCATTER_CONTENT 600 '
'--OUTPUT {output}'
def aggregate_scatter(wildcards):
checkpoint_output = checkpoints.scattering.get(**wildcards).output[0]
return expand('scatter_{chr}/{i}/scattered.interval_list',
chr=wildcards.chr,
i=glob_wildcards(os.path.join(checkoint_output, '{i}/scattered.interval_list')).i)
# dummy rule to check if scattered files will be aggregated:
rule aggregate:
input:
aggregate_scatter
output:
"aggregated/{chr}"
shell:
"cat {input} > {output}"
But the scattering
rule fails. It gives an error (exited with non-zero exit code)
and removes the output, although the output is produced correctly. I tried adding || true
, it did not work.
However, when I run the command outside of snakemake, it runs fine with 0 exit status:
mkdir -p scatter_chr1 && gatk --java-options "-Xmx8G" IntervalListTools --INPUT gcfiltered_chr1.interval_list --SUBDIVISION_MODE INTERVAL_COUNT --SCATTER_CONTENT 600 --OUTPUT scatter_chr1
echo $?
I use Snakemake 5.5.4 and GATK 4.1.2.0. Input file example (gcfiltered_chr1.interval_list
):
@HD VN:1.6
@SQ SN:chr1 LN:122678785 UR:file:canFam3.fa M5:e4671b339daa96b7f11eb0b68fd999d8
chr1 100000 100999 + .
chr1 101000 101999 + .
chr1 102000 102999 + .
chr1 103000 103999 + .
chr1 104000 104999 + .
chr1 105000 105999 + .
chr1 106000 106999 + .
chr1 107000 107999 + .
chr1 108000 108999 + .
chr1 109000 109999 + .
chr1 110000 110999 + .
chr1 111000 111999 + .
chr1 112000 112999 + .
chr1 113000 113999 + .
chr1 114000 114999 + .
chr1 115000 115999 + .
chr1 116000 116999 + .
chr1 117000 117999 + .
chr1 118000 118999 + .
chr1 119000 119999 + .
chr1 120000 120999 + .
来源:https://stackoverflow.com/questions/57432036/snakemake-checkpoint-exited-with-non-zero-exit-code