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

Function addOverlapEdge

MergePaths/MergePaths.cpp:272–310  ·  view source on GitHub ↗

Add an edge if the two paths overlap. * @param pivot the pivot at which to seed the alignment * @return whether an overlap was found */

Source from the content-addressed store, hash-verified

270 * @return whether an overlap was found
271 */
272static bool
273addOverlapEdge(
274 const Lengths& lengths,
275 PathGraph& gout,
276 ContigNode pivot,
277 ContigNode seed1,
278 const ContigPath& path1,
279 ContigNode seed2,
280 const ContigPath& path2)
281{
282 assert(seed1 != seed2);
283
284 // Determine the orientation of the overlap edge.
285 dir_type orientation = DIR_X;
286 ContigPath consensus = align(lengths, path1, path2, pivot, orientation);
287 if (consensus.empty())
288 return false;
289 assert(orientation != DIR_X);
290 if (orientation == DIR_B) {
291 // One of the paths subsumes the other. Use the order of the
292 // seeds to determine the orientation of the edge.
293 orientation = find(consensus.begin(), consensus.end(), seed1) <
294 find(consensus.begin(), consensus.end(), seed2)
295 ? DIR_F
296 : DIR_R;
297 }
298 assert(orientation == DIR_F || orientation == DIR_R);
299
300 // Add the edge.
301 ContigNode u = orientation == DIR_F ? seed1 : seed2;
302 ContigNode v = orientation == DIR_F ? seed2 : seed1;
303 bool added = false;
304#pragma omp critical(gout)
305 if (!edge(u, v, gout).second) {
306 add_edge(u, v, gout);
307 added = true;
308 }
309 return added;
310}
311
312/** Return the specified path. */
313static ContigPath

Callers 2

findPathOverlapsFunction · 0.85
addMissingEdgesFunction · 0.85

Calls 7

findFunction · 0.85
alignFunction · 0.70
edgeFunction · 0.50
add_edgeFunction · 0.50
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected