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

Function alignOne

MergePaths/MergePaths.cpp:1326–1361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1324 */
1325template<class iterator, class oiterator>
1326static bool
1327alignOne(
1328 const Lengths& lengths,
1329 iterator& it1,
1330 iterator last1,
1331 iterator& it2,
1332 iterator last2,
1333 oiterator& out)
1334{
1335 // Check for a trivial alignment.
1336 unsigned n1 = last1 - it1, n2 = last2 - it2;
1337 if (n1 <= n2 && equal(it1, last1, it2)) {
1338 // [it1,last1) is a prefix of [it2,last2).
1339 out = copy(it1, last1, out);
1340 it1 += n1;
1341 it2 += n1;
1342 assert(it1 == last1);
1343 return true;
1344 } else if (n2 < n1 && equal(it2, last2, it1)) {
1345 // [it2,last2) is a prefix of [it1,last1).
1346 out = copy(it2, last2, out);
1347 it1 += n2;
1348 it2 += n2;
1349 assert(it2 == last2);
1350 return true;
1351 }
1352
1353 return it1->ambiguous() && it2->ambiguous()
1354 ? (it1->length() > it2->length()
1355 ? alignAmbiguous(lengths, it1, last1, it2, last2, out)
1356 : alignAmbiguous(lengths, it2, last2, it1, last1, out))
1357 : it1->ambiguous()
1358 ? alignAmbiguous(lengths, it1, last1, it2, last2, out)
1359 : it2->ambiguous() ? alignAmbiguous(lengths, it2, last2, it1, last1, out)
1360 : (*out++ = *it1, *it1++ == *it2++);
1361}
1362
1363/** Align the ambiguous region [it1, last1) to [it2, last2)
1364 * and store the consensus at out if an alignment is found.

Callers 1

alignFunction · 0.85

Calls 3

alignAmbiguousFunction · 0.85
ambiguousMethod · 0.80
lengthMethod · 0.45

Tested by

no test coverage detected