Commit 55b80e0e authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

merge - clean algo/tests directory structure

parents f62a73a1 605106b4
......@@ -144,9 +144,9 @@ cleanall: clean
RELEASE_TAG="notag"
RELEASE_H = $(VIDJIL_ALGO_SRC)/release.h
RELEASE_SOURCE = $(wildcard $(VIDJIL_ALGO_SRC)/*.cpp) $(wildcard $(VIDJIL_ALGO_SRC)/*.h) $(wildcard $(VIDJIL_ALGO_SRC)/core/*.cpp) $(wildcard $(VIDJIL_ALGO_SRC)/tests/*.cpp) $(wildcard $(VIDJIL_ALGO_SRC)/core/*.h) $(wildcard $(VIDJIL_ALGO_SRC)/tests/*.h) $(wildcard $(VIDJIL_ALGO_SRC)/cgi/*.cpp) $(wildcard $(VIDJIL_ALGO_SRC)/lib/*.cpp) $(wildcard $(VIDJIL_ALGO_SRC)/lib/*.h) $(wildcard $(VIDJIL_ALGO_SRC)/lib/*.hpp) $(wildcard tools/*.py)
RELEASE_SOURCE = $(wildcard $(VIDJIL_ALGO_SRC)/*.cpp) $(wildcard $(VIDJIL_ALGO_SRC)/*.h) $(wildcard $(VIDJIL_ALGO_SRC)/core/*.cpp) $(wildcard $(VIDJIL_ALGO_SRC)/tests/unit-tests/*.cpp) $(wildcard $(VIDJIL_ALGO_SRC)/core/*.h) $(wildcard $(VIDJIL_ALGO_SRC)/tests/unit-tests/*.h) $(wildcard $(VIDJIL_ALGO_SRC)/cgi/*.cpp) $(wildcard $(VIDJIL_ALGO_SRC)/lib/*.cpp) $(wildcard $(VIDJIL_ALGO_SRC)/lib/*.h) $(wildcard $(VIDJIL_ALGO_SRC)/lib/*.hpp) $(wildcard tools/*.py)
RELEASE_MAKE = ./Makefile $(VIDJIL_ALGO_SRC)/Makefile $(VIDJIL_ALGO_SRC)/core/Makefile $(VIDJIL_ALGO_SRC)/tests/Makefile $(VIDJIL_ALGO_SRC)/lib/Makefile germline/Makefile data/Makefile tools/tests/Makefile doc/Makefile
RELEASE_TESTS = doc/format-analysis.org data/get-sequences $(wildcard data/*.vidjil) $(wildcard data/*.analysis) $(wildcard data/*.data) $(wildcard data/*.fa) $(wildcard data/*.fq) $(VIDJIL_ALGO_SRC)/tests/should-vdj-to-tap.py $(wildcard $(VIDJIL_ALGO_SRC)/tests/should-vdj-tests/*.should-vdj.fa) $(wildcard $(VIDJIL_ALGO_SRC)/tests/should-vdj-tests/*.should-locus.fa) $(VIDJIL_ALGO_SRC)/tests/should-to-tap.sh $(wildcard $(VIDJIL_ALGO_SRC)/tests/*.should_get) $(wildcard $(VIDJIL_ALGO_SRC)/tests/bugs/*.fa) $(wildcard $(VIDJIL_ALGO_SRC)/tests/bugs/*.should_get) $(VIDJIL_ALGO_SRC)/tests/format-json.sh $(wildcard doc/analysis-example*.vidjil) $(wildcard tools/tests/*.should_get) tools/tests/should-to-tap.sh tools/diff_json.sh
RELEASE_TESTS = doc/format-analysis.org data/get-sequences $(wildcard data/*.vidjil) $(wildcard data/*.analysis) $(wildcard data/*.data) $(wildcard data/*.fa) $(wildcard data/*.fq) $(VIDJIL_ALGO_SRC)/tests/should-vdj-to-tap.py $(wildcard $(VIDJIL_ALGO_SRC)/tests/should-vdj-tests/*.should-vdj.fa) $(wildcard $(VIDJIL_ALGO_SRC)/tests/should-vdj-tests/*.should-locus.fa) $(VIDJIL_ALGO_SRC)/tests/should-to-tap.sh $(wildcard $(VIDJIL_ALGO_SRC)/tests/should-get-tests/*.should-get) $(wildcard $(VIDJIL_ALGO_SRC)/tests/bugs/*.fa) $(wildcard $(VIDJIL_ALGO_SRC)/tests/bugs/*.should_get) $(VIDJIL_ALGO_SRC)/tests/format-json.sh $(wildcard doc/analysis-example*.vidjil) $(wildcard tools/tests/*.should_get) tools/tests/should-to-tap.sh tools/diff_json.sh
RELEASE_GERMLINES = germline/germline_id germline/get-saved-germline germline/get-germline germline/split-from-imgt.py germline/germlines.data germline/revcomp-fasta.py germline/fasta.py
RELEASE_HELP = doc/algo.org doc/locus.org doc/dev.org doc/should-vdj.org doc/credits.org doc/CHANGELOG doc/LICENSE
RELEASE_FILES = $(RELEASE_SOURCE) $(RELEASE_TESTS) $(RELEASE_MAKE) $(RELEASE_GERMLINES) $(RELEASE_HELP) data/segmentation.fasta $(wildcard data/*.fa.gz) $(wildcard data/*.label)
......
......@@ -3,34 +3,36 @@ INCLUDE=-I ..
OPTIM=-g -O0 $(COVERAGE)
override CXXFLAGS += -std=c++11 -W -Wall $(OPTIM)
LDLIBS=-lz
SRC= tests.cpp
SRC= unit-tests/tests.cpp
EXEC=$(SRC:.cpp=)
OTHER_SRC=$(wildcard *.cpp)
LIB=../core/vidjil.a ../lib/lib.a
SHOULD=$(wildcard *.should_get)
SHOULD_LOG=$(SHOULD:.should_get=.tap)
SHOULD=$(wildcard should-get-tests/*.should-get)
SHOULD_LOG=$(SHOULD:.should-get=.tap)
SHOULD_VDJ=$(wildcard should-vdj-tests/*.should-vdj.fa)
SHOULD_LOCUS=$(wildcard should-vdj-tests/*.should-locus.fa)
REPORTS_PATH := $(patsubst %/Makefile,%,$(abspath $(lastword $(MAKEFILE_LIST))))/../../reports
VALGRIND=valgrind -v --tool=memcheck --leak-check=full --show-reachable=yes --undef-value-errors=yes --track-origins=yes --xml=yes --xml-file="$$(mktemp "$(REPORTS_PATH)/valgrind.xml.XXXXXX")"
DATE=$(shell date +%Y-%m-%d:%H:%M:%S)
SNAPSHOT=snapshot-log-$(DATE)
DATE=$(shell date +%Y-%m-%d--%H:%M:%S)
SNAPSHOTS_DIR=./snapshots
SNAPSHOT=$(SNAPSHOTS_DIR)/snapshot-log--$(DATE)
.PHONY: all force clean forcedep
test: all
@echo
@echo "*** Launching unit tests..."
./tests
cat tests.cpp.tap
./unit-tests/tests
cat ./unit-tests/tests.cpp.tap
@echo "*** All unit tests passed"
all: core $(EXEC)
@echo "All tests compiled."
snapshot:
grep . *.log should-vdj-tests/*.log > $(SNAPSHOT)
mkdir -p $(SNAPSHOTS_DIR)
grep . should-get-tests/*.log should-vdj-tests/*.log > $(SNAPSHOT)
touch snapshot-last ; mv snapshot-last snapshot-prev
ln -s $(SNAPSHOT) snapshot-last
diff -I "20..-..-.." snapshot-prev snapshot-last | diffstat -cC
......@@ -59,7 +61,7 @@ shouldvdj_with_rc_merged:
cat $(SHOULD_VDJ) > should-vdj-tests/should-vdj.merged.fa
python should-vdj-to-tap.py -r should-vdj-tests/should-vdj.merged.fa
%.tap: %.should_get force
%.tap: %.should-get force
./should-to-tap.sh $<
valgrind_should:
......
!NO_LAUNCHER:
!LAUNCH: ../../vidjil -G ../../germline/IGH ../../data/clones_simul.fa > out-fa ; ../../vidjil -G ../../germline/IGH -b clones_simul ../../data/clones_simul.fa.gz > out-fa-gz ; diff -s -I '\#' -I 'index' -I 'data/clones_simul' out-fa out-fa-gz ; echo 'Diff: '\\$?; wc -l out-fa-gz
$ Identical output
1:Diff: 0
$ Testing out-fa-gz has approximately 90 lines
1: [89]. out-fa-gz
!LAUNCH: ../../vidjil -c segment -G ../../germline/IGH -A ../../data/overlap-d-j.fa | tail -4 | tr -d '\\\\n' | wc -c
$ Exported sequence has all the bases
1:116
!NO_LAUNCHER:
!LAUNCH: (cd ../../data ; md5sum *.fasta || md5 -r *.fasta)
!LAUNCH: (cd $VIDJIL_DIR/data ; md5sum *.fasta || md5 -r *.fasta)
$ Check md5 in data/
1:985219d9156b6d9e8966807595beada3 Stanford_S22.fa
......
!NO_LAUNCHER:
!LAUNCH: (cd ../../germline ; md5sum *.fa || md5 -r *.fa)
!LAUNCH: (cd $VIDJIL_DIR/germline ; md5sum *.fa || md5 -r *.fa)
$ Check md5 in germline/, sequences split and processed from IMGT
1:3a655c9d99ca04907a120f1b69febf2e IGHD.fa
......
!LAUNCH: export REQUEST_METHOD=POST ; export CONTENT_TYPE=test ; $LAUNCHER ../../browser/cgi/align.cgi < ../../data/msa.fa
!LAUNCH: export REQUEST_METHOD=POST ; export CONTENT_TYPE=test ; $LAUNCHER $VIDJIL_DIR/browser/cgi/align.cgi < $VIDJIL_DIR/data/msa.fa
$ no spurious info
0: .* bp in .* sequences
......
!LAUNCH: ../../vidjil -A -t 0 -g ../../germline -2 -i ../../data/chimera-fake.fa
!LAUNCH: $VIDJIL_DIR/vidjil -A -t 0 -g $VIDJIL_DIR/germline -2 -i $VIDJIL_DIR/data/chimera-fake.fa
$ The KmerSegmenter segments the three chimera reads on PSEUDO_MAX12 germline (-2)
1:xxx .* -> .* 3
......
!LAUNCH: ../../vidjil -A -g ../../data/chimera-fake-VJ-germlines.data -i ../../data/chimera-fake-VJ.fa
!LAUNCH: $VIDJIL_DIR/vidjil -A -g $VIDJIL_DIR/data/chimera-fake-VJ-germlines.data -i $VIDJIL_DIR/data/chimera-fake-VJ.fa
# Testing a custom (fake) germlines.data
$ Loads from 'chimera-fake-VJ-germlines.data' a custom germline
......
!LAUNCH: ../../vidjil -A -g ../../germline -i -2 ../../data/chimera-fake-VJ.fa
!LAUNCH: $VIDJIL_DIR/vidjil -A -g $VIDJIL_DIR/germline -i -2 $VIDJIL_DIR/data/chimera-fake-VJ.fa
$ The KmerSegmenter segments the five chimera reads on PSEUDO_MAX12 germline (-2)
1:xxx .* -> .* 5
......
!LAUNCH: ../../vidjil -e 100 -A -t 0 -g ../../germline -4 -i ../../data/chimera-fake-half.fa
!LAUNCH: $VIDJIL_DIR/vidjil -e 100 -A -t 0 -g $VIDJIL_DIR/germline -4 -i $VIDJIL_DIR/data/chimera-fake-half.fa
# TODO: a more precise modeling should give a e-value computation that could make this work even with -e 1
$ The KmerSegmenter segments the six chimera reads on PSEUDO_MAX1U germline (-4)
......
!LAUNCH: ../../vidjil -g ../../germline -i ../../data/chimera-fake.fa
!LAUNCH: $VIDJIL_DIR/vidjil -g $VIDJIL_DIR/germline -i $VIDJIL_DIR/data/chimera-fake.fa
$ Do not segment on any germline, even incomplete
1:junction detected in 0 reads
......
!LAUNCH: ../../vidjil -A -uU -g ../../germline ../../data/chimera-trg.fa
!LAUNCH: $VIDJIL_DIR/vidjil -A -uU -g $VIDJIL_DIR/germline $VIDJIL_DIR/data/chimera-trg.fa
$ Do not segment on IGL by chance
1:IGL .* -> .* 0
......
!LAUNCH: ../../vidjil -G ../../germline/TRG -c clones -A -3 ../../data/segment_lec.fa
!LAUNCH: $VIDJIL_DIR/vidjil -G $VIDJIL_DIR/germline/TRG -c clones -A -3 $VIDJIL_DIR/data/segment_lec.fa
$ Extract 50bp windows (TRG)
1:found . 50-windows
......
!LAUNCH: ../../vidjil -k 14 -w 50 -c clones -G ../../germline/IGH -y 3 -z 1 -r 1 ../../data/clones_simul.fa
!LAUNCH: $VIDJIL_DIR/vidjil -k 14 -w 50 -c clones -G $VIDJIL_DIR/germline/IGH -y 3 -z 1 -r 1 $VIDJIL_DIR/data/clones_simul.fa
$ Junction extractions
1:found 25 50-windows in 66 reads
......
!LAUNCH: ../../vidjil -k 14 -w 50 -c clones -G ../../germline/IGH -y 3 -z 0 -r 1 -n 5 ../../data/clones_simul.fa ; cat out/clones_simul.vidjil
!LAUNCH: $VIDJIL_DIR/vidjil -k 14 -w 50 -c clones -G $VIDJIL_DIR/germline/IGH -y 3 -z 0 -r 1 -n 5 $VIDJIL_DIR/data/clones_simul.fa ; cat out/clones_simul.vidjil
$ Window extractions
2:found 25 50-windows in 66 reads
......
!LAUNCH: ../../vidjil -KA -z 0 -s \\\\#\\\\#\\\\#\\\\#\\\\#-\\\\#\\\\#\\\\#\\\\#\\\\# -G ../../germline/IGH ../../data/common-V-D.fa ; cat out/common-V-D.affects
!LAUNCH: $VIDJIL_DIR/vidjil -KA -z 0 -s \\\\#\\\\#\\\\#\\\\#\\\\#-\\\\#\\\\#\\\\#\\\\#\\\\# -G $VIDJIL_DIR/germline/IGH $VIDJIL_DIR/data/common-V-D.fa ; cat out/common-V-D.affects
$ Segments the sequence
1: SEG .* -> .* 1
......
!NO_LAUNCHER:
!LAUNCH: $VIDJIL_DIR/vidjil -G $VIDJIL_DIR/germline/IGH $VIDJIL_DIR/data/clones_simul.fa > out-fa ; $VIDJIL_DIR/vidjil -G $VIDJIL_DIR/germline/IGH -b clones_simul $VIDJIL_DIR/data/clones_simul.fa.gz > out-fa-gz ; diff -s -I '\#' -I 'index' -I 'data/clones_simul' out-fa out-fa-gz ; echo 'Diff: '\\$?; wc -l out-fa-gz
$ Identical output
1:Diff: 0
$ Testing out-fa-gz has approximately 90 lines
1: [89]. out-fa-gz
!LAUNCH: ../../vidjil -G ../../germline/IGH -r 1 ../../data/large_N.fa
!LAUNCH: $VIDJIL_DIR/vidjil -G $VIDJIL_DIR/germline/IGH -r 1 $VIDJIL_DIR/data/large_N.fa
$ Find a huge insertion in the segmentation
1:>clone-001.*/[ACGT]{100}
!LAUNCH: (for i in {1..100000}; do echo '>read' ; echo ccgtgtattactgtgcgagagagctgaatacttccagcactg ; done ;) > same-igh-100k.fa ; $LAUNCHER ../../vidjil -G ../../germline/IGH -r 5000 -w 15 same-igh-100k.fa; rm -f same-igh-100k.fa
!LAUNCH: (for i in {1..100000}; do echo '>read' ; echo ccgtgtattactgtgcgagagagctgaatacttccagcactg ; done ;) > same-igh-100k.fa ; $LAUNCHER $VIDJIL_DIR/vidjil -G $VIDJIL_DIR/germline/IGH -r 5000 -w 15 same-igh-100k.fa; rm -f same-igh-100k.fa
$ Find a unique clone with all reads
1:>clone-001--IGH--0100000--100.--window
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment