Skip to content

Commit

Permalink
make out_dir consistent with all rules as outdir
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimens committed Aug 5, 2024
1 parent fcb51b6 commit f7ee57b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
22 changes: 11 additions & 11 deletions src/harpy/snakefiles/preflight_bam.smk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ from pathlib import Path
from rich import print as rprint
from rich.panel import Panel

out_dir = config["output_directory"]
outdir = config["output_directory"]
envdir = os.getcwd() + "/.harpy_envs"
bamlist = config["inputs"]
samplenames = {Path(i).stem for i in bamlist}
Expand Down Expand Up @@ -39,7 +39,7 @@ onsuccess:
print("")
rprint(
Panel(
f"The workflow has finished successfully! Find the results in [bold]{out_dir}[/bold]",
f"The workflow has finished successfully! Find the results in [bold]{outdir}[/bold]",
title = "[bold]harpy preflight bam",
title_align = "left",
border_style = "green"
Expand Down Expand Up @@ -83,7 +83,7 @@ rule check_bam:
bam = get_alignments,
bai = get_align_index
output:
temp(out_dir + "/{sample}.log")
temp(outdir + "/{sample}.log")
container:
None
message:
Expand All @@ -93,10 +93,10 @@ rule check_bam:

rule merge_checks:
input:
collect(out_dir + "/{sample}.log", sample = samplenames)
collect(outdir + "/{sample}.log", sample = samplenames)
output:
tmp = temp(out_dir + "/filecheck.tmp"),
final = out_dir + "/filecheck.bam.tsv"
tmp = temp(outdir + "/filecheck.tmp"),
final = outdir + "/filecheck.bam.tsv"
container:
None
message:
Expand All @@ -109,9 +109,9 @@ rule merge_checks:

rule create_report:
input:
out_dir + "/filecheck.bam.tsv"
outdir + "/filecheck.bam.tsv"
output:
out_dir + "/filecheck.bam.html"
outdir + "/filecheck.bam.html"
conda:
f"{envdir}/r.yaml"
message:
Expand All @@ -122,12 +122,12 @@ rule create_report:
rule workflow_summary:
default_target: True
input:
out_dir + "/filecheck.bam.html"
outdir + "/filecheck.bam.html"
message:
"Summarizing the workflow: {output}"
run:
os.makedirs(f"{out_dir}/workflow/", exist_ok= True)
with open(out_dir + "/workflow/preflight.bam.summary", "w") as f:
os.makedirs(f"{outdir}/workflow/", exist_ok= True)
with open(outdir + "/workflow/preflight.bam.summary", "w") as f:
_ = f.write("The harpy preflight bam workflow ran using these parameters:\n\n")
_ = f.write("validations were performed with:\n")
_ = f.write(" check_bam.py sample.bam > sample.txt\n")
Expand Down
24 changes: 12 additions & 12 deletions src/harpy/snakefiles/preflight_fastq.smk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ from rich import print as rprint
from rich.panel import Panel

fqlist = config["inputs"]
out_dir = config["output_directory"]
outdir = config["output_directory"]
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}
Expand Down Expand Up @@ -39,7 +39,7 @@ onsuccess:
print("")
rprint(
Panel(
f"The workflow has finished successfully! Find the results in [bold]{out_dir}[/bold]",
f"The workflow has finished successfully! Find the results in [bold]{outdir}[/bold]",
title = "[bold]harpy preflight fastq",
title_align = "left",
border_style = "green"
Expand All @@ -63,7 +63,7 @@ rule check_forward:
input:
get_fq1
output:
temp(out_dir + "/{sample}.F.log")
temp(outdir + "/{sample}.F.log")
container:
None
message:
Expand All @@ -75,7 +75,7 @@ rule check_reverse:
input:
get_fq2
output:
temp(out_dir + "/{sample}.R.log")
temp(outdir + "/{sample}.R.log")
message:
"Processing reverse reads: {wildcards.sample}"
container:
Expand All @@ -85,10 +85,10 @@ rule check_reverse:

rule merge_checks:
input:
collect(out_dir + "/{sample}.{FR}.log", sample = samplenames, FR = ["F","R"])
collect(outdir + "/{sample}.{FR}.log", sample = samplenames, FR = ["F","R"])
output:
tmp = temp(out_dir + "/filecheck.tmp"),
final = out_dir + "/filecheck.fastq.tsv"
tmp = temp(outdir + "/filecheck.tmp"),
final = outdir + "/filecheck.fastq.tsv"
container:
None
message:
Expand All @@ -101,9 +101,9 @@ rule merge_checks:

rule create_report:
input:
out_dir + "/filecheck.fastq.tsv"
outdir + "/filecheck.fastq.tsv"
output:
out_dir + "/filecheck.fastq.html"
outdir + "/filecheck.fastq.html"
conda:
f"{envdir}/r.yaml"
message:
Expand All @@ -114,12 +114,12 @@ rule create_report:
rule workflow_summary:
default_target: True
input:
out_dir + "/filecheck.fastq.html"
outdir + "/filecheck.fastq.html"
message:
"Summarizing the workflow: {output}"
run:
os.makedirs(f"{out_dir}/workflow/", exist_ok= True)
with open(out_dir + "/workflow/preflight.fastq.summary", "w") as f:
os.makedirs(f"{outdir}/workflow/", exist_ok= True)
with open(outdir + "/workflow/preflight.fastq.summary", "w") as f:
_ = f.write("The harpy preflight fastq workflow ran using these parameters:\n\n")
_ = f.write("validations were performed with:\n")
_ = f.write(" check_fastq.py sample.fastq > sample.txt\n")
Expand Down

0 comments on commit f7ee57b

Please sign in to comment.