-
Notifications
You must be signed in to change notification settings - Fork 23
/
Makefile
executable file
·185 lines (148 loc) · 6.05 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
SHELL=/bin/bash
OS := $(shell uname | tr '[:upper:]' '[:lower:]')
# for porechop on travis (or other platform with older gcc)
CXX ?= g++
PYTHON ?= python3
CONDA ?= ~/miniconda3/
# Builds a cache of binaries which can just be copied for CI
BINARIES=minimap2 miniasm racon samtools bcftools k8 paftools.js seqkit bedtools bgzip tabix
BINCACHEDIR=bincache
$(BINCACHEDIR):
mkdir -p $(BINCACHEDIR)
BINBUILDDIR=binbuild
$(BINBUILDDIR):
mkdir -p $(BINBUILDDIR)
#MAPVER=2.14 Changed to 2.23 on 6 December 2021
MAPVER=2.23
$(BINCACHEDIR)/minimap2: | $(BINCACHEDIR) $(BINBUILDDIR)
@echo Making $(@F)
if [ ! -e ${BINBUILDDIR}/minimap2-${MAPVER}.tar.bz2 ]; then \
cd ${BINBUILDDIR}; \
wget https://github.com/lh3/minimap2/releases/download/v${MAPVER}/minimap2-${MAPVER}.tar.bz2; \
tar -xjf minimap2-${MAPVER}.tar.bz2; \
fi
cd ${BINBUILDDIR}/minimap2-${MAPVER} && make
cp ${BINBUILDDIR}/minimap2-${MAPVER}/minimap2 $@
ASMVER=0.3
$(BINCACHEDIR)/miniasm: | $(BINCACHEDIR) $(BINBUILDDIR)
@echo Making $(@F)
if [ ! -e ${BINBUILDDIR}/miniasm-v${ASMVER}.tar.gz ]; then \
cd ${BINBUILDDIR}; \
wget -O miniasm-v${ASMVER}.tar.gz https://github.com/lh3/miniasm/archive/v${ASMVER}.tar.gz; \
tar -xzf miniasm-v${ASMVER}.tar.gz; \
fi
cd ${BINBUILDDIR}/miniasm-${ASMVER} && make
cp ${BINBUILDDIR}/miniasm-${ASMVER}/miniasm $@
RACONVER=1.4.13
$(BINCACHEDIR)/racon: | $(BINCACHEDIR) $(BINBUILDDIR)
@echo Making $(@F)
@echo GCC is $(GCC)
if [ ! -e ${BINBUILDDIR}/racon-v${RACONVER}.tar.gz ]; then \
cd ${BINBUILDDIR}; \
wget https://github.com/lbcb-sci/racon/releases/download/${RACONVER}/racon-v${RACONVER}.tar.gz; \
tar -xzf racon-v${RACONVER}.tar.gz; \
fi
cd ${BINBUILDDIR}/racon-v${RACONVER} && mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-mno-avx2 " ..
cd ${BINBUILDDIR}/racon-v${RACONVER}/build && make
cp ${BINBUILDDIR}/racon-v${RACONVER}/build/bin/racon $@
#SAMVER=1.8 Changed to 1.14 on 6 December 2021
SAMVER=1.14
$(BINCACHEDIR)/samtools: | $(BINCACHEDIR) $(BINBUILDDIR)
@echo Making $(@F)
# tar.bz is not a dependency, since that would cause it to be fetched
# even when installing from $(BINCACHEDIR)
if [ ! -e ${BINBUILDDIR}/samtools-${SAMVER}.tar.bz2 ]; then \
cd ${BINBUILDDIR}; \
wget https://github.com/samtools/samtools/releases/download/${SAMVER}/samtools-${SAMVER}.tar.bz2; \
tar -xjf samtools-${SAMVER}.tar.bz2; \
fi
# make all-htslib to get bgzip and tabix
cd ${BINBUILDDIR}/samtools-${SAMVER} && make all all-htslib
cp ${BINBUILDDIR}/samtools-${SAMVER}/samtools $@
$(BINCACHEDIR)/tabix: | $(BINCACHEDIR)/samtools
cp ${BINBUILDDIR}/samtools-${SAMVER}/htslib-${SAMVER}/$(@F) $@
$(BINCACHEDIR)/bgzip: | $(BINCACHEDIR)/samtools
cp ${BINBUILDDIR}/samtools-${SAMVER}/htslib-${SAMVER}/$(@F) $@
K8VER=0.2.5
$(BINCACHEDIR)/k8: | $(BINCACHEDIR) $(BINBUILDDIR)
@echo Making $(@F)
if [ ! -e ${BINBUILDDIR}/k8-${K8VER}.tar.bz2 ]; then \
cd ${BINBUILDDIR}; \
wget https://github.com/attractivechaos/k8/releases/download/${K8VER}/k8-${K8VER}.tar.bz2; \
tar -xjf k8-${K8VER}.tar.bz2; \
fi
cp ${BINBUILDDIR}/k8-${K8VER}/k8-Linux $@
$(BINCACHEDIR)/paftools.js: | $(BINCACHEDIR)/minimap2
cp ${BINBUILDDIR}/minimap2-${MAPVER}/misc/$(@F) $@
#BCFVER=1.7 changed to 1.14 on 6 December 2021
BCFVER=1.14
$(BINCACHEDIR)/bcftools: | $(BINCACHEDIR) $(BINBUILDDIR)
@echo Making $(@F)
if [ ! -e ${BINBUILDDIR}/bcftools-${BCFVER}.tar.bz2 ]; then \
cd ${BINBUILDDIR}; \
wget https://github.com/samtools/bcftools/releases/download/${BCFVER}/bcftools-${BCFVER}.tar.bz2; \
tar -xjf bcftools-${BCFVER}.tar.bz2; \
fi
cd ${BINBUILDDIR}/bcftools-${BCFVER} && make
cp ${BINBUILDDIR}/bcftools-${BCFVER}/bcftools $@
#SEQKITVER=0.8.0 changed to 2.1.0 on 13 December 2021
SEQKITVER=2.1.0
$(BINCACHEDIR)/seqkit: | $(BINCACHEDIR) $(BINBUILDDIR)
@echo Making $(@F)
if [ ! -e ${BINBUILDDIR}/seqkit_${OS}_amd64.tar.gz ]; then \
cd ${BINBUILDDIR}; \
wget https://github.com/shenwei356/seqkit/releases/download/v${SEQKITVER}/seqkit_${OS}_amd64.tar.gz; \
tar -xzvf seqkit_${OS}_amd64.tar.gz; \
fi
cp ${BINBUILDDIR}/seqkit $@
#BEDTOOLSVER=2.31.0 on 7th June 2023
BEDTOOLSVER=2.31.0
$(BINCACHEDIR)/bedtools: | $(BINCACHEDIR) $(BINBUILDDIR)
@echo Making $(@F)
if [ ! -e ${BINBUILDDIR}/bedtools-2.29.0.tar.gz ]; then \
cd ${BINBUILDDIR}; \
wget https://github.com/arq5x/bedtools2/releases/download/v${BEDTOOLSVER}/bedtools-${BEDTOOLSVER}.tar.gz; \
mkdir bedtools-${BEDTOOLSVER}; \
tar -xzvf bedtools-${BEDTOOLSVER}.tar.gz --directory bedtools-${BEDTOOLSVER}; \
fi
cd ${BINBUILDDIR}/bedtools-${BEDTOOLSVER}/bedtools2/ && make
cp ${BINBUILDDIR}/bedtools-${BEDTOOLSVER}/bedtools2/bin/bedtools $@
.PHONY: venv
venv: venv/bin/activate
IN_VENV=. ./venv/bin/activate
venv/bin/activate:
test -d venv || $(PYTHON) -m venv venv --prompt 'pomoxis'
${IN_VENV} && pip install pip --upgrade
${IN_VENV} && pip install -r requirements.txt
.PHONY: install
install: venv | $(addprefix $(BINCACHEDIR)/, $(BINARIES))
${IN_VENV} && POMO_BINARIES=1 python setup.py install
.PHONY: build
build: pypi_build/bin/activate
IN_BUILD=. ./pypi_build/bin/activate
pypi_build/bin/activate:
test -d pypi_build || $(PYTHON) -m venv pypi_build --prompt "(pypi) "
${IN_BUILD} && pip install pip --upgrade
${IN_BUILD} && pip install --upgrade pip setuptools twine wheel readme_renderer[md]
.PHONY: sdist
sdist: pypi_build/bin/activate
${IN_BUILD} && python setup.py sdist
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
DOCSRC = docs
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: docs
docs: venv
${IN_VENV} && pip install sphinx sphinx_rtd_theme sphinx-argparse
${IN_VENV} && ./prog_docs.py > $(DOCSRC)/programs.rst
${IN_VENV} && cd $(DOCSRC) && $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(DOCSRC)/$(BUILDDIR)/html."
touch $(DOCSRC)/$(BUILDDIR)/html/.nojekyll