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

Function assembleContigs

RResolver/Contigs.cpp:195–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195void
196assembleContigs()
197{
198 if (opt::verbose) {
199 std::cerr << "Assembling contigs... ";
200 }
201
202 std::vector<std::string> pathIDs;
203 ContigPaths paths;
204
205 Graph newContigGraph(g_contigGraph);
206 assemble(newContigGraph, back_inserter(paths));
207 assert(num_vertices(newContigGraph) >= num_vertices(g_contigGraph));
208
209 // Record all the contigs that are in a path.
210 std::vector<bool> seen(g_contigGraph.num_vertices() / 2);
211
212 g_contigNames.unlock();
213 int counter = 0;
214 for (const auto& path : paths) {
215 assert(!path.empty());
216 ContigNode pathNode(g_contigGraph.num_vertices() / 2 + counter, path[0].sense());
217 std::string name = createContigName();
218 pathIDs.push_back(name);
219 put(vertex_name, newContigGraph, pathNode, name);
220 for (const auto& node : path) {
221 seen[node.id()] = true;
222 }
223 counter++;
224 }
225 g_contigNames.lock();
226
227 for (const auto& path : paths) {
228 assert(!path.empty());
229 Sequence sequence = getPathSequence(path);
230 unsigned coverage = 0;
231 for (const auto& node : path) {
232 if (!node.ambiguous()) {
233 coverage += g_contigGraph[node].coverage;
234 }
235 }
236
237 std::stringstream ss;
238 ss << sequence.size() << ' ' << coverage << ' ';
239 ss << get(vertex_name, g_contigGraph, path.front());
240 if (path.size() == 1)
241 return;
242 else if (path.size() == 3)
243 ss << ',' << get(vertex_name, g_contigGraph, path[1]);
244 else if (path.size() > 3)
245 ss << ",...";
246 ss << ',' << get(vertex_name, g_contigGraph, path.back());
247
248 g_contigSequences.push_back(sequence);
249 g_contigSequences.push_back(reverseComplement(sequence));
250 g_contigComments.push_back(ss.str());
251 }
252

Callers 1

resolveShortFunction · 0.85

Calls 15

createContigNameFunction · 0.85
getPathSequenceFunction · 0.85
unlockMethod · 0.80
senseMethod · 0.80
idMethod · 0.80
lockMethod · 0.80
ambiguousMethod · 0.80
assembleFunction · 0.50
num_verticesFunction · 0.50
putFunction · 0.50
getFunction · 0.50
reverseComplementFunction · 0.50

Tested by

no test coverage detected