-
Notifications
You must be signed in to change notification settings - Fork 0
/
Snakefile
64 lines (48 loc) · 2.43 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
"""
Juno-typing
Author(s): Alejandra Hernandez-Segura
Organization: Rijksinstituut voor Volksgezondheid en Milieu (RIVM)
Department: Infektieziekteonderzoek, Diagnostiek en Laboratorium Surveillance (IDS), Bacteriologie (BPD)
Date: 17-06-2021
"""
#################################################################################
##### Import config file, sample_sheet and set output folder names #####
#################################################################################
import os
import yaml
#################################################################################
##### Load samplesheet, load genus dict and define output directory #####
#################################################################################
# Loading sample sheet as dictionary
# ("R1" and "R2" keys for fastq, and "assembly" for fasta)
sample_sheet = config["sample_sheet"]
SAMPLES = {}
with open(sample_sheet) as sample_sheet_file:
SAMPLES = yaml.safe_load(sample_sheet_file)
# OUT defines output directory for most rules.
OUT = config["out"]
#@################################################################################
#@#### Processes #####
#@################################################################################
include: "bin/rules/run_blast.smk"
#@################################################################################
#@#### Finalize pipeline (error/success) #####
#@################################################################################
onsuccess:
shell("""
echo -e "\tGenerating Snakemake report..."
snakemake --config sample_sheet={sample_sheet} \
--configfile config/pipeline_parameters.yaml config/user_parameters.yaml \
--cores 1 --unlock
snakemake --config sample_sheet={sample_sheet} \
--configfile config/pipeline_parameters.yaml config/user_parameters.yaml \
--cores 1 --report '{OUT}/audit_trail/snakemake_report.html'
""")
#################################################################################
##### Specify final output #####
#################################################################################
localrules:
all
rule all:
input:
expand(OUT + "/{sample}_blastresults.asn", sample = SAMPLES)