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

Tests: test getIndexLoad and getProbabilityAtLeastOrAbove()

parent ccf019aa
......@@ -261,9 +261,57 @@ void testExtractor() {
delete multi;
}
void testProbability() {
string v_seq[] = {"AAAA", "AAAC", "AAAG", "AAAT", "AACA", "AACC",
"AACG", "AACT", "AAGA", "AAGC", "AAGG", "AAGT",
"AATA", "AATC", "AATG", "AATT", "ACAA", "ACAC",
"ACAG", "ACAT", "ACCA", "ACCC", "ACCG", "ACCT",
"ACGA", "ACGC", "ACGG", "ACGT", "ACTA", "ACTC",
"ACTG", "ACTT", "AGAA", "AGAC", "AGAG", "AGAT",
"AGCA", "AGCC", "AGCG", "AGCT", "AGGA", "AGGC",
"AGGG", "AGGT", "AGTA", "AGTC", "AGTG", "AGTT",
"ATAA", "ATAC", "ATAG", "ATAT", "ATCA", "ATCC",
"ATCG", "ATCT", "ATGA", "ATGC", "ATGG", "ATGT",
"ATTA", "ATTC", "ATTG", "ATTT"};
string j_seq[] = {"CAAA", "CAAC",
"CAAG", "CAAT", "CACA", "CACC", "CACG", "CACT",
"CAGA", "CAGC", "CAGG", "CAGT", "CATA", "CATC",
"CATG", "CATT", "CCAA", "CCAC", "CCAG", "CCAT",
"CCCA", "CCCC", "CCCG", "CCCT", "CCGA", "CCGC",
"CCGG", "CCGT", "CCTA", "CCTC", "CCTG", "CCTT",
"CGAA", "CGAC", "CGAG", "CGAT", "CGCA", "CGCC",
"CGCG", "CGCT", "CGGA", "CGGC", "CGGG", "CGGT",
"CGTA", "CGTC", "CGTG", "CGTT", "CTAA", "CTAC",
"CTAG", "CTAT", "CTCA", "CTCC", "CTCG", "CTCT",
"CTGA", "CTGC", "CTGG", "CTGT", "CTTA", "CTTC",
"CTTG", "CTTT"};
Fasta V, J;
for (int i = 0; i < 64; i++) {
Sequence v = {"V_"+(i+33), "V"+(i+33), v_seq[i], "", NULL};
Sequence j = {"J_"+(i+33), "J"+(i+33), j_seq[i], "", NULL};
V.add(v);
J.add(j);
}
Germline germline("Test", 'T', V, Fasta(), J, 0, 30);
germline.new_index("####");
TAP_TEST(germline.index->getIndexLoad() == .75, TEST_GET_INDEX_LOAD, "");
Sequence seq = {"to_segment", "to_segment", "TATCG", "", NULL};
KmerSegmenter kseg(seq, &germline);
TAP_TEST(kseg.getProbabilityAtLeastOrAbove(2) == .75 * .75, TEST_PROBABILITY_SEGMENTATION, "");
TAP_TEST(kseg.getProbabilityAtLeastOrAbove(1) == .75 * 2 * .25 + kseg.getProbabilityAtLeastOrAbove(2),
TEST_PROBABILITY_SEGMENTATION, "");
TAP_TEST(kseg.getProbabilityAtLeastOrAbove(0) == 1, TEST_PROBABILITY_SEGMENTATION, "");
}
void testSegment() {
testFineSegment();
testSegmentOverlap();
testSegmentationCause();
testExtractor();
testProbability();
}
......@@ -35,6 +35,7 @@ enum {
TEST_KMERSTORE_GET_S,
TEST_KMERSTORE_GET_SEED,
TEST_KMERSTORE_INSERT_ONE_SEQ,
TEST_GET_INDEX_LOAD,
/* KmerAffect */
TEST_AFFECT_STRAND,
......@@ -106,6 +107,7 @@ enum {
TEST_KMER_DATA,
TEST_KMER_LEFT,
TEST_KMER_RIGHT,
TEST_PROBABILITY_SEGMENTATION,
/* WindowExtractor */
TEST_EXTRACTOR_NB_READS,
......@@ -183,6 +185,7 @@ inline void declare_tests() {
RECORD_TAP_TEST(TEST_KMERSTORE_GET_K, "Testing getK() in KmerStore");
RECORD_TAP_TEST(TEST_KMERSTORE_GET_S, "Testing getK() in KmerStore");
RECORD_TAP_TEST(TEST_KMERSTORE_GET_SEED, "Testing getK() in KmerStore");
RECORD_TAP_TEST(TEST_GET_INDEX_LOAD, "Testing getIndexLoad() in KmerStore");
RECORD_TAP_TEST(TEST_AFFECT_STRAND, "affect_strand()");
RECORD_TAP_TEST(TEST_AFFECT_CHAR, "affect_char()");
......@@ -243,6 +246,7 @@ inline void declare_tests() {
RECORD_TAP_TEST(TEST_KMER_DATA, "Test that data is consistent with what we expect for KmerSegmenter");
RECORD_TAP_TEST(TEST_KMER_LEFT, "Test V end (resp. J start) with KmerSegmenter on fwd (resp bwd) strand");
RECORD_TAP_TEST(TEST_KMER_RIGHT, "Test J start (resp. V end) with KmerSegmenter on fwd (resp bwd) strand");
RECORD_TAP_TEST(TEST_PROBABILITY_SEGMENTATION, "Test getProbabilityAtLeastOrAbove()");
RECORD_TAP_TEST(TEST_EXTRACTOR_NB_READS, "Test getNbReads() in WindowExtractor");
RECORD_TAP_TEST(TEST_EXTRACTOR_NB_SEGMENTED, "Test getNbSegmented() in WindowsExtractor");
......
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