cnio-bu / varca

MIT License
0 stars 8 forks source link

Cleanup tmp bam files If map_reads rule fails #2

Closed SGMartin closed 1 year ago

SGMartin commented 1 year ago

This is a suggestion/enhancement, but I personally find quite annoying that, when the rule mapreads fails for whatever reason (i.e. insufficient mem), the temporary bam files (sample.bam.tmp) are not automatically removed. This causes issues down the line because bwa will try to generate the same temporary files again and again and the rule will keep crashing due to these files being already present, even If the original issue is fixed.

tdido commented 1 year ago

Maybe shadow:"shallow" like in the indexing step?

SGMartin commented 1 year ago

That might do the trick! If I have any spare time today I'll make a PR.

Quoting snakemake docs for docs purposes.

This is useful for running programs that generate lots of unused files which you don’t want to manually cleanup in your snakemake workflow. It can also be useful if you want to keep your workdir clean while the program executes, or simplify your workflow by not having to worry about unique filenames for all outputs of all rules.

By setting shadow: "shallow", the top level files and directories are symlinked, so that any relative paths in a subdirectory will be real paths in the filesystem.