Commit c09e6d0a authored by Ryan Herbert's avatar Ryan Herbert

Merge branch 'vidjil_parser_prototype' of gitlab.inria.fr:vidjil/vidjil into...

Merge branch 'vidjil_parser_prototype' of gitlab.inria.fr:vidjil/vidjil into vidjil_parser_prototype
parents 6a79c7e3 2276f061
......@@ -16,12 +16,21 @@ stages:
- test_functional
- test_functional_external
- test_shouldvdj
- coverage
- prepare_release
- release
- valgrind_unit
- valgrind_functional
- prepare_deploy
- deploy_prod
# Anchors
.coverage_dependency: &lcov_artifact
artifacts:
paths:
- algo/lcov_test_*.filtered
expire_in: 6hrs
# Tools
......@@ -36,7 +45,7 @@ test_germlines:
stage: test_germlines
script:
- make -C germline get-all-data
- make -C germline/tests
- make -C germline tests
only:
- /^feature-.*g.*\/.*$/
......@@ -45,25 +54,34 @@ test_germlines:
test_algo_unit:
stage: test_unit
script: make -C algo unit
only:
- /^feature-.*a.*\/.*$/
test_tools_unit:
stage: test_unit
script: make -C tools/tests
script: make -C algo unit_coverage
<<: *lcov_artifact
only:
- /^feature-.*a.*\/.*$/
test_algo_should:
stage: test_functional
script: make -C algo should
script: make -C algo should_coverage
only:
- /^feature-.*a.*\/.*$/
<<: *lcov_artifact
test_algo_shouldvdj:
stage: test_shouldvdj
script: make -C algo shouldvdj
script: make -C algo shouldvdj_coverage
<<: *lcov_artifact
only:
- /^feature-.*a.*\/.*$/
algo_coverage:
stage: coverage
coverage: /^\s*lines\.*:\s+([0-9.]+\%)/
script:
- make -C algo lcov_reports
- mv algo/reports/ coverage
artifacts:
paths:
- coverage/
only:
- /^feature-.*a.*\/.*$/
......@@ -101,9 +119,53 @@ release:
paths:
- algo/releases/vidjil-algo-`cat algo/release`.tar.gz
- algo/releases/vidjil-algo-`cat algo/release`/vidjil-algo-`cat algo/release`_`uname -m`
allow_failure: false
tags:
- ubuntu-16.04-amd64
copy_release:
stage: prepare_deploy
script:
- |
for repo in $ALGO_REPOSITORIES; do
echo "Copying release to $repo"
scp algo/releases/vidjil-algo*.tar.gz algo/releases/vidjil-algo*/vidjil-algo-*_* $repo
done
release_name=$(cat algo/release)
ssh $VIDJIL_WWW "cd /var/www/html/releases; ln -sf vidjil-algo-${release_name}.tar.gz vidjil-latest.tgz; ln -sf vidjil-algo-${release_name}_x86_64 vidjil-latest_x86_64"
ssh $VIDJIL_BONSAI "cd /bio1/www/html/vidjil; scp vidjil-algo-${release_name}* $VIDJIL_BONSAI_PROD:/bio1/www/html/vidjil"
only:
- /^feature-.*a.*\/release$/
deploy_release_prod:
stage: deploy_prod
only:
- /^feature-.*a.*\/release$/
script:
- |
release_name=$(cat algo/release)
ssh $DEPLOY_SERVER "cd releases/vidjil;\
tar xvzf vidjil-algo-${release_name}.tar.gz;\
make -C vidjil-algo-${release_name};\
ln -sfT vidjil-algo-${release_name} next"
test_various_compilers:
stage: test_functional
only:
- feature-a/test-compilers
tags:
- several-compilers
script:
- |
for CXX in $COMPILERS; do
echo "**** Using $CXX for compilation ****"
make -C algo clean
make -C algo CXX=$CXX unit
make -C algo CXX=$CXX should
make -C algo CXX=$CXX valgrind_unit
done
# Client
test_browser_unit:
......@@ -193,6 +255,7 @@ deploy_review:
stage: deploy_review
script:
- make -C browser icons
- echo "$REVIEW_CONFIG_JS" > browser/js/conf.js
- rsync -av --delete browser $DEPLOY_SERVER:$DEPLOY_SERVER_PATH$CI_BUILD_REF_SLUG
environment:
name: review/$CI_BUILD_REF_NAME
......
sudo: false
language: cpp
compiler: gcc
cache:
apt: true
pip: true
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
- g++-4.8
env: COMPILER=g++-4.8
before_install:
- export PATH="$HOME/.local/bin:$PATH"
- pip install --user cpp-coveralls
before_script: make data ; make germline
script:
- export CXX="g++-4.8"
- g++ --version
- $CXX --version
###
- echo '"Build..."' && echo -en 'travis_fold:start:script.build\\r'
- make
- echo -en 'travis_fold:end:script.build\\r'
###
- echo '"Tests, Algo (unit)..."' && echo -en 'travis_fold:start:script.test-algo-unit\\r'
- make unit
- echo -en 'travis_fold:end:script.test-algo-unit\\r'
###
- echo '"Tests, Algo (functional, .should_get)..."' && echo -en 'travis_fold:start:script.test-algo-functional\\r'
- make COVERAGE=1 should
- echo -en 'travis_fold:end:script.test-algo-functional\\r'
- make clean
###
- echo '"Tests, Algo (functional, .should-vdj.fa)..."' && echo -en 'travis_fold:start:script.test-algo-functional-vdj\\r'
- make shouldvdj
- echo -en 'travis_fold:end:script.test-algo-functional-vdj\\r'
###
- echo '"Tests, Tools..."' && echo -en 'travis_fold:start:script.test-tools\\r'
- make test_tools
- echo -en 'travis_fold:end:script.test-tools\\r'
###
- echo '"Tests, Browser (unit)..."' && echo -en 'travis_fold:start:script.test-browser-unit\\r'
- make unit_browser
- echo -en 'travis_fold:end:script.test-browser-unit\\r'
after_success:
- make should_coveralls COVERALLS_OPTIONS="--gcov /usr/bin/gcov-4.8"
notifications:
email:
- notifications@vidjil.org
webhooks:
- https://buildtimetrend.herokuapp.com/travis
* Vidjil -- High-throughput Analysis of V(D)J Immune Repertoire
# Vidjil – High-throughput Analysis of V(D)J Immune Repertoire
** Algorithm -- Installation instructions
## Algorithm – Installation instructions
#+BEGIN_SRC sh
``` bash
make
./vidjil-algo -h
#+END_SRC
```
Detailed compilation, installation and usage instructions
can be found in [[./doc/algo.org]].
can be found in [./doc/vidjil-algo.md](./doc/vidjil-algo.md).
......@@ -5,6 +5,11 @@ VIDJIL_SERVER_SRC = server/
TEE = python tools/tee.py -v
all:
$(MAKE) germline
$(MAKE) algo
$(MAKE) demo
algo:
$(MAKE) -C algo
......
#+TITLE: Vidjil -- High-throughput Analysis of V(D)J Immune Repertoire
#+AUTHOR: The Vidjil team (Mathieu, Mikaël, Aurélien, Florian, Marc, Ryan and Tatiana)
[[https://travis-ci.org/vidjil/vidjil][https://img.shields.io/travis/vidjil/vidjil/master.svg]]
[[http://opensource.org/licenses/GPL-3.0][http://img.shields.io/badge/license-GPLv3+-green.svg]]
[[https://landscape.io/github/vidjil/vidjil][https://landscape.io/github/vidjil/vidjil/master/landscape.svg?style=flat]]
# https://coveralls.io/r/vidjil/vidjil http://img.shields.io/coveralls/vidjil/vidjil.svg
# Vidjil -- V(D)J recombinations analysis -- [[http://www.vidjil.org]]
# Copyright (C) 2011-2018 by Bonsai bioinformatics at CRIStAL (UMR CNRS 9189, Université Lille) and Inria Lille
# [[contact@vidjil.org]]
[![](https://gitlab.inria.fr/vidjil/vidjil/badges/dev/build.svg)](https://gitlab.inria.fr/vidjil/vidjil/tree/dev)
[![](http://img.shields.io/badge/license-GPLv3+-green.svg)](http://opensource.org/licenses/GPL-3.0)
[<https://landscape.io/github/vidjil/vidjil/master/landscape.svg?style=flat>](https://landscape.io/github/vidjil/vidjil)
V(D)J recombinations in lymphocytes are essential for immunological
diversity. They are also useful markers of pathologies, and in
leukemia, are used to quantify the minimal residual disease during
patient follow-up.
High-throughput sequencing (NGS/HTS) now enables the deep sequencing
of a lymphoid population with dedicated [[http://omictools.com/rep-seq-c424-p1.html][Rep-Seq]] methods and softwares.
High-throughput sequencing (NGS/HTS) now enables the deep sequencing
of a lymphoid population with dedicated [Rep-Seq](http://omictools.com/rep-seq-c424-p1.html) methods and softwares.
The Vidjil platform contains three components.
Vidjil-algo processes high-througput sequencing data to *extract V(D)J
junctions and gather them into clones*. Vidjil-algo starts
The Vidjil platform contains three components.
Vidjil-algo processes high-througput sequencing data to **extract V(D)J
junctions and gather them into clones**. Vidjil-algo starts
from a set of reads and detects "windows" overlapping the actual CDR3.
This is based on an fast and reliable seed-based heuristic and allows
to output all sequenced clones. The analysis is extremely fast
because, in the first phase, no alignment is performed with database
germline sequences.
germline sequences.
The Vidjil *web application* is made for the interactive visualization and
The Vidjil **web application** is made for the interactive visualization and
analysis of clones and their tracking along the time in a MRD setup or
in a immunological study. The web application can visualize data processed by
the Vidjil algorithm or by other V(D)J analysis pipelines, and
enables to explore further cluterings proposed
by software and/or done manually done by the user.
The web application can be linked to a *sample, experiment and patient database*
The web application can be linked to a **sample, experiment and patient database**
able to store sequencing data and metadata, to run RepSeq software
and to save annotations directly from the web application, with authentication.
Clinicians or researchers in immunology or hematology
can manage, upload, analyze and annotate their runs directly on the web applicaiton.
* Vidjil components
# Vidjil components
** Vidjil-algo
## Vidjil-algo
- Stable releases can be downloaded from http://bioinfo.lille.inria.fr/vidjil
- Development code is under [[algo/]]
- Documentation, compilation and installation instructions: [[doc/algo.org]]
- Stable releases can be downloaded from <http://bioinfo.lille.inria.fr/vidjil> and <http://www.vidjil.org/releases>
- Development code is under *algo/*
- Documentation, compilation and installation instructions: *doc/vidjil-algo.md*
** The web application
## The web application
- Access at https://app.vidjil.org/ (demo login: demo@vidjil.org, password: vidjil)
- Please contact us if you would like to test your data and have a full account on the web server
- Development code is under [[browser/]] and [[server/]] (a =make= in those directories
will get the necessary files)
- Documentation is in [[doc/]], it is also available from [[http://www.vidjil.org/doc]]
- Access at <https://app.vidjil.org/> (demo login: demo@vidjil.org, password: vidjil)
- Please contact us if you would like to test your data and have a full account on the web server
- Development code is under *browser/* and *server/* (a `make` in those directories
will get the necessary files)
- Documentation is in *doc/*, it is also available from <http://www.vidjil.org/doc>
* Code and license
# Code and license
Vidjil is open-source, released under GNU GPLv3 license.
You are welcome to redistribute it under [[http://git.vidjil.org/blob/master/doc/LICENSE][certain conditions]].
Vidjil is open-source, released under GNU GPLv3 license.
You are welcome to redistribute it under [certain conditions](http://git.vidjil.org/blob/master/doc/LICENSE).
This software is for research use only and comes with no warranty.
The development code is available on [[http://git.vidjil.org/]].
The development code is available on <http://gitlab.vidjil.org/>.
Bug reports, issues and patches are welcome.
* Donations
# Donations
We welcome Bitcoin donations to [[bitcoin:13u12m6LxVhesKEpS6T5wpYN19LHpwk8xt][13u12m6LxVhesKEpS6T5wpYN19LHpwk8xt]].
Thank you for your support !
We welcome Bitcoin donations to [13u12m6LxVhesKEpS6T5wpYN19LHpwk8xt](bitcoin:13u12m6LxVhesKEpS6T5wpYN19LHpwk8xt).
Thank you for your support \!
* The Vidjil team
# The Vidjil team
Vidjil is developed by Aurélien Béliard, [[http://cristal.univ-lille.fr/~giraud][Mathieu Giraud]], Ryan Herbert, Tatiana Rocher and [[http://cristal.univ-lille.fr/~salson][Mikaël Salson]]
from the [[http://cristal.univ-lille.fr/bonsai][Bonsai bioinformatics team]] (CRIStAL, CNRS, U. Lille, Inria Lille).
Vidjil is developed by Aurélien Béliard, [Mathieu Giraud](http://cristal.univ-lille.fr/~giraud), Ryan Herbert, Tatiana Rocher and [Mikaël Salson](http://cristal.univ-lille.fr/~salson)
from the [Bonsai bioinformatics team](http://cristal.univ-lille.fr/bonsai) (CRIStAL, CNRS, U. Lille, Inria Lille).
Vidjil is also developed by external colleagues:
Marc Duez located in Bristol (School of Social and Community Medicine, University of Bristol)
and Florian Thonier located in Rennes (department of hematology)
Vidjil is developed in collaboration with
the [[http://biologiepathologie.chru-lille.fr/organisation-fbp/91210.html][department of Hematology]] of CHRU Lille,
the [[http://www.ircl.org/plate-forme-genomique.html][Functional and Structural Genomic Platform]] (U. Lille 2, IFR-114, IRCL),
and the [[http://www.euroclonality.org/][EuroClonality-NGS]] working group.
Vidjil is developed in collaboration with
the [department of Hematology](http://biologiepathologie.chru-lille.fr/organisation-fbp/91210.html) of CHRU Lille,
the [Functional and Structural Genomic Platform](http://www.ircl.org/plate-forme-genomique.html) (U. Lille 2, IFR-114, IRCL),
and the [EuroClonality-NGS](http://www.euroclonality.org/) working group.
The research is supported by SIRIC ONCOLille (Grant INCa-DGOS-Inserm 6041), by Région Nord-Pas-de-Calais/Hauts-de-France (ABILES),
by Inria and by InCA.
* References
# References
If you use Vidjil for your research, please cite the following references:
Marc Duez et al.,
“Vidjil: A web platform for analysis of high-throughput repertoire sequencing”,
PLOS ONE 2016, 11(11):e0166126
http://dx.doi.org/10.1371/journal.pone.0166126
<http://dx.doi.org/10.1371/journal.pone.0166126>
Mathieu Giraud, Mikaël Salson, et al.,
“Fast multiclonal clusterization of V(D)J recombinations from high-throughput sequencing”,
BMC Genomics 2014, 15:409
[[http://dx.doi.org/10.1186/1471-2164-15-409]]
BMC Genomics 2014, 15:409
<http://dx.doi.org/10.1186/1471-2164-15-409>
You may also be interested in the following publication for the diagnosis of
acute lymphoblastic leukemia with high-throughput sequencing:
......@@ -102,4 +94,4 @@ acute lymphoblastic leukemia with high-throughput sequencing:
Yann Ferret, Aurélie Caillault, et al., “Multi-loci diagnosis of acute
lymphoblastic leukaemia with high-throughput sequencing and bioinformatics
analysis”, British Journal of Haematology 2016
http://dx.doi.org/10.1111/bjh.13981
<http://dx.doi.org/10.1111/bjh.13981>
......@@ -6,9 +6,19 @@ else
COVERAGE_OPTION=
endif
ifeq ($(CXXFLAGS), )
CXXFLAGS := -W -Wall -std=c++11 -O2 -DNDEBUG
endif
override CXXFLAGS += $(COVERAGE_OPTION) $(DEBUG)
ifeq ($(LDFLAGS),)
LDFLAGS := $(COVERAGE_OPTION)
endif
COV_OUTFILE?=lcov.out
BASE_PATH=$(dir $(abspath .))
OPTIM=-O2 -DNDEBUG $(COVERAGE_OPTION) $(DEBUG)
override CXXFLAGS += -W -Wall -std=c++11 $(OPTIM)
export CXXFLAGS
export LDFLAGS
export CXX
## inspired from http://stackoverflow.com/questions/399850/best-compiler-warning-level-for-c-c-compilers/401276
PARANOID= -Wall -Weffc++ -pedantic \
......@@ -50,7 +60,7 @@ CREATE_VERSION_GIT_H := $(shell test -x ./create-git-version-h.sh && ./create-gi
TEE = python ../tools/tee.py -v
.PHONY: all core lib clean forcedep
.PHONY: all core lib clean forcedep gcovr_reports
all: $(VIDJIL) $(ALIGN_CGI) $(SIMILARITY_CGI) $(SIMILARITY_TOOL)
$(MAKE) -C $(TOOLDIR)
......@@ -63,7 +73,7 @@ static:
###
paranoid: clean
$(MAKE) vidjil OPTIM="$(PARANOID)"
$(MAKE) vidjil CXXFLAGS="$(CXXFLAGS) $(PARANOID)"
###
......@@ -91,17 +101,17 @@ cleanspaced:
$(ALIGN_CGI): cgi/align.o $(LIBCORE)
mkdir -p $(CGIDIR)
$(MAKE) -C core OPTIM="$(OPTIM)"
$(MAKE) -C core
$(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS) $(CXXFLAGS)
$(SIMILARITY_CGI): cgi/similarity.o $(LIBCORE)
mkdir -p $(CGIDIR)
$(MAKE) -C core OPTIM="$(OPTIM)"
$(MAKE) -C core
$(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS) $(CXXFLAGS)
$(SIMILARITY_TOOL): cgi/similarity.o $(LIBCORE)
mkdir -p $(TOOLDIR)
$(MAKE) -C core OPTIM="$(OPTIM)"
$(MAKE) -C core
$(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS) $(CXXFLAGS)
###
......@@ -111,9 +121,9 @@ debug:
$(MAKE) DEBUG="-ggdb"
$(VIDJIL): $(BINDIR)%: $(MAIN).o $(LIBCORE)
$(MAKE) -C core OPTIM="$(OPTIM)"
$(MAKE) -C lib OPTIM="$(OPTIM)"
$(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS) $(CXXFLAGS)
$(MAKE) -C core
$(MAKE) -C lib
$(CXX) -o $@ $^ $(LDFLAGS) $(LDLIBS)
###
# Subdirectories
......@@ -146,7 +156,7 @@ cleanall: cleancoverage
test:
$(MAKE) -C tests cleantests
$(TEE) '$(MAKE) COVERAGE="$(COVERAGE)" unit' tests/out-unit.log
$(TEE) '$(MAKE) unit' tests/out-unit.log
$(MAKE) functional
@echo
@echo "*** All tests passed. Congratulations !"
......@@ -160,24 +170,27 @@ snapshot_diff:
snapshot_diff_current:
$(MAKE) -C tests snapshot_diff_current
unit: all
unit:
$(MAKE) CXXFLAGS="$(filter-out -DNDEBUG, $(CXXFLAGS))" all
@echo "*** Launching unit tests..."
$(MAKE) COVERAGE="$(COVERAGE_OPTION)" -C tests
$(MAKE) -C tests
@echo "*** All unit tests passed"
functional: all
functional:
$(TEE) '$(MAKE) should' tests/out-should-get.log
$(TEE) '$(MAKE) shouldvdj' tests/out-should-vdj.log
should: all
should:
$(MAKE) CXXFLAGS="$(filter-out -DNDEBUG, $(CXXFLAGS))" all
@echo
@echo "*** Launching .should_get tests..."
$(MAKE) COVERAGE="$(COVERAGE_OPTION)" -C tests should
$(MAKE) -C tests should
@echo "*** All .should_get tests passed"
shouldvdj: all
shouldvdj:
@echo
$(MAKE) COVERAGE="$(COVERAGE_OPTION)" -C tests shouldvdj_if_python
$(MAKE) CXXFLAGS="$(filter-out -DNDEBUG, $(CXXFLAGS))" all
$(MAKE) -C tests shouldvdj_if_python
valgrind_unit:
......@@ -192,27 +205,29 @@ valgrind_should:
coverage: unit_coverage should_coverage
unit_coverage: clean
unit_coverage: cleancoverage
$(MAKE) COVERAGE=1 unit
should_coverage: clean
$(MAKE) COV_OUTFILE=lcov_test_unit gencov
should_coverage: cleancoverage
$(MAKE) COVERAGE=1 should
$(MAKE) COV_OUTFILE=lcov_test_should gencov
shouldvdj_coverage: cleancoverage
$(MAKE) COVERAGE=1 shouldvdj
$(MAKE) COV_OUTFILE=lcov_test_shouldvdj gencov
functional_coverage: cleancoverage
$(MAKE) COVERAGE=1 functional
$(MAKE) COV_OUTFILE=lcov_test_functional gencov
### Reports with gcovr
unit_gcovr: unit_coverage
mkdir -p reports
which gcovr > /dev/null && (gcovr -r . -e tests/ --xml > ../reports/unit_coverage.xml) || echo "gcovr is needed to generate a full report"
should_gcovr: should_coverage
mkdir -p reports
which gcovr > /dev/null && (gcovr -r . -e tests/ --xml > ../reports/should_coverage.xml) || echo "gcovr is needed to generate a full report"
gencov:
which lcov > /dev/null || exit 0
lcov --rc geninfo_adjust_src_path="$(BASE_PATH)" -d . -c -o $(COV_OUTFILE)
lcov --remove $(COV_OUTFILE) '/usr/*' '*algo/tests/*' '*algo/lib/*' '*algo/tools/*' -o $(COV_OUTFILE).filtered
### Upload to coveralls.io
unit_coveralls:
coveralls $(COVERALLS_OPTIONS) --exclude release --exclude lib --exclude tests --exclude tools --exclude tests --exclude ../tools --exclude lib --gcov-options '\-lp'
should_coveralls:
coveralls $(COVERALLS_OPTIONS) --exclude release --exclude lib --exclude tests --exclude tools --exclude tests --exclude ../tools --exclude lib --gcov-options '\-lp' -r algo
### Reports with lcov
lcov_reports:
mkdir -p reports
which lcov > /dev/null && (lcov $(addprefix -a ,$(wildcard lcov*.filtered)) | sed 's_^SF:algo_SF:'"$(BASE_PATH)"'/algo_' > lcov_filtered_total.out && genhtml --branch-coverage --legend --output-directory reports/ lcov_filtered_total.out ) || echo "gcovr is needed to generate a full report"
### cppcheck
......@@ -261,9 +276,9 @@ RELEASE_DIR_TMP = releases/tmp
RELEASE_ALGO = src/
RELEASE_TOOLS = $(wildcard ../tools/*.py)
RELEASE_MAKE = ../tools/tests/Makefile ../doc/Makefile
RELEASE_TESTS = ../doc/format-analysis.org $(wildcard ../doc/analysis-example.vidjil) $(wildcard ../tools/tests/*.should_get) ../tools/tests/should-to-tap.sh ../tools/diff_json.sh ../demo/get-sequences ../demo/Demo-X5.fa ../demo/Makefile
RELEASE_GERMLINES = ../germline/Makefile ../germline/germline_id ../germline/get-saved-germline ../germline/get-germline ../germline/split-from-imgt.py $(wildcard ../germline/*.g) ../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 ../README.org ../INSTALL.org
RELEASE_TESTS = ../doc/vidjil-format.md $(wildcard ../doc/analysis-example.vidjil) $(wildcard ../tools/tests/*.should_get) ../tools/should.py ../tools/diff_json.sh ../demo/get-sequences ../demo/Demo-X5.fa ../demo/Makefile
RELEASE_GERMLINES = ../germline/Makefile ../germline/germline_id ../germline/get-saved-germline ../germline/get-germline ../germline/split-from-imgt.py $(wildcard ../germline/*.g) ../germline/revcomp-fasta.py ../germline/fasta.py ../germline/homo-sapiens/IKZF*fa ../germline/homo-sapiens/ERG*fa
RELEASE_HELP = ../doc/vidjil-algo.md ../doc/locus.md ../doc/dev.org ../doc/should-vdj.org ../doc/credits.md ../doc/CHANGELOG ../doc/LICENSE ../README.md ../INSTALL.md
RELEASE_FILES = $(RELEASE_TOOLS) $(RELEASE_TESTS) $(RELEASE_MAKE) $(RELEASE_GERMLINES) $(RELEASE_HELP)
......@@ -297,7 +312,7 @@ release_create:
for file in $(RELEASE_FILES); do\
dir=$(RELEASE_DIR_TMP)/$(RELEASE_NAME)/algo/`dirname "$$file"`/; \
mkdir -p $$dir; \
cp -v "$$file" $$dir/; \
cp -v "$$file" $$dir/ || exit 1; \
done
# A spurious algo/ directory is created, remove it
......
CXX?=g++
OPTIM=-O2
override CXXFLAGS += -W -Wall -std=c++11 $(OPTIM)
ifeq ($(CXXFLAGS), )
CXXFLAGS := -W -Wall -std=c++11 -O2 -DNDEBUG
endif
export CXXFLAGS
INC=-I ../
SRCCORE=$(wildcard *.cpp)
OBJCORE=$(SRCCORE:.cpp=.o)
......
......@@ -140,6 +140,8 @@ affect_infos KmerAffectAnalyser::getMaximum(const KmerAffect &before,
results.first_pos_max = results.last_pos_max = 0;
results.nb_before_left = results.nb_before_right = results.nb_after_right = results.nb_after_left = 0;
currentValue = 0;
int nb_during_max = 0;
bool continue_max;
for (int i = 0; i < min(length,span - maxOverlap); i++) {
if (affectations[i] == after) {
......@@ -151,7 +153,8 @@ affect_infos KmerAffectAnalyser::getMaximum(const KmerAffect &before,
for (int i = span - maxOverlap; i < length; i++) {
/* i - span + maxOverlap, to avoir overlapping k-mers */
continue_max = false;
/* Read the current affectations, and store them both in currentValue and at the right of the previous maximum.
The affectation of 'before' is interpreted relatively to span and maxOverlap */
......@@ -168,18 +171,39 @@ affect_infos KmerAffectAnalyser::getMaximum(const KmerAffect &before,
/* If we raise above the max, or if we continue a previous maximum (even from a distant position), store in results */
if (currentValue >= results.max_value) {
if (currentValue > results.max_value)
if (currentValue > results.max_value) {
results.first_pos_max = i;
// We are above the previous max. We reaffect the ignored affectations
// during the previous plateau.
results.nb_after_left += nb_during_max;
results.nb_before_left += nb_during_max;
nb_during_max = 0;
} else if (results.last_pos_max == i - 1) {
if (affectations[i] == after) {
// in such a case we also have affectations[i - span + maxOverlap] == before
// because we are still on a maximum this means currentValue hasn't changed
assert (affectations[i - span + maxOverlap] == before);
nb_during_max++;
continue_max = true;
}
}
results.max_value = currentValue;
results.last_pos_max = i;
/* What was at the right of the previous maximum is now at the left of the current maximum */
results.nb_after_left += results.nb_after_right;
results.nb_before_left += results.nb_before_right;
if (! continue_max) {
/* What was at the right of the previous maximum is now at the left of
* the current maximum. But we only count them if we are not on a
* plateau. If we later reach a higher maximum they will be counted
* back (see above) */
results.nb_after_left += results.nb_after_right;
results.nb_before_left += results.nb_before_right;
}
results.nb_after_right = 0;
results.nb_before_right = 0;
}
#ifdef DEBUG_GET_MAXIMUM
cout << setw(3) << i
<< " " << affectations[i - span + maxOverlap] << ((affectations[i - span + maxOverlap] == before)?"!":" ")
......
......@@ -22,15 +22,25 @@ typedef enum affect_options_e {
} affect_options_t;
/* Stores results during .getMaximum() computation */
/*
Stores results during .getMaximum() computation
See examples in tests/unit-tests/testAffectAnalyser.cpp:testGetMaximum()
*/
typedef struct affect_infos_s {
// Position of the plateau
int first_pos_max; /* First position of maximum */
int last_pos_max; /* Last position of maximum */
// Value on the plateau
int max_value; /* Maximal value */
// Number of complete affectations at both sides of the plateau
int nb_before_right; /* Nb of “before” right of the maximum */
int nb_after_right; /* Same with “after” */
int nb_before_left; /* Nb of “before” left of the maximum */
int nb_after_left; /* Same with “after” */
bool max_found; /* We have found a maximum */
} affect_infos;
......
......@@ -8,7 +8,7 @@
#include <queue>
#include <utility>
#include "tools.h"
#include <set>
#include <map>
using namespace std;
......@@ -80,6 +80,18 @@ public:
*/
virtual void *next(void *state, char c) = 0;
/**
* This function returns the number of times every Info appears in the
* given sequence.
* It returns a map containing the number of occurences per Info.
* @param seq: The sequence to be queried. It is passed through
* the automaton to identify matching k-mers and extract
* the corresponding Info.
* @param false: unused.
* @param seed: unused.
*/
virtual map<Info,int> getMultiResults
(const seqtype &seq, bool no_revcomp=false, string seed = "") = 0;
};