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

Function removable

FilterGraph/FilterGraph.cc:203–263  ·  view source on GitHub ↗

Returns if the contig can be removed from the graph. */

Source from the content-addressed store, hash-verified

201
202/** Returns if the contig can be removed from the graph. */
203static bool
204removable(const Graph* pg, vertex_descriptor v)
205{
206 typedef graph_traits<Graph> GTraits;
207 typedef GTraits::out_edge_iterator OEit;
208 typedef GTraits::in_edge_iterator IEit;
209 typedef GTraits::vertex_descriptor V;
210
211 const Graph& g = *pg;
212
213 // Check if previously removed
214 if (get(vertex_removed, g, v)) {
215 g_count.removed++;
216 return false;
217 }
218
219 unsigned min_degree = min(out_degree(v, g), in_degree(v, g));
220
221 // Check for tails
222 if (min_degree == 0) {
223 g_count.tails++;
224 return false;
225 }
226
227 // Check that the result will be less complex that the original
228 if (min_degree > opt::shimMaxDegree) {
229 g_count.too_complex++;
230 return false;
231 }
232
233 // Check if self adjacent
234 OEit oei0, oei1;
235 tie(oei0, oei1) = out_edges(v, g);
236 for (OEit vw = oei0; vw != oei1; ++vw) {
237 V w = target(*vw, g);
238 V vc = get(vertex_complement, g, v);
239 if (v == w || vc == w) {
240 g_count.self_adj++;
241 return false;
242 }
243 }
244
245 // Check that removing the contig will result in adjacent contigs
246 // overlapping by at least opt::minOverlap.
247 IEit iei0, iei1;
248 tie(iei0, iei1) = in_edges(v, g);
249 IEit maxuv = iei0;
250 for (IEit uv = iei0; uv != iei1; ++uv)
251 if (g[*maxuv].distance < g[*uv].distance)
252 maxuv = uv;
253 OEit maxvw = oei0;
254 for (OEit vw = oei0; vw != oei1; ++vw)
255 if (g[*maxvw].distance < g[*vw].distance)
256 maxvw = vw;
257
258 if (g[*maxuv].distance + (int)g[v].length + g[*maxvw].distance > -opt::minOverlap) {
259 g_count.too_long++;
260 return false;

Callers 1

removeContigsFunction · 0.85

Calls 5

getFunction · 0.50
out_degreeFunction · 0.50
in_degreeFunction · 0.50
out_edgesFunction · 0.50
in_edgesFunction · 0.50

Tested by

no test coverage detected