Commit ae223f5f authored by Mathieu Giraud's avatar Mathieu Giraud Committed by Mikaël Salson

tests: testGermline.cpp, some tests on germlines and seeds

parent ac142f8d
#include <fstream>
#include <iostream>
#include <string>
#include "core/germline.h"
#include "core/kmerstore.h"
#include "core/bioreader.hpp"
using namespace std;
void testGermline1(Germline *g1)
{
// Test metadata
TAP_TEST_EQUAL(g1->code, "IGH", TEST_GERMLINE, "code") ;
TAP_TEST_EQUAL(g1->shortcut, 'G', TEST_GERMLINE, "shortcut") ;
// Test seeds
TAP_TEST_EQUAL(g1->seed_5, "####-####", TEST_GERMLINE, "seed_5") ;
TAP_TEST_EQUAL(g1->seed_4, "###-###", TEST_GERMLINE, "seed_4") ;
TAP_TEST_EQUAL(g1->seed_3, "#######", TEST_GERMLINE, "seed_3") ;
}
void testIndexLoad(Germline *g1, IndexTypes index, float expected_index_load)
{
g1->new_index(index);
g1->finish();
size_t seed_5_span = g1->seed_5.size();
float index_load_5 = g1->index->getIndexLoad(KmerAffect(g1->affect_5, 1, seed_5_span));
TAP_TEST_APPROX(index_load_5, expected_index_load, 0.02, TEST_GERMLINE, "seed_5, index_load") ;
}
void testGermline() {
BioReader seqV("../../germline/homo-sapiens/IGHV.fa", 2);
BioReader seqD("../../germline/homo-sapiens/IGHD.fa", 2);
BioReader seqJ("../../germline/homo-sapiens/IGHJ.fa", 2);
Germline *g1 ;
g1 = new Germline("IGH", 'G', seqV, seqD, seqJ,
"8s", "###-###", "7c");
testGermline1(g1);
testIndexLoad(g1, KMER_INDEX, 0.24);
testIndexLoad(g1, AC_AUTOMATON, 0.12);
delete g1;
}
......@@ -4,6 +4,7 @@
#include "testTools.cpp"
#include "testFilter.cpp"
#include "testKmerAffect.cpp"
#include "testGermline.cpp"
#include "testStorage.cpp"
#include "testAffectAnalyser.cpp"
#include "testBugs.cpp"
......@@ -23,6 +24,7 @@ int main(void) {
declare_tests();
testTools();
testFilter();
testGermline();
testStorage();
testKmerAffect();
testAffectAnalyser();
......
......@@ -46,6 +46,9 @@ enum {
TEST_TRIM_SEQUENCE,
TEST_GENERATE_ALL_SEEDS,
/* Germline tests */
TEST_GERMLINE,
/* Storage tests */
TEST_ARRAY_KMERSTORE,
TEST_MAP_KMERSTORE,
......
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