This repository has been archived by the owner on Feb 22, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Snakefile
85 lines (65 loc) · 2.06 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
"""
Structural variant caller for PacBio reads.
See also: https://github.com/EichlerLab/pacbio_variant_caller
"""
import math
import os
import tempfile
# Set snakemake directory
SNAKEMAKE_DIR = os.path.dirname(workflow.snakefile)
# Always set the environment
LD_LIBRARY_PATH = config.get("ld_path")
PATH = config.get("path")
shell.prefix("export PATH=\"%s\"; export LD_LIBRARY_PATH=\"%s\"; " % (PATH, LD_LIBRARY_PATH))
#
# Define internal constants.
#
CWD = os.getcwd()
#
# Load user variables.
#
# If the user has a config file in the current working directory, use
# that. Otherwise, use SMRT SV defaults.
if os.path.exists("config.json"):
configfile: "config.json"
else:
configfile: "%s/config.template.json" % SNAKEMAKE_DIR
TMP_DIR = config.get("tmp_dir", tempfile.gettempdir())
EVENT_TYPES = ("insertion", "deletion")
#
# Include rules.
#
if not "genotyper_config" in config:
CHROMOSOME_LENGTHS = config.get("reference_index", "%s.fai" % config["reference"])
# TODO: fix bug caused by Snakemake not understanding more than one dynamic
# output type per file.
include: "rules/prepare_reference.rules"
# Only include alignment rules if alignments aren't defined already or don't
# exist yet.
#if config.get("alignments") is None or not os.path.exists(config.get("alignments")):
include: "rules/alignment.rules"
include: "rules/sv_candidates.rules"
include: "rules/local_assembly.mhap_celera.rules"
include: "rules/variant_caller.rules"
else:
include: "rules/genotyper.rules"
#
# Determine which outputs to create.
#
OUTPUTS = []
if config.get("detection"):
OUTPUTS.extend([
"sv_candidate_lengths.pdf",
"sv_candidate_support.pdf",
"assembly_candidates.bed"
])
# if config.get("assembly") and config["assembly"].get("regions_to_assemble"):
# OUTPUTS.append("sv_assemblies.txt")
# if config.get("gap_extension") and config["gap_extension"].get("regions_to_assemble"):
# OUTPUTS.append("gap_assemblies.txt")
#
# Define rules.
#
# Create list of all final outputs.
rule all:
input: OUTPUTS