Pop bubbles. */
| 43 | |
| 44 | /** Pop bubbles. */ |
| 45 | static inline |
| 46 | size_t popBubbles(SequenceCollectionHash* seqCollection, std::ostream& out) |
| 47 | { |
| 48 | typedef SequenceCollectionHash Graph; |
| 49 | typedef graph_traits<Graph>::vertex_descriptor V; |
| 50 | typedef Graph::SymbolSetPair SymbolSetPair; |
| 51 | |
| 52 | Timer timer("PopBubbles"); |
| 53 | size_t numPopped = 0; |
| 54 | |
| 55 | // Set the cutoffs |
| 56 | const unsigned maxNumBranches = 3; |
| 57 | const unsigned maxLength = opt::bubbleLen - V::length() + 1; |
| 58 | |
| 59 | for (Graph::iterator iter = seqCollection->begin(); |
| 60 | iter != seqCollection->end(); ++iter) { |
| 61 | if (iter->second.deleted()) |
| 62 | continue; |
| 63 | |
| 64 | SymbolSetPair extRec = iter->second.extension(); |
| 65 | for (extDirection dir = SENSE; dir <= ANTISENSE; ++dir) { |
| 66 | if (extRec.dir[dir].isAmbiguous()) { |
| 67 | // Found a potential bubble, examine each branch |
| 68 | bool stop = false; |
| 69 | |
| 70 | // Create the branch group |
| 71 | BranchGroup branchGroup(dir, maxNumBranches, |
| 72 | iter->first); |
| 73 | initiateBranchGroup(branchGroup, iter->first, |
| 74 | extRec.dir[dir]); |
| 75 | |
| 76 | // Iterate over the branches |
| 77 | while(!stop) |
| 78 | { |
| 79 | size_t numBranches = branchGroup.size(); |
| 80 | for (unsigned j = 0; j < numBranches; ++j) { |
| 81 | // Get the extensions of this branch |
| 82 | SymbolSetPair extRec; |
| 83 | int multiplicity = -1; |
| 84 | |
| 85 | const V& lastKmer |
| 86 | = branchGroup[j].back().first; |
| 87 | bool success = seqCollection->getSeqData( |
| 88 | lastKmer, extRec, multiplicity); |
| 89 | assert(success); |
| 90 | (void)success; |
| 91 | processBranchGroupExtension(branchGroup, j, |
| 92 | lastKmer, extRec, multiplicity, |
| 93 | maxLength); |
| 94 | } |
| 95 | |
| 96 | // At this point all branches should have the same |
| 97 | // length or one will be a noext. |
| 98 | branchGroup.updateStatus(maxLength); |
| 99 | BranchGroupStatus status |
| 100 | = branchGroup.getStatus(); |
| 101 | if (status == BGS_TOOLONG |
| 102 | || status == BGS_TOOMANYBRANCHES |
nothing calls this directly
no test coverage detected