-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsummarize.Snakefile
More file actions
45 lines (31 loc) · 1.36 KB
/
summarize.Snakefile
File metadata and controls
45 lines (31 loc) · 1.36 KB
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
import pandas as pd
import glob
## --------------------------------------------------------------------------------
## global parameters from config file
PREFIX=config["prefix"] ## output prefix
TARGETS_PRIORITY=config["targets_priority"] ## list of priority genera
## --------------------------------------------------------------------------------
## helpers
unit_df = pd.read_table(config["units"], comment="#").set_index(["sampleId"], drop=False)
SAMPLES = unit_df.index.unique()
## --------------------------------------------------------------------------------
## targets
rule all:
input:
"tables/" + PREFIX + ".summary.tsv.gz",
"tables/" + PREFIX + ".targets_priority.summary.tsv.gz",
"plots/targets_priority/" + PREFIX + ".targets_priority.pdf",
## --------------------------------------------------------------------------------
## rules
rule summary_all:
input:
tsv=expand("tables/{sample}/" + PREFIX + ".summary.tsv.gz", sample = SAMPLES),
stamp=expand("stages/{sample}.summary.done", sample = SAMPLES),
output:
"plots/targets_priority/" + PREFIX + ".targets_priority.pdf",
"tables/" + PREFIX + ".summary.tsv.gz",
"tables/" + PREFIX + ".targets_priority.summary.tsv.gz"
shell:
"""
Rscript src/summaryAll.R {PREFIX} {TARGETS_PRIORITY} {input.tsv}
"""