-
Notifications
You must be signed in to change notification settings - Fork 0
/
Snakefile
97 lines (70 loc) · 3.13 KB
/
Snakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
from glob import glob
import re
from typing import Set
import random
from itertools import combinations
from snakemake.utils import min_version
min_version("6.0")
random.seed(42)
configfile: "vambn_config.yml"
################################################################################
# Module dependencies
################################################################################
ruleorder: modular_modular_modelling_preprocessing_setupEnv_setupR > traditional_traditional_modelling_preprocessing_setupEnv_setupR > modular_modular_modelling_preprocessing_Preprocessing > traditional_traditional_modelling_preprocessing_Preprocessing > modular_modular_modelling_preprocessing_ConcatImputedFiles > traditional_traditional_modelling_preprocessing_ConcatImputedFiles > modular_modular_modelling_preprocessing_ConcatStaloneFiles > traditional_traditional_modelling_preprocessing_ConcatStaloneFiles > modular_modular_modelling_preprocessing_ConcatRawFiles > traditional_traditional_modelling_preprocessing_ConcatRawFiles > modular_modular_modelling_preprocessing_setupEnv_initializeMlflowExperiment > traditional_traditional_modelling_preprocessing_setupEnv_initializeMlflowExperiment
module modular:
snakefile:
"snakemake_modules/modular-postprocessing.snakefile"
config:
config
module traditional:
snakefile:
"snakemake_modules/traditional-postprocessing.snakefile"
config:
config
use rule * from modular as modular_*
use rule * from traditional as traditional_*
################################################################################
# Modular Modelling
################################################################################
# Rule to generate all possible outputs
rule all:
input:
rules.modular_all.input,
rules.traditional_all.input,
expand(
"{output_dir}/metrics/{dataset}_aggregated_metrics.csv",
dataset=config["snakemake"]["DATASETS"],
output_dir=config["snakemake"]["output_dir"],
),
default_target: True
MODULES = [
"modular_concatMtl",
"modular_concatIndiv",
"modular_none",
"modular_avgMtl",
"modular_maxMtl",
"modular_sharedLinear",
"modular_encoderMtl",
"modular_encoder",
"traditional",
]
VARS = ["wogan", "wgan"] if config["snakemake"]["with_gan"] else ["wogan"]
MTLS = ["womtl", "wmtl"] if config["snakemake"]["with_mtl"] else ["womtl"]
def get_results_files(wildcards):
return [
f"{wildcards.output_dir}/metrics/{module}_{wildcards.dataset}_{var}_{mtl}/{metric_file}"
for module in MODULES
for var in VARS
for mtl in MTLS
for metric_file in ["auc_metrics.csv", "corr_metrics.json", "jsd_metrics.json"]
]
rule aggregate_data:
input:
files=get_results_files,
grouping="data/raw/grouping_{dataset}.csv",
file="vambn/visualization/generate_results_plot.py",
output:
"{output_dir}/metrics/{dataset}_aggregated_metrics.csv",
"{output_dir}/figures/{dataset}_metrics.png",
shell:
"python -m vambn.visualization.generate_results_plot {input.grouping} {input.files} {output}"