Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: gcnv contig wrapper scripts do not clean their output folders (#443) #468

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions snappy_wrappers/wrappers/gcnv/call_cnvs_case_mode/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
export OMP_NUM_THREADS=16
export THEANO_FLAGS="base_compiledir=$TMPDIR/theano_compile_dir"

# Force full replacement of previous results
# (this also solves issues when gatk tries to shutil copy file ownership)
if [ -d $(dirname {snakemake.output.done}) ]
then
rm -rf $(dirname {snakemake.output.done})
fi

gatk GermlineCNVCaller \
--run-mode CASE \
$(for tsv in {paths_tsv}; do echo -I $tsv; done) \
Expand Down
13 changes: 13 additions & 0 deletions snappy_wrappers/wrappers/gcnv/contig_ploidy_case_mode/wrapper.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pathlib
import sys

from snakemake.shell import shell

Expand Down Expand Up @@ -38,6 +39,12 @@

set -x

# Force full replacement of previous results
if [ -d {out_path}/ploidy_calls ]
then
rm -rf {out_path}/ploidy_calls
fi

gatk DetermineGermlineContigPloidy \
--model {snakemake.params.args[model]} \
$(for tsv in {paths_tsv}; do echo -I $tsv; done) \
Expand All @@ -51,6 +58,12 @@
path_name = sample_dir / "sample_name.txt"
with path_name.open("rt") as inputf:
sample_name = inputf.read().strip()
if sample_name not in sex_map:
msg = f"Encountered an unexpected sample {sample_name} (undefined in samplesheet)."
print(msg, file=sys.stderr) # for slurm log
with open(snakemake.log[0], "a") as log:
log.write(msg)
sys.exit(0)
sample_sex = sex_map[sample_name]
path_call = sample_dir / "contig_ploidy.tsv"
with path_call.open("rt") as inputf:
Expand Down
Loading