| 10 | using namespace std; |
| 11 | |
| 12 | TEST(LoadAlgorithmTest, base) |
| 13 | { |
| 14 | typedef SequenceCollectionHash Graph; |
| 15 | Graph g; |
| 16 | |
| 17 | // length of each kmer in kmer pair |
| 18 | Kmer::setLength(2); |
| 19 | // space between kmer pair |
| 20 | unsigned delta = 2; |
| 21 | // the length of both kmers plus the gap |
| 22 | KmerPair::setLength(Kmer::length() * 2 + delta); |
| 23 | |
| 24 | // see test.png for an image of the paired |
| 25 | // de Bruijn graph for this sequence |
| 26 | Sequence seq("TAATGCCATGGGATGTT"); |
| 27 | |
| 28 | AssemblyAlgorithms::loadSequence(&g, seq); |
| 29 | |
| 30 | unordered_set<KmerPair> kmerPairs, expectedKmerPairs; |
| 31 | |
| 32 | expectedKmerPairs.insert(KmerPair("TAGC")); |
| 33 | expectedKmerPairs.insert(KmerPair("AACC")); |
| 34 | expectedKmerPairs.insert(KmerPair("ATCA")); |
| 35 | expectedKmerPairs.insert(KmerPair("GCTG")); |
| 36 | expectedKmerPairs.insert(KmerPair("CCGG")); |
| 37 | expectedKmerPairs.insert(KmerPair("CAGG")); |
| 38 | expectedKmerPairs.insert(KmerPair("ATGA")); |
| 39 | expectedKmerPairs.insert(KmerPair("GGTG")); |
| 40 | expectedKmerPairs.insert(KmerPair("GGGT")); |
| 41 | expectedKmerPairs.insert(KmerPair("GATT")); |
| 42 | |
| 43 | for (Graph::const_iterator it = g.begin(); it != g.end(); ++it) { |
| 44 | KmerPair kmerPair(it->first); |
| 45 | #if 0 |
| 46 | cerr << "visiting KmerPair: " << kmerPair << "\n"; |
| 47 | #endif |
| 48 | ASSERT_TRUE(expectedKmerPairs.find(kmerPair) != expectedKmerPairs.end()); |
| 49 | expectedKmerPairs.erase(kmerPair); |
| 50 | } |
| 51 | |
| 52 | ASSERT_TRUE(expectedKmerPairs.empty()); |
| 53 | } |