-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSnakefile
71 lines (55 loc) · 1.79 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
import pathlib, os, json, sys
import scripts.util as ds
from scripts.util.patterns import get_pattern_tier_daq
from scripts.util.utils import (
subst_vars_in_snakemake_config,
runcmd,
config_path,
filelist_path,
metadata_path,
)
from datetime import datetime
from collections import OrderedDict
# Set with `snakemake --configfile=/path/to/your/config.json`
# configfile: "have/to/specify/path/to/your/config.json"
check_in_cycle = True
subst_vars_in_snakemake_config(workflow, config)
setup = config["setups"]["l200_hades"]
basedir = workflow.basedir
configs = config_path(setup)
meta = metadata_path(setup)
swenv = runcmd(setup)
basedir = workflow.basedir
include: "rules/common.smk"
include: "rules/main.smk"
include: "rules/raw.smk"
include: "rules/dsp.smk"
include: "rules/hit.smk"
localrules:
gen_filelist,
autogen_output,
onstart:
print("Starting workflow")
onsuccess:
print("Workflow finished, no error")
shell("rm *.gen || true")
#shell(f"rm {filelist_path(setup)}/* || true")
# Placeholder, can email or maybe put message in slack
onerror:
print("An error occurred :( ")
checkpoint gen_filelist:
"""
This rule generates the filelist. It is a checkpoint so when it is run it will update
the dag passed on the files it finds as an output. It does this by taking in the search
pattern, using this to find all the files that match this pattern, deriving the keys from
the files found and generating the list of new files needed.
"""
output:
os.path.join(filelist_path(setup), "{label}-{tier}.filelist"),
params:
setup=lambda wildcards: setup,
search_pattern=lambda wildcards: get_pattern_tier_daq(setup),
basedir=basedir,
configs=configs,
script:
"scripts/create_filelist.py"