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

Function alignAtSeed

MergePaths/MergePaths.cpp:1248–1287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1246 */
1247template<class iterator, class oiterator>
1248static bool
1249alignAtSeed(
1250 const Lengths& lengths,
1251 iterator& it1,
1252 iterator it1e,
1253 iterator last1,
1254 iterator& it2,
1255 iterator last2,
1256 oiterator& out)
1257{
1258 assert(it1 != last1);
1259 assert(it1->ambiguous());
1260 assert(it1 + 1 != last1);
1261 assert(!it1e->ambiguous());
1262 assert(it2 != last2);
1263
1264 // Find the best seeded alignment. The best alignment has the
1265 // fewest number of contigs in the consensus sequence.
1266 unsigned bestLen = UINT_MAX;
1267 iterator bestIt2e;
1268 for (iterator it2e = it2; (it2e = find(it2e, last2, *it1e)) != last2; ++it2e) {
1269 oiterator myOut = out;
1270 if (buildConsensus(lengths, it1, it1e, it2, it2e, myOut) &&
1271 align(lengths, it1e, last1, it2e, last2, myOut)) {
1272 unsigned len = myOut - out;
1273 if (len <= bestLen) {
1274 bestLen = len;
1275 bestIt2e = it2e;
1276 }
1277 }
1278 }
1279 if (bestLen != UINT_MAX) {
1280 bool good = buildConsensus(lengths, it1, it1e, it2, bestIt2e, out);
1281 assert(good);
1282 it1 = it1e;
1283 it2 = bestIt2e;
1284 return good;
1285 } else
1286 return false;
1287}
1288
1289/** Align the ambiguous region [it1, last1) to [it2, last2).
1290 * The end of the alignment is returned in it1 and it2.

Callers 1

alignAmbiguousFunction · 0.85

Calls 4

findFunction · 0.85
buildConsensusFunction · 0.85
ambiguousMethod · 0.80
alignFunction · 0.70

Tested by

no test coverage detected