Commit 6dd6c7ac authored by Mathieu Giraud's avatar Mathieu Giraud

Merge branch 'feature-a/small-fixes-from-one-heuristic' into 'dev'

Feature a/small fixes

See merge request !677
parents 357b51fc 0f43398e
Pipeline #140900 failed with stages
in 8 minutes and 34 seconds
......@@ -44,13 +44,15 @@ bool operator==(const affect_t &a1, const affect_t &a2) {
|| a1.length == (unsigned char) ~0 || a2.length == (unsigned char)~0 || a1.length == a2.length);
}
bool operator<(const affect_t &a1, const affect_t &a2) {
return a1.c < a2.c;
return a1.c < a2.c
|| (a1.c == a2.c && a1.length < a2.length
&& affect_char(a1) != AFFECT_AMBIGUOUS_CHAR && affect_char(a1) != AFFECT_UNKNOWN_CHAR);
}
bool operator>(const affect_t &a1, const affect_t &a2) {
return a1.c > a2.c;
return ! (a1 <= a2);
}
bool operator<=(const affect_t &a1, const affect_t &a2) {
return ! (a1 > a2);
return (a1 < a2) || (a1 == a2);
}
bool operator>=(const affect_t &a1, const affect_t &a2) {
return ! (a1 < a2);
......
......@@ -51,7 +51,7 @@ test: all
cat ./unit-tests/tests.cpp.tap
@echo "*** All unit tests passed"
all: core $(EXEC)
all: $(EXEC)
@echo "All tests compiled."
snapshot:
......@@ -133,8 +133,8 @@ valgrind_%:
valgrind_tests: vidjil ./unit-tests/tests
$(VALGRIND_CMD) ./unit-tests/tests
$(EXEC): % : %.o $(LIB)
$(CXX) -o $@ $< $(LIB) $(LDLIBS) $(LDFLAGS) $(CXXFLAGS)
$(EXEC): % : core %.o $(LIB)
$(CXX) -o $@ $@.o $(LIB) $(LDLIBS) $(LDFLAGS) $(CXXFLAGS)
../%.a:
......
......@@ -146,8 +146,8 @@ void testAffectAnalyser2() {
TAP_TEST(kaa.getDistinctAffectations().size() == 3, TEST_AA_GET_DISTINCT_AFFECT, "");
TAP_TEST(ckaa.max(forbidden) == KmerAffect(seq[2*(nb_seq-1)+1], -1, k),
TEST_COUNT_AA_MAX, "max is " << ckaa.max(forbidden));
TAP_TEST_EQUAL(ckaa.max(forbidden), KmerAffect(seq[2*(nb_seq-1)+1], -1, k),
TEST_COUNT_AA_MAX, "");
TAP_TEST(ckaa.max() == KmerAffect::getUnknown(),
TEST_COUNT_AA_MAX, "max is " << ckaa.max());
......
......@@ -62,6 +62,7 @@ void testGetMultiResults(){
char c = 'a';
for(int i = 0; i < 10; ++i){
affect[i].c = c;
affect[i].length = 0;
c++;
}
seqs[0] = "AGCTCT";
......
......@@ -57,6 +57,7 @@ void testRepresentative() {
void testRevcompRepresentative() {
list<Sequence> reads = BioReader("data/representative_revcomp.fq").getAll();
srand(1);
KmerRepresentativeComputer krc(reads, "##############");
krc.setOptions(false, 3, 0.5);
krc.setCoverageReferenceLength(50);
......@@ -69,6 +70,7 @@ void testRevcompRepresentative() {
it->sequence = revcomp(it->sequence);
}
srand(1);
KmerRepresentativeComputer krc2(reads, "##############");
krc2.setOptions(false, 3, 0.5);
krc2.setCoverageReferenceLength(50);
......@@ -81,10 +83,10 @@ void testRevcompRepresentative() {
size_t pos1 = representative.label.find_first_of('[');
size_t pos2 = representative2.label.find_first_of('[');
TAP_TEST(representative.label.substr(0, pos1) == representative2.label.substr(0, pos2), TEST_KMER_REPRESENTATIVE_REVCOMP,
TAP_TEST_EQUAL(representative.label.substr(0, pos1), representative2.label.substr(0, pos2), TEST_KMER_REPRESENTATIVE_REVCOMP,
"The two representatives should have the same label");
TAP_TEST(revcomp(representative.sequence) == representative2.sequence, TEST_KMER_REPRESENTATIVE_REVCOMP,
"The two representatives should have the same sequence (but revcomp-ed)");
}
\ No newline at end of file
}
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