Debian Codegraph @

tests/starch/Makefile

raw ◀ ▶
1 Debian patch touch this file
1 APPGROUP = starch
2 CWD := $(abspath $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST))))))
•3 STARCH = bedops-starch
4 STARCHBIN = starch
•5 UNSTARCH = unstarch
6 UNSTARCHBIN = unstarch
•7 STARCHCAT = starchcat
8 STARCHCATBIN = starchcat
•9 STARCHSTRIP = starchstrip
10 STARCHSTRIPBIN = starchstrip
•11 SORTBED = sort-bed
12 BEDMAP = bedmap
13 TMP := $(shell mktemp -d)
14 DATA = $(CWD)/data
15 SHELL := /bin/bash
16 SAMPLES = 3
17 MAXLENGTH = 10000
18 RANDOMINTERVALS = $(TMP)/random_intervals.bed
19
20 all:
21 @echo "Testing binary group [$(APPGROUP)] and build type [$(BUILDTYPE)]"
22 @$(MAKE) tests
23
24 tests: unstarch starch_api starch
25 @echo "Removing [$(TMP)]"
26 @rm -rf $(TMP)
27
28 unstarch: unstarch_prep signature
29
30 unstarch_prep:
31 @[ -f $(UNSTARCH) ] || echo "Missing binary [$(UNSTARCH)] for build type [$(BUILDTYPE)]"
32 @echo "Writing to [$(TMP)]"
33 $(UNSTARCH) --version
34
35 signature:
36 # Test 001
37 # starch tests/bedops/data/002.difference.002a.test > tests/starch/data/001.unstarch.signature.001.test
38 @printf "[$(APPGROUP)-$(UNSTARCHBIN)-$(BUILDTYPE) --$@] - [Test 001]"
39 @$(UNSTARCH) --signature $(DATA)/001.unstarch.signature.001.test > $(TMP)/001.unstarch.signature.001.observed
40 @diff $(TMP)/001.unstarch.signature.001.observed $(DATA)/001.unstarch.signature.001.expected || (printf " ...failed!\n" && exit 1)
41 @printf " ...passed!\n"
42 # Test 002
43 # starch tests/bedops/data/002.difference.002a.test > tests/starch/data/002.unstarch.signature.001.test
44 @printf "[$(APPGROUP)-$(UNSTARCHBIN)-$(BUILDTYPE) --$@] - [Test 002]"
45 @$(UNSTARCH) --signature $(DATA)/002.unstarch.signature.001.test > $(TMP)/002.unstarch.signature.001.observed
46 @diff $(TMP)/002.unstarch.signature.001.observed $(DATA)/002.unstarch.signature.001.expected || (printf " ...failed!\n" && exit 1)
47 @printf " ...passed!\n"
48
49 starch_api: starch_api_prep starch_api_bedmap
50
51 starch_api_prep:
52 @[ -f $(STARCH) ] || echo "Missing binary [$(STARCH)] for build type [$(BUILDTYPE)]"
53 $(STARCH) --version
54 @echo "Writing to [$(TMP)]"
55 @[ -f $(BEDMAP) ] || echo "Missing binary [$(BEDMAP)] for build type [$(BUILDTYPE)]"
56 $(BEDMAP) --help
57
58 starch_api_bedmap:
59 # Test 001
60 @printf "[$(APPGROUP)-$(STARCHBIN)-API-$(BUILDTYPE) --$@] - [Test 001]"
61 @$(BEDMAP) --echo --echo-map-id $(DATA)/001.starch_api.bedmap.001.test > $(TMP)/001.starch_api.bedmap.001.observed
62 @diff $(TMP)/001.starch_api.bedmap.001.observed $(DATA)/001.starch_api.bedmap.001.expected || (printf " ...failed!\n" && exit 1)
63 @printf " ...passed!\n"
64
65 starch: starch_prep deflate_and_inflate
66
67 starch_prep:
68 @[ -f $(STARCH) ] || echo "Missing binary [$(STARCH)] for build type [$(BUILDTYPE)]"
69 @echo "Writing to [$(TMP)]"
70 $(STARCH) --version
71 @echo "Generating random intervals..."
72 ./generate_random_intervals.sh $(DATA)/hg38.bed $(SAMPLES) $(MAXLENGTH) | $(SORTBED) - > $(RANDOMINTERVALS)
73
74 deflate_and_inflate: deflate_and_inflate_bzip2 deflate_and_inflate_gz
75
76 deflate_and_inflate_bzip2:
77 # Test 001
78 @printf "[$(APPGROUP)-$(STARCHBIN)-$(BUILDTYPE) --$@] - [Test 001]"
79 @$(STARCH) --bzip2 $(RANDOMINTERVALS) > $(TMP)/001.starch.deflate_and_inflate.bzip2.starch
80 @$(UNSTARCH) $(TMP)/001.starch.deflate_and_inflate.bzip2.starch > $(TMP)/001.starch.deflate_and_inflate.bzip2.bed
81 @diff $(TMP)/001.starch.deflate_and_inflate.bzip2.bed $(RANDOMINTERVALS) || (printf " ...failed!\n" && exit 1)
82 @printf " ...passed!\n"
83
84 deflate_and_inflate_gz:
85 # Test 001
86 @printf "[$(APPGROUP)-$(STARCHBIN)-$(BUILDTYPE) --$@] - [Test 001]"
87 @$(STARCH) --gzip $(RANDOMINTERVALS) > $(TMP)/001.starch.deflate_and_inflate.gz.starch
88 @$(UNSTARCH) $(TMP)/001.starch.deflate_and_inflate.gz.starch > $(TMP)/001.starch.deflate_and_inflate.gz.bed
89 @diff $(TMP)/001.starch.deflate_and_inflate.gz.bed $(RANDOMINTERVALS) || (printf " ...failed!\n" && exit 1)
90 @printf " ...passed!\n"
91
92 starchcat: starchcat_prep starchcat_disjoint_chrs
93
94 starchcat_prep:
95 @[ -f $(STARCHCAT) ] || echo "Missing binary [$(STARCHCAT)] for build type [$(BUILDTYPE)]"
96 @echo "Writing to [$(TMP)]"
97 $(STARCHCAT) --version
98
99 starchcat_disjoint_chrs:
100 # Test 001
101 @printf "[$(APPGROUP)-$(STARCHCATBIN)-$(BUILDTYPE) --$@] - [Test 001]"
102 @$(STARCHCAT) $(DATA)/001.starchcat.disjoint_chrs.chr1.001.test $(DATA)/001.starchcat.disjoint_chrs.chr2.001.test > $(TMP)/001.starchcat.disjoint_chrs.chr1andChr2.001.observed
103 @diff <($(UNSTARCH) $(TMP)/001.starchcat.disjoint_chrs.chr1andChr2.001.observed) <($(UNSTARCH) $(DATA)/001.starchcat.disjoint_chrs.chr1andChr2.001.expected) || (printf " ...failed!\n" && exit 1)
104 @printf " ...passed!\n"
105
106 starchstrip: starchstrip_prep
107
108 starchstrip_prep:
109 @[ -f $(STARCHSTRIP) ] || echo "Missing binary [$(STARCHSTRIP)] for build type [$(BUILDTYPE)]"
110 @echo "Writing to [$(TMP)]"
•111 $(STARCHSTRIP) --version