Commit 84f05fb1 authored by Mikaël Salson's avatar Mikaël Salson
Browse files

kmeraffect.cpp: ambiguity in affectation gives information on the length.

This will be useful for Aho-Corasick automaton to put
the affectation at the right place.
parent abc94220
......@@ -117,15 +117,17 @@ KmerAffect &KmerAffect::operator+=(const KmerAffect &kmer) {
if (isUnknown())
*this = kmer;
else if (affect_char(affect) == affect_char(kmer.affect)
&& (affect_strand(affect) != affect_strand(kmer.affect)))
&& (affect_strand(affect) != affect_strand(kmer.affect))) {
// Same label but different strand
// -> we put ambiguous, we could have something to say that
// strand is ambiguous but not the label, but we don't have enough space
// in 1 byte…
*this = AFFECT_AMBIGUOUS;
else {
affect.length = kmer.getLength();
} else {
assert(affect.c != kmer.affect.c || getLength() == kmer.getLength());
*this = AFFECT_AMBIGUOUS;
affect.length = kmer.getLength();
}
}
return *this;
......
......@@ -112,6 +112,7 @@ void testKmerAffectClass() {
TAP_TEST(unknown.isAmbiguous(), TEST_KMERAFFECT_AMBIGUOUS, "");
TAP_TEST(unknown.getLabel() == AFFECT_AMBIGUOUS_SYMBOL, TEST_KMERAFFECT_LABEL, "");
TAP_TEST(unknown.getStrand() == 0, TEST_KMERAFFECT_STRAND, "");
TAP_TEST(unknown.getLength() == 4, TEST_KMERAFFECT_AMBIGUOUS, "");
TAP_TEST(KAVp.getStrand() == 1, TEST_KMERAFFECT_STRAND, "");
TAP_TEST(KAVm.getStrand() == -1, TEST_KMERAFFECT_STRAND, "");
......
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