-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
101 lines (86 loc) · 2.88 KB
/
Makefile
File metadata and controls
101 lines (86 loc) · 2.88 KB
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
SHELL:=/bin/bash
.ONESHELL:
# apply code formatting
clean:
go mod tidy
gofmt -l -w .
test:
tmp_cache="$$(mktemp -d)" ; \
trap 'rm -rf "$$tmp_cache"' EXIT ; \
GOCACHE="$$tmp_cache" go test -count=1 ./...
.PHONY:test
CMD:=./cmd/squish
BIN:=squish
FASTQGZ:=data/test1.fastq.gz
test-run:
tmp_cache="$$(mktemp -d)" ; \
trap 'rm -rf "$$tmp_cache"' EXIT ; \
GOCACHE="$$tmp_cache" go run "$(CMD)" "$(FASTQGZ)" "output.gz"
# brew install graphviz
PROF:=mem.prof
PDF:=memprofile.pdf
pdf:
go tool pprof -pdf -output $(PDF) $(PROF)
.PHONY:pdf
# && open -a Preview $(PDF)
# NOTE: you can just ignore this error message;
# fatal: No names found, cannot describe anything.
GIT_TAG:=$(shell git describe --tags)
build:
tmp_cache="$$(mktemp -d)" ; \
trap 'rm -rf "$$tmp_cache"' EXIT ; \
GOCACHE="$$tmp_cache" go build -trimpath -ldflags="-X 'squish.Version=$(GIT_TAG)'" -o ./$(BIN) $(CMD)
.PHONY:build
build-all:
mkdir -p build ; \
tmp_cache="$$(mktemp -d)" ; \
trap 'rm -rf "$$tmp_cache"' EXIT ; \
for os in darwin linux windows; do \
for arch in amd64 arm64; do \
output="build/$(BIN)-v$(GIT_TAG)-$$os-$$arch" ; \
if [ "$${os}" == "windows" ]; then output="$${output}.exe"; fi ; \
echo "building: $$output" ; \
GOOS=$$os GOARCH=$$arch GOCACHE="$$tmp_cache" go build -trimpath -ldflags="-X 'squish.Version=$(GIT_TAG)'" -o "$${output}" $(CMD) ; \
done ; \
done
#
# USAGE:
# make test-run-all FASTQIN=data/test1.fastq.gz
#
# input/SRR14575325.gz9.fastq.gz
FASTQIN:=data/SRR6357076_1.fastq.gz
FASTQOUT:=squish.SRR6357076_1
# FASTQIN:=data/SRX1603629_T1_1.fastq.gz
# FASTQOUT:=squish.SRX1603629_T1_1
SAMPLESHEET:=samples.csv
OUTDIR:=output
ENGINE:=memory
BUCKET:=auto
BUCKETS:=512
CLUMPK:=31
$(OUTDIR):
mkdir -p "$(OUTDIR)"
test-run-all: build $(BIN) $(OUTDIR)
set -x ; \
for i in alpha gc qual clump; do \
echo ">>> RUNNING: method=$$i engine=$(ENGINE) bucket=$(BUCKET) buckets=$(BUCKETS) clumpK=$(CLUMPK)" ; \
./$(BIN) -outdir "$(OUTDIR)" -engine "$(ENGINE)" -bucket "$(BUCKET)" -buckets "$(BUCKETS)" -clumpK "$(CLUMPK)" -m "$$i" -orderFile "order.$$i.txt" -reportFile "report.$$i.json" -memProf "mem.$$i.prof" -cpuProf "cpu.$$i.prof" "$(FASTQIN)" "$(FASTQOUT)".$$i.fastq.gz ; \
$(MAKE) pdf PROF="$(OUTDIR)/profile.$$i/mem.$$i.prof" PDF="$(OUTDIR)/profile.$$i/memprofile.$$i.pdf" ; \
done
test-run-all-external:
$(MAKE) test-run-all ENGINE=external
nextflow-test-run-all:
nextflow run main.nf --engine memory --samplesheet "$(SAMPLESHEET)"
nextflow-test-run-all-external:
nextflow run main.nf --engine external --samplesheet "$(SAMPLESHEET)"
# docker build -t stevekm/squish:latest .
DOCKER_TAG:=stevekm/squish:$(GIT_TAG)
docker-build:
docker build \
--build-arg "Version=$(GIT_TAG)" \
-t $(DOCKER_TAG) .
# docker push stevekm/squish:latest
docker-push:
docker push $(DOCKER_TAG)
# docker-test-run:
# docker run --platform linux/amd64 --rm -ti -v ${PWD}:${PWD} --workdir ${PWD} $(DOCKER_TAG) $(BIN) $(FASTQ)