diff --git a/Makefile b/Makefile index 2541e9c..401bab1 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ STATIC=$(BIN2)/bamtocov $(BIN2)/bamtocounts $(BIN2)/covtotarget $(BIN2)/bamcount $(BIN)/%: $(SOURCE)/%.nim $(SOURCE)/covutils.nim bamtocov.nimble - nim c $(NIM_PATHS) -d:NimblePkgVersion=$(VERSION) -d:release --opt:speed --out:$@ $< + nim c $(NIM_PATHS) -d:NimblePkgVersion=$(VERSION) -d:danger --opt:speed --out:$@ $< all: $(LIST) @@ -27,8 +27,9 @@ $(BIN2)/%: $(SOURCE)/%.nim bamtocov.nimble ./hts_nim_static_builder mkdir -p $(BIN2) echo target: $@ echo base: $(shell basename $@) - ./hts_nim_static_builder -n bamtocov.nimble -s $< -- -d:NimblePkgVersion=2.7.0 + ./hts_nim_static_builder -n bamtocov.nimble -s $< -- -d:NimblePkgVersion=$(VERSION) mv ./$(shell basename $@) $(BIN2) + test: testshpec testall: testbash testshpec testshunit2 diff --git a/Makefile.old b/Makefile.old new file mode 100644 index 0000000..effd8cf --- /dev/null +++ b/Makefile.old @@ -0,0 +1,41 @@ +# Create "make test" +.PHONY: testshpec testshunit2 test clean build + +BIN=./bin +SOURCE=./src +NIM_PATHS= --colors:on --noNimblePath --path:/local/giovanni/bamtocov/nimbledeps/pkgs/hts-0.3.17 --path:/local/giovanni/bamtocov/nimbledeps/pkgs/docopt-0.6.8 --path:/local/giovanni/bamtocov/nimbledeps/pkgs/regex-0.19.0 --path:/local/giovanni/bamtocov/nimbledeps/pkgs/unicodedb-0.9.0 --path:/local/giovanni/bamtocov/nimbledeps/pkgs/lapper-0.1.7 +VERSION := $(shell grep version bamtocov.nimble | grep -o "[0-9]\\+\.[0-9]\.[0-9]\\+") +LIST=$(BIN)/bamtocov $(BIN)/bamtoreads $(BIN)/bamtocounts $(BIN)/covtotarget $(BIN)/bamcountrefs $(BIN)/gff2bed $(BIN)/bamtocounts_legacy $(BIN)/bamtarget + +$(BIN)/%: $(SOURCE)/%.nim $(SOURCE)/covutils.nim bamtocov.nimble + nim c $(NIM_PATHS) -d:NimblePkgVersion=$(VERSION) -d:release --opt:speed --out:$@ $< + +all: $(LIST) + + +test: testshpec + +testall: testbash testshpec testshunit2 +testshpec: + @echo " --- Test shpec --- " + ./tests/bin/shpec ./tests/shpec/bamtocov.sh + +testshunit2: + @echo " --- Test shunit2 --- " + ./tests/unit/bamtocov-base.sh + +testbash: + @echo " --- Test (legacy) --- " + bash tests/all.sh + + +build: + nimble build + + +clean: + @echo "Cleaning..." + @for i in $(LIST); \ + do \ + if [ -e "$$i" ]; then rm -f $$i; echo "Removing $$i"; else echo "$$i Not found"; fi \ + done diff --git a/nim.cfg b/nim.cfg index 89a4d4b..f17beb7 100644 --- a/nim.cfg +++ b/nim.cfg @@ -2,7 +2,6 @@ # nim c -a -d:static -d:release -d:danger --d:release --opt:speed @if static: passC:"-static" diff --git a/tests/results/mini_wig250_max.wig b/tests/results/mini_wig250_max.wig index 297430e..ce444d4 100644 --- a/tests/results/mini_wig250_max.wig +++ b/tests/results/mini_wig250_max.wig @@ -1,15 +1,15 @@ fixedStep chrom=seq1 span=250 -0 5 -250 6 -500 1 -750 0 +5 +6 +1 +0 fixedStep chrom=seq2 span=250 -0 0 -250 10 -500 10 -750 0 +0 +10 +10 +0 fixedStep chrom=seq0 span=250 -0 0 -250 0 -500 0 -750 0 +0 +0 +0 +0 diff --git a/tests/shpec/bamtocov.sh b/tests/shpec/bamtocov.sh index 95a4240..0ddb894 100644 --- a/tests/shpec/bamtocov.sh +++ b/tests/shpec/bamtocov.sh @@ -95,11 +95,11 @@ describe "Coverage tools tested by Shpec" LINES=$("$BINDIR"/bamtocov "$DATADIR"/mini.bam --wig 250 --op max | wc -l) assert equal $LINES 15 end - it "Produces wig output (check lines at 750)" - LINES=$("$BINDIR"/bamtocov "$DATADIR"/mini.bam --wig 250 --op max | grep -w 750 | wc -l) - assert equal $LINES 3 + it "Produces wig output (check coverage 10X)" + LINES=$("$BINDIR"/bamtocov "$DATADIR"/mini.bam --wig 250 --op max | grep -w 10 | wc -l) + assert equal $LINES 2 end - it "Produces wig output (check lines at 1000 bases, unexpected)" + it "Produces wig output (check lines at 1000, unexpected)" LINES=$("$BINDIR"/bamtocov "$DATADIR"/mini.bam --wig 250 --op max | grep -w 1000 |wc -l) assert equal $LINES 0 end