MCPcopy Create free account
hub / github.com/BirolLab/abyss / trimSequences

Function trimSequences

Assembly/TrimAlgorithm.h:37–99  ·  view source on GitHub ↗

Prune tips shorter than maxBranchCull. */

Source from the content-addressed store, hash-verified

35
36/** Prune tips shorter than maxBranchCull. */
37static inline
38size_t trimSequences(SequenceCollectionHash* seqCollection,
39 unsigned maxBranchCull)
40{
41 typedef SequenceCollectionHash Graph;
42 typedef graph_traits<Graph>::vertex_descriptor V;
43 typedef Graph::SymbolSetPair SymbolSetPair;
44
45 Timer timer("TrimSequences");
46 std::cout << "Pruning tips shorter than "
47 << maxBranchCull << " bp...\n";
48 size_t numBranchesRemoved = 0;
49
50 for (Graph::iterator iter = seqCollection->begin();
51 iter != seqCollection->end(); ++iter) {
52 if (iter->second.deleted())
53 continue;
54
55 extDirection dir;
56 // dir will be set to the trimming direction if the sequence
57 // can be trimmed.
58 SeqContiguity status = checkSeqContiguity(*iter, dir);
59
60 if (status == SC_CONTIGUOUS)
61 continue;
62 else if(status == SC_ISLAND)
63 {
64 // remove this sequence, it has no extensions
65 seqCollection->mark(iter->first);
66 numBranchesRemoved++;
67 continue;
68 }
69
70 BranchRecord currBranch(dir);
71 V currSeq = iter->first;
72 while(currBranch.isActive())
73 {
74 SymbolSetPair extRec;
75 int multiplicity = -1;
76 bool success = seqCollection->getSeqData(
77 currSeq, extRec, multiplicity);
78 assert(success);
79 (void)success;
80 processLinearExtensionForBranch(currBranch,
81 currSeq, extRec, multiplicity, maxBranchCull);
82 }
83
84 // The branch has ended check it for removal, returns true if
85 // it was removed.
86 if(processTerminatedBranchTrim(seqCollection, currBranch))
87 {
88 numBranchesRemoved++;
89 }
90 seqCollection->pumpNetwork();
91 }
92
93 size_t numSweeped = removeMarked(seqCollection);
94

Callers 1

performTrimFunction · 0.85

Calls 11

checkSeqContiguityFunction · 0.85
removeMarkedFunction · 0.85
deletedMethod · 0.80
getSeqDataMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
markMethod · 0.45
isActiveMethod · 0.45
pumpNetworkMethod · 0.45

Tested by

no test coverage detected