Skip to content

Commit

Permalink
mv log purging to launch script
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimens committed Sep 4, 2024
1 parent 23a214b commit 169f56a
Show file tree
Hide file tree
Showing 13 changed files with 0 additions and 90 deletions.
7 changes: 0 additions & 7 deletions harpy/snakefiles/align_bwa.smk
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,6 @@ rule workflow_summary:
unmapped = "" if keep_unmapped else "-F 4",
extra = extra
run:
import glob
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isfile(logfile) and os.path.getsize(logfile) == 0:
os.remove(logfile)
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isdir(logfile) and not os.listdir(logfile):
os.rmdir(logfile)
with open(outdir + "/workflow/align.bwa.summary", "w") as f:
_ = f.write("The harpy align bwa workflow ran using these parameters:\n\n")
_ = f.write(f"The provided genome: {genomefile}\n")
Expand Down
7 changes: 0 additions & 7 deletions harpy/snakefiles/align_ema.smk
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,6 @@ rule workflow_summary:
beadtech = "-p" if platform == "haplotag" else f"-w {barcode_list}",
unmapped = "" if keep_unmapped else "-F 4"
run:
import glob
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isfile(logfile) and os.path.getsize(logfile) == 0:
os.remove(logfile)
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isdir(logfile) and not os.listdir(logfile):
os.rmdir(logfile)
with open(outdir + "/workflow/align.ema.summary", "w") as f:
_ = f.write("The harpy align ema workflow ran using these parameters:\n\n")
_ = f.write(f"The provided genome: {bn}\n")
Expand Down
7 changes: 0 additions & 7 deletions harpy/snakefiles/align_strobealign.smk
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,6 @@ rule workflow_summary:
unmapped = "" if keep_unmapped else "-F 4",
extra = extra
run:
import glob
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isfile(logfile) and os.path.getsize(logfile) == 0:
os.remove(logfile)
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isdir(logfile) and not os.listdir(logfile):
os.rmdir(logfile)
with open(outdir + "/workflow/align.strobealign.summary", "w") as f:
_ = f.write("The harpy align strobealign workflow ran using these parameters:\n\n")
_ = f.write(f"The provided genome: {bn}\n")
Expand Down
7 changes: 0 additions & 7 deletions harpy/snakefiles/impute.smk
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,6 @@ rule workflow_summary:
agg_report = collect(outdir + "/{stitchparams}/reports/variants.imputed.html", stitchparams=paramspace.instance_patterns) if not skipreports else [],
contig_report = collect(outdir + "/{stitchparams}/reports/{part}.stitch.html", stitchparams=paramspace.instance_patterns, part = contigs) if not skipreports else [],
run:
import glob
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isfile(logfile) and os.path.getsize(logfile) == 0:
os.remove(logfile)
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isdir(logfile) and not os.listdir(logfile):
os.rmdir(logfile)
with open(outdir + "/workflow/impute.summary", "w") as f:
_ = f.write("The harpy impute workflow ran using these parameters:\n\n")
_ = f.write(f"The provided variant file: {variantfile}\n")
Expand Down
7 changes: 0 additions & 7 deletions harpy/snakefiles/phase.smk
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,6 @@ rule workflow_summary:
prune = f"--threshold {pruning}" if pruning > 0 else "--no_prune 1",
extra = extra
run:
import glob
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isfile(logfile) and os.path.getsize(logfile) == 0:
os.remove(logfile)
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isdir(logfile) and not os.listdir(logfile):
os.rmdir(logfile)
with open(outdir + "/workflow/phase.summary", "w") as f:
_ = f.write("The harpy phase workflow ran using these parameters:\n\n")
_ = f.write(f"The provided variant file: {variantfile}\n")
Expand Down
6 changes: 0 additions & 6 deletions harpy/snakefiles/preflight_fastq.smk
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ envdir = os.getcwd() + "/.harpy_envs"
bn_r = r"([_\.][12]|[_\.][FR]|[_\.]R[12](?:\_00[0-9])*)?\.((fastq|fq)(\.gz)?)$"
samplenames = {re.sub(bn_r, "", os.path.basename(i), flags = re.IGNORECASE) for i in fqlist}

onstart:
logger.logger.addHandler(logging.FileHandler(config["snakemake_log"]))
onsuccess:
os.remove(logger.logfile)
onerror:
os.remove(logger.logfile)
def get_fq1(wildcards):
# returns a list of fastq files for read 1 based on *wildcards.sample* e.g.
#samples_FR = [i for i in fqlist if wildcards.sample in i]
Expand Down
7 changes: 0 additions & 7 deletions harpy/snakefiles/qc.smk
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,6 @@ rule workflow_summary:
dedup = "-D" if dedup else "",
extra = extra
run:
import glob
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isfile(logfile) and os.path.getsize(logfile) == 0:
os.remove(logfile)
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isdir(logfile) and not os.listdir(logfile):
os.rmdir(logfile)
with open(outdir + "/workflow/qc.summary", "w") as f:
_ = f.write("The harpy qc workflow ran using these parameters:\n\n")
_ = f.write("fastp trimming ran using:\n")
Expand Down
7 changes: 0 additions & 7 deletions harpy/snakefiles/sv_leviathan.smk
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,6 @@ rule workflow_summary:
iters = f"-B {iterations}",
extra = extra
run:
import glob
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isfile(logfile) and os.path.getsize(logfile) == 0:
os.remove(logfile)
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isdir(logfile) and not os.listdir(logfile):
os.rmdir(logfile)
with open(outdir + "/workflow/sv.leviathan.summary", "w") as f:
_ = f.write("The harpy sv leviathan workflow ran using these parameters:\n\n")
_ = f.write(f"The provided genome: {bn}\n")
Expand Down
7 changes: 0 additions & 7 deletions harpy/snakefiles/sv_leviathan_pop.smk
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,6 @@ rule workflow_summary:
iters = f"-B {iterations}",
extra = extra
run:
import glob
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isfile(logfile) and os.path.getsize(logfile) == 0:
os.remove(logfile)
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isdir(logfile) and not os.listdir(logfile):
os.rmdir(logfile)
with open(outdir + "/workflow/sv.leviathan.summary", "w") as f:
_ = f.write("The harpy sv leviathan workflow ran using these parameters:\n\n")
_ = f.write(f"The provided genome: {bn}\n")
Expand Down
7 changes: 0 additions & 7 deletions harpy/snakefiles/sv_naibr.smk
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,6 @@ rule workflow_summary:
bedpe_agg = collect(outdir + "/{sv}.bedpe", sv = ["inversions", "deletions","duplications"]),
reports = collect(outdir + "/reports/{sample}.naibr.html", sample = samplenames) if not skipreports else []
run:
import glob
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isfile(logfile) and os.path.getsize(logfile) == 0:
os.remove(logfile)
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isdir(logfile) and not os.listdir(logfile):
os.rmdir(logfile)
os.system(f"rm -rf {outdir}/naibrlog")
argdict = process_args(extra)
with open(outdir + "/workflow/sv.naibr.summary", "w") as f:
Expand Down
7 changes: 0 additions & 7 deletions harpy/snakefiles/sv_naibr_phase.smk
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,6 @@ rule workflow_summary:
phaselog = outdir + "/logs/whatshap-haplotag.log",
reports = collect(outdir + "/reports/{sample}.naibr.html", sample = samplenames) if not skipreports else []
run:
import glob
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isfile(logfile) and os.path.getsize(logfile) == 0:
os.remove(logfile)
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isdir(logfile) and not os.listdir(logfile):
os.rmdir(logfile)
os.system(f"rm -rf {outdir}/naibrlog")
argdict = process_args(extra)
with open(outdir + "/workflow/sv.naibr.summary", "w") as f:
Expand Down
7 changes: 0 additions & 7 deletions harpy/snakefiles/sv_naibr_pop.smk
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,6 @@ rule workflow_summary:
reports = collect(outdir + "/reports/{pop}.naibr.html", pop = populations) if not skipreports else [],
agg_report = outdir + "/reports/naibr.pop.summary.html" if not skipreports else []
run:
import glob
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isfile(logfile) and os.path.getsize(logfile) == 0:
os.remove(logfile)
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isdir(logfile) and not os.listdir(logfile):
os.rmdir(logfile)
os.system(f"rm -rf {outdir}/naibrlog")
argdict = process_args(extra)
with open(outdir + "/workflow/sv.naibr.summary", "w") as f:
Expand Down
7 changes: 0 additions & 7 deletions harpy/snakefiles/sv_naibr_pop_phase.smk
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,6 @@ rule workflow_summary:
reports = collect(outdir + "/reports/{pop}.naibr.html", pop = populations) if not skipreports else [],
agg_report = outdir + "/reports/naibr.pop.summary.html" if not skipreports else []
run:
import glob
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isfile(logfile) and os.path.getsize(logfile) == 0:
os.remove(logfile)
for logfile in glob.glob(f"{outdir}/logs/**/*", recursive = True):
if os.path.isdir(logfile) and not os.listdir(logfile):
os.rmdir(logfile)
os.system(f"rm -rf {outdir}/naibrlog")
argdict = process_args(extra)
with open(outdir + "/workflow/sv.naibr.summary", "w") as f:
Expand Down

0 comments on commit 169f56a

Please sign in to comment.