Distributed trimming function. */
| 848 | |
| 849 | /** Distributed trimming function. */ |
| 850 | size_t NetworkSequenceCollection::performNetworkTrim() |
| 851 | { |
| 852 | Timer timer("NetworkTrim"); |
| 853 | NetworkSequenceCollection* seqCollection = this; |
| 854 | size_t numBranchesRemoved = 0; |
| 855 | |
| 856 | // The branch ids |
| 857 | uint64_t branchGroupID = 0; |
| 858 | |
| 859 | for (iterator iter = seqCollection->begin(); |
| 860 | iter != seqCollection->end(); ++iter) { |
| 861 | if (iter->second.deleted()) |
| 862 | continue; |
| 863 | |
| 864 | extDirection dir; |
| 865 | // dir will be set to the trimming direction if the sequence |
| 866 | // can be trimmed. |
| 867 | SeqContiguity status = AssemblyAlgorithms::checkSeqContiguity( |
| 868 | *iter, dir); |
| 869 | if (status == SC_CONTIGUOUS) |
| 870 | continue; |
| 871 | else if(status == SC_ISLAND) |
| 872 | { |
| 873 | seqCollection->mark(iter->first); |
| 874 | numBranchesRemoved++; |
| 875 | continue; |
| 876 | } |
| 877 | |
| 878 | bool inserted = m_activeBranchGroups.insert( |
| 879 | BranchGroupMap::value_type(branchGroupID, |
| 880 | BranchGroup(dir, 1, iter->first, |
| 881 | BranchRecord(dir)))) |
| 882 | .second; |
| 883 | assert(inserted); |
| 884 | (void)inserted; |
| 885 | |
| 886 | generateExtensionRequest(branchGroupID, 0, iter->first); |
| 887 | branchGroupID++; |
| 888 | numBranchesRemoved += processBranchesTrim(); |
| 889 | seqCollection->pumpNetwork(); |
| 890 | |
| 891 | // Primitive load balancing |
| 892 | if(m_activeBranchGroups.size() > MAX_ACTIVE) |
| 893 | { |
| 894 | while(m_activeBranchGroups.size() > LOW_ACTIVE) |
| 895 | { |
| 896 | seqCollection->pumpNetwork(); |
| 897 | numBranchesRemoved += processBranchesTrim(); |
| 898 | } |
| 899 | } |
| 900 | } |
| 901 | |
| 902 | // Clear out the remaining branches |
| 903 | while(!m_activeBranchGroups.empty()) |
| 904 | { |
| 905 | numBranchesRemoved += processBranchesTrim(); |
| 906 | seqCollection->pumpNetwork(); |
| 907 | } |
nothing calls this directly
no test coverage detected