Skip to content

Commit 52214b7

Browse files
committed
Update formatting of report rules
Remove unnecessary path resolution and hardcode file names to improve extensibility
1 parent 77ee69e commit 52214b7

File tree

1 file changed

+45
-45
lines changed

1 file changed

+45
-45
lines changed

workflow/rules/report.smk

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ rule heatmap:
44
vcf = OUTDIR/f"{OUTPUT_NAME}.masked.filtered.tsv",
55
metadata = config["METADATA"]
66
output:
7-
table = report((REPORT_DIR_TABLES/"figure_10.csv").resolve())
7+
table = report(REPORT_DIR_TABLES/"figure_10.csv")
88
log:
99
LOGDIR / "heatmap" / "log.txt"
1010
script:
@@ -19,7 +19,7 @@ rule window:
1919
input:
2020
vcf = OUTDIR/f"{OUTPUT_NAME}.masked.filtered.tsv",
2121
gb = OUTDIR/"reference.gb",
22-
features = Path(config["FEATURES_JSON"]).resolve()
22+
features = config["FEATURES_JSON"]
2323
output:
2424
window_df = temp(OUTDIR/f"{OUTPUT_NAME}.window.csv"),
2525
log:
@@ -40,9 +40,9 @@ rule diversity:
4040
study_fasta = OUTDIR/"nextalign"/f"{OUTPUT_NAME}.aligned.masked.fasta",
4141
context_fasta = OUTDIR/"context"/"nextalign"/"context_sequences.aligned.masked.fasta"
4242
output:
43-
fig = report((REPORT_DIR_PLOTS/"figure_3.png").resolve()),
44-
json = temp((OUTDIR/"diversity.json").resolve()),
45-
table = (REPORT_DIR_TABLES/"figure_3.csv").resolve()
43+
fig = report(REPORT_DIR_PLOTS/"figure_3.png"),
44+
json = temp(OUTDIR/"diversity.json"),
45+
table = REPORT_DIR_TABLES/"figure_3.csv"
4646
log:
4747
LOGDIR / "diversity" / "log.txt"
4848
script:
@@ -57,8 +57,8 @@ rule freyja_plot:
5757
summary_demixing = OUTDIR/"summary_freyja_demixing.csv",
5858
metadata = config["METADATA"]
5959
output:
60-
fig = report((REPORT_DIR_PLOTS/"figure_1.png").resolve()),
61-
table = report((REPORT_DIR_TABLES/"figure_1.csv").resolve())
60+
fig = report(REPORT_DIR_PLOTS/"figure_1.png"),
61+
table = report(REPORT_DIR_TABLES/"figure_1.csv")
6262
log:
6363
LOGDIR / "freyja_plot" / "log.txt"
6464
script:
@@ -79,13 +79,13 @@ rule general_NV_description:
7979
vcf = OUTDIR/f"{OUTPUT_NAME}.masked.filtered.tsv",
8080
metadata = config["METADATA"]
8181
output:
82-
fig = report((REPORT_DIR_PLOTS/"figure_5a.png").resolve()),
83-
fig_s = report((REPORT_DIR_PLOTS/"figure_5b.png").resolve()),
84-
fig_cor = report((REPORT_DIR_PLOTS/"figure_4.png").resolve()),
85-
json = temp((OUTDIR/"summary_nv.json").resolve()),
86-
table_1 = report((REPORT_DIR_TABLES/"figure_5a.csv").resolve()),
87-
table_2 = report((REPORT_DIR_TABLES/"figure_5b.csv").resolve()),
88-
table_3 = report((REPORT_DIR_TABLES/"figure_4.csv").resolve())
82+
fig = report(REPORT_DIR_PLOTS/"figure_5a.png"),
83+
fig_s = report(REPORT_DIR_PLOTS/"figure_5b.png"),
84+
fig_cor = report(REPORT_DIR_PLOTS/"figure_4.png"),
85+
json = temp(OUTDIR/"summary_nv.json"),
86+
table_1 = report(REPORT_DIR_TABLES/"figure_5a.csv"),
87+
table_2 = report(REPORT_DIR_TABLES/"figure_5b.csv"),
88+
table_3 = report(REPORT_DIR_TABLES/"figure_4.csv")
8989
log:
9090
LOGDIR / "general_NV_description" / "log.txt"
9191
script:
@@ -108,11 +108,11 @@ rule phylo_plots:
108108
ml = OUTDIR/f"tree_context/{OUTPUT_NAME}.treefile",
109109
metadata = config["METADATA"]
110110
output:
111-
temest = report((REPORT_DIR_PLOTS/"figure_9.png").resolve()),
112-
tree = report((REPORT_DIR_PLOTS/"figure_8.png").resolve()),
113-
tree_ml = report((REPORT_DIR_PLOTS/"figure_2.png").resolve()),
114-
table = report((REPORT_DIR_TABLES/"figure_9.csv").resolve()),
115-
json = temp((OUTDIR/"stats.lm.json").resolve())
111+
temest = report(REPORT_DIR_PLOTS/"figure_9.png"),
112+
tree = report(REPORT_DIR_PLOTS/"figure_8.png"),
113+
tree_ml = report(REPORT_DIR_PLOTS/"figure_2.png"),
114+
table = report(REPORT_DIR_TABLES/"figure_9.csv"),
115+
json = temp(OUTDIR/"stats.lm.json")
116116
log:
117117
LOGDIR / "phylo_plots" / "log.txt"
118118
script:
@@ -128,9 +128,9 @@ rule evo_plots:
128128
vcf = OUTDIR/f"{OUTPUT_NAME}.masked.filtered.tsv",
129129
metadata = config["METADATA"]
130130
output:
131-
plot = report((REPORT_DIR_PLOTS/"figure_11.png").resolve()),
132-
plot_omega = report((REPORT_DIR_PLOTS/"figure_12.png").resolve()),
133-
table = report((REPORT_DIR_TABLES/"figure_11.csv").resolve())
131+
plot = report(REPORT_DIR_PLOTS/"figure_11.png"),
132+
plot_omega = report(REPORT_DIR_PLOTS/"figure_12.png"),
133+
table = report(REPORT_DIR_TABLES/"figure_11.csv")
134134
log:
135135
LOGDIR / "evo_plots" / "log.txt"
136136
script:
@@ -145,10 +145,10 @@ rule snp_plots:
145145
vcf = OUTDIR/f"{OUTPUT_NAME}.masked.filtered.tsv",
146146
metadata = config["METADATA"]
147147
output:
148-
pseudovolcano = report((REPORT_DIR_PLOTS/"figure_6.png").resolve()),
149-
snp_panel = report((REPORT_DIR_PLOTS/"figure_7.png").resolve()),
150-
table_1 = report((REPORT_DIR_TABLES/"figure_6.csv").resolve()),
151-
table_2 = report((REPORT_DIR_TABLES/"figure_7.csv").resolve())
148+
pseudovolcano = report(REPORT_DIR_PLOTS/"figure_6.png"),
149+
snp_panel = report(REPORT_DIR_PLOTS/"figure_7.png"),
150+
table_1 = report(REPORT_DIR_TABLES/"figure_6.csv"),
151+
table_2 = report(REPORT_DIR_TABLES/"figure_7.csv")
152152
log:
153153
LOGDIR / "snp_plots" / "log.txt"
154154
script:
@@ -161,7 +161,7 @@ rule summary_table:
161161
report = report(OUTDIR/f"{OUTPUT_NAME}.lineage_report.csv"),
162162
metadata = config["METADATA"]
163163
output:
164-
table = temp((OUTDIR/"summary_table.csv").resolve())
164+
table = temp(OUTDIR/"summary_table.csv")
165165
log:
166166
LOGDIR / "summary_table" / "log.txt"
167167
script:
@@ -172,24 +172,24 @@ rule report:
172172
conda: "../envs/quarto_render.yaml"
173173
shadow: "shallow"
174174
input:
175-
qmd = Path(config["REPORT_QMD"]).resolve(),
176-
diversity = report(rules.diversity.output.fig),
177-
freyja = report(rules.freyja_plot.output.fig),
178-
tree = report(rules.phylo_plots.output.tree),
179-
temest = report(rules.phylo_plots.output.temest),
180-
SNV = report(rules.general_NV_description.output.fig),
181-
SNV_spike = report(rules.general_NV_description.output.fig_s),
182-
evo = report(rules.evo_plots.output.plot),
183-
value = rules.diversity.output.json,
184-
panel = report(rules.snp_plots.output.snp_panel),
185-
volcano = report(rules.snp_plots.output.pseudovolcano),
186-
tree_ml = report(rules.phylo_plots.output.tree_ml),
187-
fig_cor = report(rules.general_NV_description.output.fig_cor),
188-
stats_lm = rules.phylo_plots.output.json,
189-
table = rules.summary_table.output.table,
190-
sum_nv = rules.general_NV_description.output.json,
191-
heat_table= rules.heatmap.output.table,
192-
omega_plot = report(rules.evo_plots.output.plot_omega)
175+
qmd = Path(config["REPORT_QMD"]).resolve(),
176+
freyja = report(REPORT_DIR_PLOTS/"figure_1.png"),
177+
tree_ml = report(REPORT_DIR_PLOTS/"figure_2.png"),
178+
diversity = report(REPORT_DIR_PLOTS/"figure_3.png"),
179+
fig_cor = report(REPORT_DIR_PLOTS/"figure_4.png"),
180+
SNV = report(REPORT_DIR_PLOTS/"figure_5a.png"),
181+
SNV_spike = report(REPORT_DIR_PLOTS/"figure_5b.png"),
182+
volcano = report(REPORT_DIR_PLOTS/"figure_6.png"),
183+
panel = report(REPORT_DIR_PLOTS/"figure_7.png"),
184+
tree = report(REPORT_DIR_PLOTS/"figure_8.png"),
185+
temest = report(REPORT_DIR_PLOTS/"figure_9.png"),
186+
heat_table = report(REPORT_DIR_TABLES/"figure_10.csv"),
187+
evo = report(REPORT_DIR_PLOTS/"figure_11.png"),
188+
omega_plot = report(REPORT_DIR_PLOTS/"figure_12.png"),
189+
value = OUTDIR/"diversity.json",
190+
stats_lm = OUTDIR/"stats.lm.json",
191+
table = OUTDIR/"summary_table.csv",
192+
sum_nv = OUTDIR/"summary_nv.json"
193193
params:
194194
workflow_version = get_repo_version(BASE_PATH.as_posix(), __version__),
195195
min_ivar_freq = config["VC"]["IVAR_FREQ"],

0 commit comments

Comments
 (0)