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 1
/
Makefile
99 lines (80 loc) · 3.27 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
94
95
96
97
98
99
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -euio pipefail -c
.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_CONFIG = scripts/prepare_config.py
TEST_DESIGN = scripts/prepare_design.py
SNAKE_FILE = Snakefile
ENV_YAML = envs/workflows.yaml
GENOME_PATH = genomes/genome.fasta
DBSNP_PATH = genomes/dbsnp.vcf.gz
READS_PATH = reads/
# Arguments
ENV_NAME = wes-mapping-bwa-gatk
ENV_LOCAL = envs/workflow_flamingo.yaml
ENV_FLAMINGO = envs/workflow_local.yaml
SNAKE_THREADS = 1
# Recipes
default: all-unit-tests
### UNIT TESTS ###
# Running all unit-tests (one for each python scripts)
all-unit-tests:
${CONDA_ACTIVATE} ${ENV_NAME} && \
${PYTEST} -vv ${TEST_CONFIG} ${TEST_DESIGN}
# Running all unit test (on prepare_config.py only)
config-tests:
${CONDA_ACTIVATE} ${ENV_NAME} && \
${PYTEST} -vv ${TEST_CONFIG} && \
${PYTHON} ${TEST_CONFIG} ${GENOME_PATH} ${DBSNP_PATH} --debug --cold-storage /mnt
# Running all unit test (on prepare_design.py only)
design-tests:
${CONDA_ACTIVATE} ${ENV_NAME} && \
${PYTEST} -vv ${TEST_DESIGN} && \
${PYTHON} ${TEST_DESIGN} --single --recursive ${PWD} --debug
### Continuous Integration Tests ###
# Running snakemake on test datasets
test-conda-report.html:
${CONDA_ACTIVATE} ${ENV_NAME} && \
${PYTHON} ${TEST_DESIGN} --single --recursive ${PWD} --output ${PWD}/tests/design.tsv --debug && \
${PYTHON} ${TEST_CONFIG} ${GENOME_PATH} ${DBSNP_PATH} --bwa-map-extra '-k 5 -T 0 ' --workdir ${PWD}/tests/ --debug --cold-storage /mnt && \
${SNAKEMAKE} -s ${SNAKE_FILE} --use-conda -j ${SNAKE_THREADS} --printshellcmds --forceall --configfile ${PWD}/tests/config.yaml --directory ${PWD}/tests && \
${SNAKEMAKE} -s ${SNAKE_FILE} --use-conda -j ${SNAKE_THREADS} --report test-conda-report.html --directory ${PWD}/tests
# Environment building through conda
conda-install:
${CONDA_ACTIVATE} base && \
${CONDA} env create --file ${ENV_YAML} --force && \
${CONDA} activate ${ENV_NAME}
# Installation
conda-install-flamingo:
${CONDA_ACTIVATE} base && \
${CONDA} env create --file ${ENV_FLAMINGO} --force && \
${CONDA} activate ${ENV_NAME}
.PHONY: conda-install-flamingo
conda-install-local:
${CONDA_ACTIVATE} base && \
${CONDA} env create --file ${ENV_LOCAL} --force && \
${CONDA} activate ${ENV_NAME}
.PHONY: conda-install-local
# 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