-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSnakefile
85 lines (77 loc) · 4 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
"""
Juno-amr
Authors: Roxanne Wolthuis, Alejandra Hernandez Segura, Maaike van den Beld
Organization: Rijksinstituut voor Volksgezondheid en Milieu (RIVM)
Department: Infektieziekteonderzoek, Diagnostiek en Laboratorium Surveillance (IDS), Bacteriologie (BPD)
Date: 30 - 03 - 2021
"""
#################################################################################
##### Imports and configuration #####
#################################################################################
import os
import yaml
#collect samples
sample_sheet = config["sample_sheet"]
SAMPLES = {}
with open(sample_sheet) as sample_sheet_file:
SAMPLES = yaml.safe_load(sample_sheet_file)
#output dir
OUT = config["output_dir"]
#includes
include: "bin/rules/runResfinderFastq.smk"
include: "bin/rules/runAmrfinderplus.smk"
include: "bin/rules/runVirulencefinder.smk"
include: "bin/rules/makeResfinderSummary.smk"
include: "bin/rules/makePointfinderSummary.smk"
include: "bin/rules/makeIlesSummary.smk"
include: "bin/rules/makeVirulencefinderSummary.smk"
include: "bin/rules/makeAmrfinderplusSummary.smk"
#TODO this rule is out of use because we only run resfinder on fastq files
#include: "bin/rules/runResfinderFasta.smk"
#################################################################################
##### Specify final output #####
#################################################################################
localrules:
all
#If the species is other, pointfinder cannot be run, so there will be no output expected of this part
# iles summary can only be created for ecoli, shigella, campylobacter and salmonella species
if config["species"] == "other":
rule all:
""" Main rule that starts the complete workflow """
input:
expand(OUT + "/summary/summary_amr_genes.csv"),
expand(OUT + "/summary/summary_amr_phenotype.csv"),
expand(OUT + "/results/resfinder/{sample}", sample=SAMPLES),
expand(OUT + "/summary/summary_virulencefinder.csv"),
expand(OUT + "/summary/summary_amrfinderplus.csv"),
expand(OUT + "/results/virulencefinder/{sample}/", sample=SAMPLES),
expand(OUT + "/results/amrfinderplus/{sample}/", sample=SAMPLES)
else:
species = config["species"]
if species == "escherichia_coli" or species == "shigella" or species == "campylobacter" or species == "salmonella":
rule all:
""" Main rule that starts the complete workflow """
input:
expand(OUT + "/summary/summary_amr_genes.csv"),
expand(OUT + "/summary/summary_amr_phenotype.csv"),
expand(OUT + "/summary/summary_amr_pointfinder_results.csv"),
expand(OUT + "/summary/summary_amr_pointfinder_prediction.csv"),
expand(OUT + "/results/resfinder/{sample}", sample=SAMPLES),
expand(OUT + "/summary/summary_virulencefinder.csv"),
expand(OUT + "/summary/summary_amrfinderplus.csv"),
expand(OUT + "/results/virulencefinder/{sample}/", sample=SAMPLES),
expand(OUT + "/results/amrfinderplus/{sample}/", sample=SAMPLES),
expand(OUT + "/summary/summary_iles.csv")
else:
rule all:
""" Main rule that starts the complete workflow """
input:
expand(OUT + "/summary/summary_amr_genes.csv"),
expand(OUT + "/summary/summary_amr_phenotype.csv"),
expand(OUT + "/summary/summary_amr_pointfinder_results.csv"),
expand(OUT + "/summary/summary_amr_pointfinder_prediction.csv"),
expand(OUT + "/results/resfinder/{sample}", sample=SAMPLES),
expand(OUT + "/summary/summary_virulencefinder.csv"),
expand(OUT + "/summary/summary_amrfinderplus.csv"),
expand(OUT + "/results/virulencefinder/{sample}/", sample=SAMPLES),
expand(OUT + "/results/amrfinderplus/{sample}/", sample=SAMPLES)