generated from snakemake-workflows/snakemake-workflow-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Snakefile
54 lines (44 loc) · 1.63 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
include: "rules/common.smk"
module dna_seq_varlociraptor:
snakefile:
github(
"snakemake-workflows/dna-seq-varlociraptor",
path="workflow/Snakefile",
tag="v5.8.1",
)
config:
config
use rule * from dna_seq_varlociraptor
report: "report/workflow.rst"
# Remove loh-events in case no normal sample is present
if "normal" not in dna_seq_varlociraptor.samples["alias"].unique():
list_keys = list(
dna_seq_varlociraptor.config["calling"]["fdr-control"]["events"].keys()
)
for k in list_keys:
if k.startswith("loh"):
dna_seq_varlociraptor.config["calling"]["fdr-control"]["events"].pop(k)
else:
tissue_counts = dna_seq_varlociraptor.samples.groupby("alias").size()
if tissue_counts["normal"] != tissue_counts["tumor"]:
raise WorkflowError(
"Invalid definition of tumor and normal samples in sample sheet. Only tumor/normal or tumor only groups are allowed at once."
)
if not "ffpe" in dna_seq_varlociraptor.samples.columns:
dna_seq_varlociraptor.samples["ffpe"] = 0
elif (
dna_seq_varlociraptor.samples.loc[
dna_seq_varlociraptor.samples["alias"] == "normal", "ffpe"
]
== 1
).any():
raise WorkflowError(
"Invalid value for ffpe column in sample sheet. ffpe treated normal samples are not supported."
)
for sample, events in zip(
["normal", "tumor"],
["germline,loh,loh_or_amplification", "somatic_tumor_low,somatic_tumor_high"],
):
dna_seq_varlociraptor.samples.loc[
dna_seq_varlociraptor.samples["alias"] == sample, "mutational_burden_events"
] = events