Skip to content

Commit a7ba5cc

Browse files
committed
replace report folder variables with pathvars
1 parent 660af2f commit a7ba5cc

4 files changed

Lines changed: 79 additions & 83 deletions

File tree

workflow/core.smk

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
include: "rules/common.smk"
22

3-
# Report
4-
REPORT_DIR_PLOTS = Path("<results>/<dataset>/report/plots")
5-
REPORT_DIR_TABLES = Path("<results>/<dataset>/report/tables")
6-
73
include: "rules/fetch.smk"
84
include: "rules/fasta.smk"
95
include: "rules/asr.smk"

workflow/rules/distances.smk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ rule allele_freq_tree_data:
6060
input:
6161
dist = "<results>/<dataset>/distances.csv",
6262
output:
63-
tree = REPORT_DIR_TABLES/"allele_freq_tree.nwk",
63+
tree = "<results>/<dataset>/report/tables/allele_freq_tree.nwk",
6464
log:
6565
"<logs>/<dataset>/allele_freq_tree_data/log.txt"
6666
script:
@@ -73,11 +73,11 @@ rule time_signal_data:
7373
outgroup_id = config["ALIGNMENT_REFERENCE"],
7474
confidence_interval = 0.95,
7575
input:
76-
tree = report(REPORT_DIR_TABLES/"allele_freq_tree.nwk"),
76+
tree = report("<results>/<dataset>/report/tables/allele_freq_tree.nwk"),
7777
metadata = config["METADATA"],
7878
output:
79-
table = report(REPORT_DIR_TABLES/"time_signal.csv"),
80-
json = REPORT_DIR_TABLES/"time_signal.json",
79+
table = report("<results>/<dataset>/report/tables/time_signal.csv"),
80+
json = "<results>/<dataset>/report/tables/time_signal.json",
8181
log:
8282
"<logs>/<dataset>/time_signal_data/log.txt"
8383
script:

workflow/rules/report.smk

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ rule demix_plot_data:
44
summary_demixing = "<results>/<dataset>/demixing/summary.csv",
55
metadata = config["METADATA"]
66
output:
7-
data = REPORT_DIR_TABLES/"demix.csv"
7+
data = "<results>/<dataset>/report/tables/demix.csv"
88
log:
99
"<logs>/<dataset>/demix_plot_data/log.txt"
1010
script:
@@ -18,9 +18,9 @@ rule demix_plot:
1818
plot_width_mm = 159.2,
1919
plot_height_mm = 119.4,
2020
input:
21-
data = REPORT_DIR_TABLES/"demix.csv"
21+
data = "<results>/<dataset>/report/tables/demix.csv"
2222
output:
23-
plot = report(REPORT_DIR_PLOTS/"demix.png")
23+
plot = report("<results>/<dataset>/report/plots/demix.png")
2424
log:
2525
"<logs>/<dataset>/demix_plot/log.txt"
2626
script:
@@ -38,8 +38,8 @@ rule diversity_data:
3838
study_fasta = "<results>/<dataset>/aligned.masked.fasta",
3939
context_fasta = "<results>/<dataset>/context/nextalign/context_sequences.aligned.masked.fasta",
4040
output:
41-
divs = REPORT_DIR_TABLES/"diversity.txt",
42-
json = REPORT_DIR_TABLES/"diversity.json",
41+
divs = "<results>/<dataset>/report/tables/diversity.txt",
42+
json = "<results>/<dataset>/report/tables/diversity.json",
4343
log:
4444
"<logs>/<dataset>/diversity_data/log.txt"
4545
script:
@@ -54,10 +54,10 @@ rule diversity_plot:
5454
plot_width_mm = 159.2,
5555
plot_height_mm = 119.4,
5656
input:
57-
divs = REPORT_DIR_TABLES/"diversity.txt",
58-
json = REPORT_DIR_TABLES/"diversity.json",
57+
divs = "<results>/<dataset>/report/tables/diversity.txt",
58+
json = "<results>/<dataset>/report/tables/diversity.json",
5959
output:
60-
plot = report(REPORT_DIR_PLOTS/"diversity.png"),
60+
plot = report("<results>/<dataset>/report/plots/diversity.png"),
6161
log:
6262
"<logs>/<dataset>/diversity_plot/log.txt"
6363
script:
@@ -71,7 +71,7 @@ rule extract_genbank_regions:
7171
input:
7272
gb = "<results>/<dataset>/reference.cds.gb",
7373
output:
74-
regions = temp(REPORT_DIR_TABLES/"genbank_regions.json"),
74+
regions = temp("<results>/<dataset>/report/tables/genbank_regions.json"),
7575
log:
7676
"<logs>/<dataset>/extract_genbank_regions/log.txt"
7777
script:
@@ -85,9 +85,9 @@ rule polymorphic_sites_over_time_plot:
8585
plot_width_mm = 159.2,
8686
plot_height_mm = 119.4,
8787
input:
88-
table = REPORT_DIR_PLOTS/"polymorphic_sites_over_time.csv",
88+
table = "<results>/<dataset>/report/tables/polymorphic_sites_over_time.csv",
8989
output:
90-
plot = report(REPORT_DIR_PLOTS/"polymorphic_sites_over_time.png"),
90+
plot = report("<results>/<dataset>/report/plots/polymorphic_sites_over_time.png"),
9191
log:
9292
"<logs>/<dataset>/polymorphic_sites_over_time_plot/log.txt"
9393
script:
@@ -102,12 +102,12 @@ rule nv_panel_plot:
102102
plot_height_mm = 250.0,
103103
plot_width_mm = 240.0,
104104
input:
105-
panel = REPORT_DIR_TABLES/"nv_panel.csv",
106-
window = REPORT_DIR_TABLES/"window.csv",
107-
regions = REPORT_DIR_TABLES/"genbank_regions.json",
105+
panel = "<results>/<dataset>/report/tables/nv_panel.csv",
106+
window = "<results>/<dataset>/report/tables/window.csv",
107+
regions = "<results>/<dataset>/report/tables/genbank_regions.json",
108108
highlight_window_regions = config["PLOT_GENOME_REGIONS"],
109109
output:
110-
plot = report(REPORT_DIR_PLOTS/"nv_panel.png"),
110+
plot = report("<results>/<dataset>/report/plots/nv_panel.png"),
111111
log:
112112
"<logs>/<dataset>/nv_panel_plot/log.txt"
113113
script:
@@ -116,23 +116,23 @@ rule nv_panel_plot:
116116

117117
use rule nv_panel_plot as nv_panel_plot_S with:
118118
input:
119-
panel = REPORT_DIR_TABLES/"nv_panel.S.csv",
120-
window = REPORT_DIR_TABLES/"window.S.csv",
121-
regions = REPORT_DIR_TABLES/"genbank_regions.json",
119+
panel = "<results>/<dataset>/report/tables/nv_panel.S.csv",
120+
window = "<results>/<dataset>/report/tables/window.S.csv",
121+
regions = "<results>/<dataset>/report/tables/genbank_regions.json",
122122
highlight_window_regions = "<results>/<dataset>/empty.txt",
123123
output:
124-
plot = report(REPORT_DIR_PLOTS/"nv_panel.S.png"),
124+
plot = report("<results>/<dataset>/report/plots/nv_panel.S.png"),
125125
log:
126126
"<logs>/<dataset>/nv_panel_plot_S/log.txt"
127127

128128

129129
rule merge_json_files:
130130
input:
131-
REPORT_DIR_TABLES/"nv_panel.json",
132-
REPORT_DIR_TABLES/"polymorphic_sites_over_time.json",
133-
REPORT_DIR_TABLES/"window.json",
131+
"<results>/<dataset>/report/tables/nv_panel.json",
132+
"<results>/<dataset>/report/tables/polymorphic_sites_over_time.json",
133+
"<results>/<dataset>/report/tables/window.json",
134134
output:
135-
json = REPORT_DIR_TABLES/"nv_panel_summary.json",
135+
json = "<results>/<dataset>/report/tables/nv_panel_summary.json",
136136
run:
137137
import json
138138
result = {}
@@ -155,8 +155,8 @@ rule context_phylogeny_data:
155155
target_fasta = "<results>/<dataset>/sequences.fasta",
156156
tree = "<results>/<dataset>/tree_context/context.treefile",
157157
output:
158-
json = REPORT_DIR_TABLES/"context_phylogeny.json",
159-
annotation = REPORT_DIR_TABLES/"context_phylogeny.csv",
158+
json = "<results>/<dataset>/report/tables/context_phylogeny.json",
159+
annotation = "<results>/<dataset>/report/tables/context_phylogeny.csv",
160160
log:
161161
"<logs>/<dataset>/context_phylogeny_data/log.txt"
162162
script:
@@ -173,10 +173,10 @@ rule context_phylogeny_plot:
173173
alrt_th = config["SHALRT"]["THRESHOLD"],
174174
input:
175175
tree = "<results>/<dataset>/tree_context/context.treefile",
176-
json = REPORT_DIR_TABLES/"context_phylogeny.json",
177-
annotation = REPORT_DIR_TABLES/"context_phylogeny.csv"
176+
json = "<results>/<dataset>/report/tables/context_phylogeny.json",
177+
annotation = "<results>/<dataset>/report/tables/context_phylogeny.csv"
178178
output:
179-
plot = report(REPORT_DIR_PLOTS/"context_phylogeny.png"),
179+
plot = report("<results>/<dataset>/report/plots/context_phylogeny.png"),
180180
log:
181181
"<logs>/<dataset>/context_phylogeny_plot/log.txt"
182182
script:
@@ -191,11 +191,11 @@ rule allele_freq_tree_plot:
191191
plot_height_mm = 119.4,
192192
plot_width_mm = 159.2,
193193
input:
194-
tree = report(REPORT_DIR_TABLES/"allele_freq_tree.nwk"),
194+
tree = report("<results>/<dataset>/report/tables/allele_freq_tree.nwk"),
195195
study_fasta = "<results>/<dataset>/sequences.fasta",
196196
metadata = config["METADATA"],
197197
output:
198-
plot = report(REPORT_DIR_PLOTS/"allele_freq_tree.png"),
198+
plot = report("<results>/<dataset>/report/plots/allele_freq_tree.png"),
199199
log:
200200
"<logs>/<dataset>/allele_freq_tree_plot/log.txt"
201201
script:
@@ -209,9 +209,9 @@ rule time_signal_plot:
209209
plot_height_mm = 119.4,
210210
plot_width_mm = 159.2,
211211
input:
212-
table = report(REPORT_DIR_TABLES/"time_signal.csv"),
212+
table = report("<results>/<dataset>/report/tables/time_signal.csv"),
213213
output:
214-
plot = report(REPORT_DIR_PLOTS/"time_signal.png"),
214+
plot = report("<results>/<dataset>/report/plots/time_signal.png"),
215215
log:
216216
"<logs>/<dataset>/time_signal_plot/log.txt"
217217
script:
@@ -227,8 +227,8 @@ rule dnds_plots:
227227
input:
228228
table = "<results>/<dataset>/dnds.csv",
229229
output:
230-
plot_dn_ds = report(REPORT_DIR_PLOTS/"dn_and_ds.png"),
231-
plot_omega = report(REPORT_DIR_PLOTS/"dnds.png"),
230+
plot_dn_ds = report("<results>/<dataset>/report/plots/dn_and_ds.png"),
231+
plot_omega = report("<results>/<dataset>/report/plots/dnds.png"),
232232
log:
233233
"<logs>/<dataset>/evo_plots/log.txt"
234234
script:
@@ -242,9 +242,9 @@ rule af_time_correlation_plot:
242242
plot_height_mm = 119.4,
243243
plot_width_mm = 159.2,
244244
input:
245-
correlations = REPORT_DIR_TABLES/"af_time_correlation.csv",
245+
correlations = "<results>/<dataset>/report/tables/af_time_correlation.csv",
246246
output:
247-
plot = report(REPORT_DIR_PLOTS/"af_time_correlation.png"),
247+
plot = report("<results>/<dataset>/report/plots/af_time_correlation.png"),
248248
log:
249249
"<logs>/<dataset>/af_time_correlation_plot/log.txt"
250250
script:
@@ -260,10 +260,10 @@ rule af_trajectory_panel_plot:
260260
plot_width_mm = 159.2,
261261
random_color_seed = 7291,
262262
input:
263-
fmt_variants = REPORT_DIR_TABLES/"variants.filled.dated.tsv",
264-
subset = REPORT_DIR_TABLES/"af_time_correlation.subset.txt"
263+
fmt_variants = "<results>/<dataset>/report/tables/variants.filled.dated.tsv",
264+
subset = "<results>/<dataset>/report/tables/af_time_correlation.subset.txt"
265265
output:
266-
plot = report(REPORT_DIR_PLOTS/"af_trajectory_panel.png"),
266+
plot = report("<results>/<dataset>/report/plots/af_trajectory_panel.png"),
267267
log:
268268
"<logs>/<dataset>/af_trajectory_panel_plot/log.txt"
269269
script:
@@ -276,7 +276,7 @@ rule summary_table:
276276
report = report("<results>/<dataset>/lineage_report.csv"),
277277
metadata = config["METADATA"]
278278
output:
279-
table = REPORT_DIR_TABLES/"summary_table.csv"
279+
table = "<results>/<dataset>/report/tables/summary_table.csv"
280280
log:
281281
"<logs>/<dataset>/summary_table/log.txt"
282282
script:
@@ -289,25 +289,25 @@ rule report:
289289
input:
290290
qmd = Path(config["REPORT_QMD"]).resolve(),
291291
css = Path(config["REPORT_CSS"]).resolve(),
292-
demix = report(REPORT_DIR_PLOTS/"demix.png"),
293-
tree_ml = report(REPORT_DIR_PLOTS/"context_phylogeny.png"),
294-
diversity = report(REPORT_DIR_PLOTS/"diversity.png"),
295-
fig_cor = report(REPORT_DIR_PLOTS/"polymorphic_sites_over_time.png"),
296-
SNV = report(REPORT_DIR_PLOTS/"nv_panel.png"),
297-
SNV_spike = report(REPORT_DIR_PLOTS/"nv_panel.S.png"),
298-
volcano = report(REPORT_DIR_PLOTS/"af_time_correlation.png"),
299-
panel = report(REPORT_DIR_PLOTS/"af_trajectory_panel.png"),
300-
tree = report(REPORT_DIR_PLOTS/"allele_freq_tree.png"),
301-
temest = report(REPORT_DIR_PLOTS/"time_signal.png"),
302-
evo = report(REPORT_DIR_PLOTS/"dn_and_ds.png"),
303-
omega_plot = report(REPORT_DIR_PLOTS/"dnds.png"),
304-
heat_table = report(REPORT_DIR_TABLES/"pairwise_trajectory_correlation_matrix.csv"),
292+
demix = report("<results>/<dataset>/report/plots/demix.png"),
293+
tree_ml = report("<results>/<dataset>/report/plots/context_phylogeny.png"),
294+
diversity = report("<results>/<dataset>/report/plots/diversity.png"),
295+
fig_cor = report("<results>/<dataset>/report/plots/polymorphic_sites_over_time.png"),
296+
SNV = report("<results>/<dataset>/report/plots/nv_panel.png"),
297+
SNV_spike = report("<results>/<dataset>/report/plots/nv_panel.S.png"),
298+
volcano = report("<results>/<dataset>/report/plots/af_time_correlation.png"),
299+
panel = report("<results>/<dataset>/report/plots/af_trajectory_panel.png"),
300+
tree = report("<results>/<dataset>/report/plots/allele_freq_tree.png"),
301+
temest = report("<results>/<dataset>/report/plots/time_signal.png"),
302+
evo = report("<results>/<dataset>/report/plots/dn_and_ds.png"),
303+
omega_plot = report("<results>/<dataset>/report/plots/dnds.png"),
304+
heat_table = report("<results>/<dataset>/report/tables/pairwise_trajectory_correlation_matrix.csv"),
305305
freyja_ts = "<results>/<dataset>/demixing/freyja_data/last_barcode_update.txt",
306-
value = REPORT_DIR_TABLES/"diversity.json",
307-
stats_lm = REPORT_DIR_TABLES/"time_signal.json",
308-
stats_ml = REPORT_DIR_TABLES/"context_phylogeny.json",
309-
table = REPORT_DIR_TABLES/"summary_table.csv",
310-
sum_nv = REPORT_DIR_TABLES/"nv_panel_summary.json",
306+
value = "<results>/<dataset>/report/tables/diversity.json",
307+
stats_lm = "<results>/<dataset>/report/tables/time_signal.json",
308+
stats_ml = "<results>/<dataset>/report/tables/context_phylogeny.json",
309+
table = "<results>/<dataset>/report/tables/summary_table.csv",
310+
sum_nv = "<results>/<dataset>/report/tables/nv_panel_summary.json",
311311
params:
312312
workflow_version = get_repo_version(Path(workflow.basedir).parent, __version__),
313313
min_ivar_freq = config["VC"]["MIN_FREQ"],

workflow/rules/vaf.smk

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ rule window_data:
233233
variants="<results>/<dataset>/variants.tsv",
234234
gb="<results>/<dataset>/reference.gb",
235235
output:
236-
window_df=REPORT_DIR_TABLES / "window.csv",
237-
json=temp(REPORT_DIR_TABLES / "window.json"),
236+
window_df="<results>/<dataset>/report/tables/window.csv",
237+
json=temp("<results>/<dataset>/report/tables/window.json"),
238238
log:
239239
"<logs>/<dataset>/window_data/log.txt",
240240
script:
@@ -248,8 +248,8 @@ rule nv_panel_data:
248248
variants="<results>/<dataset>/variants.tsv",
249249
metadata=config["METADATA"],
250250
output:
251-
table=REPORT_DIR_TABLES / "nv_panel.csv",
252-
json=temp(REPORT_DIR_TABLES / "nv_panel.json"),
251+
table="<results>/<dataset>/report/tables/nv_panel.csv",
252+
json=temp("<results>/<dataset>/report/tables/nv_panel.json"),
253253
log:
254254
"<logs>/<dataset>/nv_panel_data/log.txt",
255255
script:
@@ -258,10 +258,10 @@ rule nv_panel_data:
258258

259259
rule nv_panel_zoom_on_feature_data:
260260
input:
261-
table=REPORT_DIR_TABLES / "nv_panel.csv",
262-
regions=REPORT_DIR_TABLES / "genbank_regions.json",
261+
table="<results>/<dataset>/report/tables/nv_panel.csv",
262+
regions="<results>/<dataset>/report/tables/genbank_regions.json",
263263
output:
264-
table=temp(REPORT_DIR_TABLES / "nv_panel.{region_name}.csv"),
264+
table=temp("<results>/<dataset>/report/tables/nv_panel.{region_name}.csv"),
265265
log:
266266
"<logs>/<dataset>/nv_panel_zoom_on_feature_data/{region_name}.log.txt",
267267
script:
@@ -270,10 +270,10 @@ rule nv_panel_zoom_on_feature_data:
270270

271271
rule window_zoom_on_feature_data:
272272
input:
273-
table=REPORT_DIR_TABLES / "window.csv",
274-
regions=REPORT_DIR_TABLES / "genbank_regions.json",
273+
table="<results>/<dataset>/report/tables/window.csv",
274+
regions="<results>/<dataset>/report/tables/genbank_regions.json",
275275
output:
276-
table=temp(REPORT_DIR_TABLES / "window.{region_name}.csv"),
276+
table=temp("<results>/<dataset>/report/tables/window.{region_name}.csv"),
277277
log:
278278
"<logs>/<dataset>/window_zoom_on_feature_data/{region_name}.log.txt",
279279
script:
@@ -293,9 +293,9 @@ rule af_time_correlation_data:
293293
variants="<results>/<dataset>/variants.all_sites.tsv",
294294
metadata=config["METADATA"],
295295
output:
296-
fmt_variants=temp(REPORT_DIR_TABLES / "variants.filled.dated.tsv"),
297-
correlations=report(REPORT_DIR_TABLES / "af_time_correlation.csv"),
298-
subset=REPORT_DIR_TABLES / "af_time_correlation.subset.txt",
296+
fmt_variants=temp("<results>/<dataset>/report/tables/variants.filled.dated.tsv"),
297+
correlations=report("<results>/<dataset>/report/tables/af_time_correlation.csv"),
298+
subset="<results>/<dataset>/report/tables/af_time_correlation.subset.txt",
299299
log:
300300
"<logs>/<dataset>/af_time_correlation_data/log.txt",
301301
script:
@@ -312,8 +312,8 @@ rule pairwise_trajectory_correlation_data:
312312
variants="<results>/<dataset>/variants.all_sites.tsv",
313313
metadata=config["METADATA"],
314314
output:
315-
table=REPORT_DIR_TABLES / "pairwise_trajectory_frequency_data.csv",
316-
matrix=report(REPORT_DIR_TABLES / "pairwise_trajectory_correlation_matrix.csv"),
315+
table="<results>/<dataset>/report/tables/pairwise_trajectory_frequency_data.csv",
316+
matrix=report("<results>/<dataset>/report/tables/pairwise_trajectory_correlation_matrix.csv"),
317317
log:
318318
"<logs>/<dataset>/pairwise_trajectory_correlation_data/log.txt",
319319
script:
@@ -329,8 +329,8 @@ rule polymorphic_sites_over_time_data:
329329
variants="<results>/<dataset>/variants.tsv",
330330
metadata=config["METADATA"],
331331
output:
332-
table=REPORT_DIR_PLOTS / "polymorphic_sites_over_time.csv",
333-
json=temp(REPORT_DIR_TABLES / "polymorphic_sites_over_time.json"),
332+
table="<results>/<dataset>/report/tables/polymorphic_sites_over_time.csv",
333+
json=temp("<results>/<dataset>/report/tables/polymorphic_sites_over_time.json"),
334334
log:
335335
"<logs>/<dataset>/polymorphic_sites_over_time_data/log.txt",
336336
script:

0 commit comments

Comments
 (0)