Commit 125f5d41 authored by marc's avatar marc Committed by Mathieu Giraud
Browse files

unit-tests/testRepresentative.cpp : add windows quality tests

parent e80be55c
......@@ -2,7 +2,7 @@
#include "core/representative.h"
void testRepresentative() {
list<Sequence> reads = Fasta("../../data/representative.fa").getAll();
list<Sequence> reads = Fasta("../../data/representative.fq").getAll();
KmerRepresentativeComputer krc(reads, "##############");
......@@ -35,9 +35,16 @@ void testRepresentative() {
krc.setRequiredSequence("ATCGCGCCCT"); // revcomp
krc.compute();
representative = krc.getRepresentative();
string quality = krc.getQuality();
TAP_TEST(representative.label.find("seq2-[33,52]") == 0, TEST_KMER_REPRESENTATIVE_REQUIRED_SEQ,
"When requiring sequence ATCGCGCCCT, we should have seq2 (" << representative.label << " instead)");
TAP_TEST(representative.sequence.length() == quality.length() ,TEST_KMER_REPRESENTATIVE_QUALITY,
"representative sequence length(" << representative.sequence.length() << ") and quality sequence length(" << quality.length() << ") must be equal");
TAP_TEST(quality == "!!!!!!!>--------<!!!" ,TEST_KMER_REPRESENTATIVE_QUALITY,
"representative quality sequence and seq2 quality must be the same for the required sequence");
krc.setRevcomp(false);
krc.compute();
TAP_TEST(! krc.hasRepresentative(), TEST_KMER_REPRESENTATIVE_REQUIRED_SEQ,
......@@ -52,7 +59,7 @@ void testRepresentative() {
}
void testRevcompRepresentative() {
list<Sequence> reads = Fasta("../../data/representative_revcomp.fa").getAll();
list<Sequence> reads = Fasta("../../data/representative_revcomp.fq").getAll();
KmerRepresentativeComputer krc(reads, "##############");
krc.setOptions(false, 3, 0.5);
......@@ -82,4 +89,4 @@ void testRevcompRepresentative() {
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
......@@ -103,6 +103,7 @@ enum {
TEST_KMER_REPRESENTATIVE,
TEST_KMER_REPRESENTATIVE_REQUIRED_SEQ,
TEST_KMER_REPRESENTATIVE_REVCOMP,
TEST_KMER_REPRESENTATIVE_QUALITY,
/* Kmer segmentation */
TEST_KMER_IS_SEGMENTED,
......@@ -292,6 +293,7 @@ inline void declare_tests() {
RECORD_TAP_TEST(TEST_KMER_REPRESENTATIVE, "Test KmerRepresentativeComputer computations");
RECORD_TAP_TEST(TEST_KMER_REPRESENTATIVE_REQUIRED_SEQ, "Test KmerRepresentativeComputer computations with a required sequence");
RECORD_TAP_TEST(TEST_KMER_REPRESENTATIVE_REVCOMP, "Test KmerRepresentativeComputer computations on a dataset and its revcomp");
RECORD_TAP_TEST(TEST_KMER_REPRESENTATIVE_QUALITY, "Test KmerRepresentativeComputer quality computations");
RECORD_TAP_TEST(TEST_BUG_SEGMENTATION, "Test segmentation bug");
RECORD_TAP_TEST(TEST_SEGMENT_POSITION, "Test V,D,J position");
RECORD_TAP_TEST(TEST_KMER_SEGMENT_OVERLAP, "Test kmer segmentation with an overlap");
......
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