Discover bubbles to pop. */
| 943 | |
| 944 | /** Discover bubbles to pop. */ |
| 945 | size_t NetworkSequenceCollection:: |
| 946 | performNetworkDiscoverBubbles() |
| 947 | { |
| 948 | NetworkSequenceCollection* seqCollection = this; |
| 949 | Timer timer("NetworkDiscoverBubbles"); |
| 950 | |
| 951 | // The branch ids |
| 952 | uint64_t branchGroupID = 0; |
| 953 | m_finishedGroups.clear(); |
| 954 | |
| 955 | // make sure the branch group structure is initially empty |
| 956 | assert(m_activeBranchGroups.empty()); |
| 957 | |
| 958 | size_t count = 0; |
| 959 | |
| 960 | // Set the cutoffs |
| 961 | const unsigned maxNumBranches = 3; |
| 962 | |
| 963 | for (iterator iter = seqCollection->begin(); |
| 964 | iter != seqCollection->end(); ++iter) { |
| 965 | if (iter->second.deleted()) |
| 966 | continue; |
| 967 | |
| 968 | if (++count % 100000 == 0) |
| 969 | logger(1) << "Popping bubbles: " << count << '\n'; |
| 970 | |
| 971 | SymbolSetPair extRec = iter->second.extension(); |
| 972 | for (extDirection dir = SENSE; dir <= ANTISENSE; ++dir) { |
| 973 | if (extRec.dir[dir].isAmbiguous()) { |
| 974 | BranchGroupMap::iterator groupIter |
| 975 | = m_activeBranchGroups.insert( |
| 976 | BranchGroupMap::value_type(branchGroupID, |
| 977 | BranchGroup(dir, maxNumBranches, |
| 978 | iter->first))).first; |
| 979 | BranchGroup& group = groupIter->second; |
| 980 | AssemblyAlgorithms::initiateBranchGroup( |
| 981 | group, iter->first, extRec.dir[dir]); |
| 982 | generateExtensionRequests(branchGroupID++, |
| 983 | group.begin(), group.end()); |
| 984 | } |
| 985 | } |
| 986 | |
| 987 | // Primitive load balancing |
| 988 | if (m_activeBranchGroups.size() > MAX_ACTIVE) { |
| 989 | while (m_activeBranchGroups.size() > LOW_ACTIVE) { |
| 990 | seqCollection->pumpNetwork(); |
| 991 | processBranchesDiscoverBubbles(); |
| 992 | } |
| 993 | } |
| 994 | |
| 995 | processBranchesDiscoverBubbles(); |
| 996 | seqCollection->pumpNetwork(); |
| 997 | } |
| 998 | |
| 999 | // Wait until the groups finish extending. |
| 1000 | while (processBranchesDiscoverBubbles()) |
| 1001 | seqCollection->pumpNetwork(); |
| 1002 | assert(m_activeBranchGroups.empty()); |
nothing calls this directly
no test coverage detected