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

Function checkEdgeForOverlap

Overlap/Overlap.cpp:275–327  ·  view source on GitHub ↗

* Check for an overlap between the specified pair of contigs. * Add the size of the overlap to the edge properties. Add the * complementary edge if it does not exist in the graph. * @param goverlap the contig overlap graph * @param g the scaffold graph * @return true if the contigs overlap */

Source from the content-addressed store, hash-verified

273 * @return true if the contigs overlap
274 */
275static bool checkEdgeForOverlap(const Graph& goverlap,
276 OverlapGraph& g,
277 graph_traits<OverlapGraph>::edge_descriptor e)
278{
279 typedef graph_traits<Graph>::vertex_descriptor V;
280 typedef graph_traits<Graph>::edge_descriptor E;
281 typedef edge_bundle_type<OverlapGraph>::type EP;
282
283 V u = source(e, g), v = target(e, g);
284 V uc = get(vertex_complement, g, u);
285 V vc = get(vertex_complement, g, v);
286 assert(u != v);
287 assert(u != vc);
288 EP& ep = g[e];
289 if (ep.overlap != UINT_MAX) {
290 // Found the complementary overlap.
291 return ep.overlap > 0 || opt::scaffold;
292 }
293 if (ep.distance >= 0 && !opt::scaffold) {
294 // Positive distance estimate and not scaffolding.
295 return false;
296 }
297 if (out_degree(u, goverlap) > 0 || in_degree(v, goverlap) > 0) {
298 // Not blunt.
299 return false;
300 }
301
302 bool mask = false;
303 unsigned overlap
304 = ep.distance - (int)allowedError(ep.stdDev) <= 0
305 ? findOverlap(goverlap, u, v, mask) : 0;
306 if (mask && !opt::mask) {
307 // Ambiguous overlap.
308 return false;
309 }
310 if (overlap == 0 && !opt::scaffold) {
311 // No overlap and not scaffolding.
312 return false;
313 }
314 ep.overlap = overlap;
315 ep.mask = mask;
316 pair<E, bool> ecomplement = edge(vc, uc, g);
317 if (ecomplement.second) {
318 // Modify the complementary edge.
319 g[ecomplement.first] = ep;
320 } else {
321 // Add the complementary edge.
322 assert(vc != u);
323 add_edge(vc, uc, ep,
324 static_cast<OverlapGraph::base_type&>(g));
325 }
326 return true;
327}
328
329static void findOverlap(const Graph& g,
330 ContigID refID, bool rc,

Callers

nothing calls this directly

Calls 7

allowedErrorFunction · 0.85
findOverlapFunction · 0.70
getFunction · 0.50
out_degreeFunction · 0.50
in_degreeFunction · 0.50
edgeFunction · 0.50
add_edgeFunction · 0.50

Tested by

no test coverage detected