This repository has been archived by the owner on Nov 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
93 lines (80 loc) · 3.23 KB
/
Makefile
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
86
87
88
89
90
91
92
93
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -euic
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
### Variables ###
# Tools
PYTEST = pytest
BASH = bash
CONDA = conda
PYTHON = python3.9
SNAKEMAKE = snakemake
CONDA_ACTIVATE = source $$(conda info --base)/etc/profile.d/conda.sh ; conda activate ; conda activate
# Paths
TEST_COMMON = scripts/common_script_vass.py
TEST_PIPELINE = scripts/prepare_pipeline.py
SNAKE_FILE = Snakefile
TEST_LAUNCHER = vcf-annotate-snpeff-snpsift.py
PROFILE = .igr/profile/local
ENV_YAML = envs/workflow.yaml
GWASCAT_PATH = tests/annotations/test.gwascat.tsv
DBNSFP_PATH = tests/annotations/test.dbNSFP.vcf.gz
GENESETS_PATH = tests/annotations/test.gmt
COSMIC_PATH = tests/annotations/Cosmic.vcf
KAVIAR_PATH = tests/annotations/kaviar.vcf
CLINVAR_PATH = tests/annotations/clinvar.vcf
KGENOME_PATH = tests/annotations/1000g.vcf
SNPEFF_DB_PATH = tests/annotations/snpeff/data/GRCtest/
DBSNP_PATH = tests/annotations/dbSNP.vcf
VCF_PATH = tests/vcfs/empty
# Arguments
ENV_NAME = vcf-annotate-snpeff-snpsift
SNAKE_THREADS = 1
SNPEFF_ARGS = '-nodownload -noGenome'
# Recipes
default: all-unit-tests
# Environment building through conda
conda-install:
${CONDA_ACTIVATE} base && \
${CONDA} env create --file ${ENV_YAML} --force && \
${CONDA} activate ${ENV_NAME}
### UNIT TESTS ###
# Running all unit-tests (one for each python scripts)
all-unit-tests:
${CONDA_ACTIVATE} ${ENV_NAME} && \
${PYTEST} -v ${TEST_COMMON} ${TEST_PIPELINE}
.PHONY: all-unit-tests
# Running all unit test (on common_script_vass.py only)
common-tests:
${CONDA_ACTIVATE} ${ENV_NAME} && \
${PYTEST} -vv ${TEST_COMMON}
.PHONY: common-tests
### Continuous Integration Tests ###
# Running snakemake on test datasets
test-conda-report.html:
${CONDA_ACTIVATE} ${ENV_NAME} && \
declare -x PROFILE="${PWD}/${PROFILE}" && \
export PROFILE && \
${PYTHON} ${TEST_LAUNCHER} config --force --recursive --debug \
--SnpEff-db ${SNPEFF_DB_PATH} --dbNSFP ${DBNSFP_PATH} \
--GWASCat ${GWASCAT_PATH} --GeneSets ${GENESETS_PATH} \
--Kgenomes ${KGENOME_PATH} --Cosmic ${COSMIC_PATH} \
--ClinVar ${CLINVAR_PATH} --dbSNP ${DBSNP_PATH} \
--Kaviar ${KAVIAR_PATH} --snpeff-extra ${SNPEFF_ARGS} \
--workdir ${PWD}/tests ${VCF_PATH} && \
${PYTHON} ${TEST_LAUNCHER} snakemake --snakemake-args '--directory ${PWD}/tests' && \
${PYTHON} ${TEST_LAUNCHER} report --snakemake-args '--directory ${PWD}/tests'
# Cleaning Snakemake outputs
clean:
${CONDA_ACTIVATE} ${ENV_NAME} && \
${SNAKEMAKE} -s ${SNAKE_FILE} --use-conda -j ${SNAKE_THREADS} --force --configfile ${PWD}/tests/config.yaml --use-singularity --directory ${PWD}/tests --delete-all-output
.PHONY: clean
# Display pipeline graph
workflow.png:
${CONDA_ACTIVATE} ${ENV_NAME} && \
${SNAKEMAKE} -s ${SNAKE_FILE} --use-conda -j ${SNAKE_THREADS} --force --configfile ${PWD}/tests/config.yaml --directory ${PWD}/tests --rulegraph | dot -T png > workflow.png
example.png:
${CONDA_ACTIVATE} ${ENV_NAME} && \
${SNAKEMAKE} -s ${SNAKE_FILE} --use-conda -j ${SNAKE_THREADS} --force --configfile ${PWD}/tests/config.yaml --directory ${PWD}/tests --dag | dot -T png > example.png