Commit 6e0e4ff9 authored by Mikael Salson's avatar Mikael Salson

AffectAnalyser: Change default value for maxOverlap in getMaximum.

When the k-mer ends at the position we're considering, it
should be taken into account by default.
parent 1aa8e748
......@@ -144,6 +144,8 @@ class KmerAffectAnalyser: public AffectAnalyser<T> {
set<T> getDistinctAffectations() const;
/**
* @param maxOverlap: if greater than kms.getS(), it is automatically set
* to that value.
* @return A structure where the maximum is such that those positions
* maximise the number of affectations before, minus the number of
* affectations after the returned positions.
......@@ -158,7 +160,7 @@ class KmerAffectAnalyser: public AffectAnalyser<T> {
*/
affect_infos getMaximum(const T &before, const T &after,
float ratioMin=2.,
int maxOverlap=0) const;
int maxOverlap=1) const;
const string &getSequence() const;
......@@ -334,8 +336,8 @@ affect_infos KmerAffectAnalyser<T>::getMaximum(const T &before,
int length = count();
affect_infos results;
assert(maxOverlap <= span);
if (maxOverlap > span)
maxOverlap = span;
results.max_found = false;
results.max_value = 0;
......
......@@ -141,12 +141,12 @@ void testGetMaximum() {
vector<KmerAffect> affectations(a, a+sizeof(a)/sizeof(KmerAffect));
KmerAffectAnalyser<KmerAffect> kaa(*index, "", affectations);
affect_infos results = kaa.getMaximum(AFFECT_J_BWD, AFFECT_V_BWD);
affect_infos results = kaa.getMaximum(AFFECT_J_BWD, AFFECT_V_BWD, 2., 0);
TAP_TEST(! results.max_found, TEST_AA_GET_MAXIMUM_MAX_FOUND,
"(" << results.first_pos_max
<< ", " << results.last_pos_max << ")");
results = kaa.getMaximum(AFFECT_J_BWD, AFFECT_V_BWD, 1.);
results = kaa.getMaximum(AFFECT_J_BWD, AFFECT_V_BWD, 1., 0);
TAP_TEST(results.max_found ,
TEST_AA_GET_MAXIMUM_MAX_FOUND, "(" << results.first_pos_max
<< ", " << results.last_pos_max << ")");
......@@ -176,7 +176,7 @@ void testGetMaximum() {
// V+V+V+V+V+V+V+V+V+V+J+J+J+V+V+V+
vector<KmerAffect> affectations2(a2, a2+sizeof(a2)/sizeof(KmerAffect));
KmerAffectAnalyser<KmerAffect> kaa2(*index, "", affectations2);
results = kaa2.getMaximum(AFFECT_V, AFFECT_J);
results = kaa2.getMaximum(AFFECT_V, AFFECT_J, 2., 0);
TAP_TEST(! results.max_found,
TEST_AA_GET_MAXIMUM_MAX_FOUND, "(" << results.first_pos_max
<< ", " << results.last_pos_max << ")");
......@@ -224,7 +224,7 @@ void testGetMaximum() {
// V+V+V+V+V+V+V+V+V+V+ _ _ _ _ _ _J-J-V+J-
vector<KmerAffect> affectations3(a3, a3+sizeof(a3)/sizeof(KmerAffect));
KmerAffectAnalyser<KmerAffect> kaa3(*index, "", affectations3);
results = kaa3.getMaximum(AFFECT_V, AFFECT_J);
results = kaa3.getMaximum(AFFECT_V, AFFECT_J, 2., 0);
TAP_TEST(results.max_found, TEST_AA_GET_MAXIMUM_MAX_FOUND,
"max_found = " << results.max_found);
......
Markdown is supported
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