-
Notifications
You must be signed in to change notification settings - Fork 0
/
Snakefile
81 lines (58 loc) · 1.75 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
"""
Build a table of variants and annotations.
"""
import collections
import gzip
import numpy as np
import os
import pandas as pd
import pickle
import re
import sys
from Bio import SeqIO
import Bio.bgzf
DATA_TABLE_DIR = os.path.dirname(workflow.snakefile)
#
# Config
#
SITE_CONFIG_FILE_NAME = os.path.join(DATA_TABLE_DIR, 'local/config/config.json')
RUN_CONFIG_FILE_NAME = 'config/config.json'
if os.path.isfile(SITE_CONFIG_FILE_NAME):
configfile: SITE_CONFIG_FILE_NAME
if os.path.isfile(RUN_CONFIG_FILE_NAME):
configfile: RUN_CONFIG_FILE_NAME
# Check SVPOP_DIR
if 'svpop_dir' not in config:
raise RuntimeError('Missing "svpop_dir" in config (path to SV-Pop run directory where data are found)')
if 'table_def' not in config:
raise RuntimeError('Missing "table_def" in config (output table definitions)')
if 'reference' not in config:
raise RuntimeError('Missing "reference" in config (output table definitions)')
# Get reference (for convenience)
REF_FA = config['reference']
REF_FAI = config['reference'] + '.fai'
#
# Library imports
#
sys.path.append(os.path.join(DATA_TABLE_DIR, 'dep/svpop'))
sys.path.append(os.path.join(DATA_TABLE_DIR, 'dep/svpop/dep'))
sys.path.append(os.path.join(DATA_TABLE_DIR, 'dep/svpop/dep/ply'))
import svpoplib
import dtablib
#
# Rules
#
include: 'rules/base_table.snakefile'
include: 'rules/extern.snakefile'
include: 'rules/flag.snakefile'
include: 'rules/genes.snakefile'
include: 'rules/geneset.snakefile'
include: 'rules/pop.snakefile'
include: 'rules/regions.snakefile'
include: 'rules/snv.snakefile'
include: 'rules/support.snakefile'
include: 'rules/support_matrix.snakefile'
include: 'rules/tracks.snakefile'
include: 'rules/interseq.snakefile'
include: 'rules/mapping.snakefile'
include: 'rules/vcf.snakefile'