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

Function mergePath

MergePaths/MergePaths.cpp:392–430  ·  view source on GitHub ↗

Merge the paths of the specified seed path. * @return the merged contig path */

Source from the content-addressed store, hash-verified

390 * @return the merged contig path
391 */
392static ContigPath
393mergePath(const Lengths& lengths, const ContigPathMap& paths, const ContigPath& seedPath)
394{
395 assert(!seedPath.empty());
396 ContigNode seed1 = seedPath.front();
397 ContigPathMap::const_iterator path1It = paths.find(seed1.contigIndex());
398 assert(path1It != paths.end());
399 ContigPath path(path1It->second);
400 if (seedPath.front().sense())
401 reverseComplement(path.begin(), path.end());
402 if (opt::verbose > 1)
403#pragma omp critical(cout)
404 cout << "\n* " << seedPath << '\n'
405 << get(g_contigNames, seedPath.front()) << '\t' << path << '\n';
406 for (ContigPath::const_iterator it = seedPath.begin() + 1; it != seedPath.end(); ++it) {
407 ContigNode seed2 = *it;
408 ContigPathMap::const_iterator path2It = paths.find(seed2.contigIndex());
409 assert(path2It != paths.end());
410 ContigPath path2 = path2It->second;
411 if (seed2.sense())
412 reverseComplement(path2.begin(), path2.end());
413
414 ContigNode pivot = find(path.begin(), path.end(), seed2) != path.end() ? seed2 : seed1;
415 ContigPath consensus = align(lengths, path, path2, pivot);
416 if (consensus.empty()) {
417 // This seed could be removed from the seed path.
418 if (opt::verbose > 1)
419#pragma omp critical(cout)
420 cout << get(g_contigNames, seed2) << '\t' << path2 << '\n' << "\tinvalid\n";
421 } else {
422 path.swap(consensus);
423 if (opt::verbose > 1)
424#pragma omp critical(cout)
425 cout << get(g_contigNames, seed2) << '\t' << path2 << '\n' << '\t' << path << '\n';
426 }
427 seed1 = seed2;
428 }
429 return path;
430}
431
432/** A collection of contig paths. */
433typedef vector<ContigPath> ContigPaths;

Callers 1

mergeSeedPathsFunction · 0.70

Calls 12

findFunction · 0.85
contigIndexMethod · 0.80
senseMethod · 0.80
getFunction · 0.70
alignFunction · 0.70
reverseComplementFunction · 0.50
emptyMethod · 0.45
frontMethod · 0.45
findMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
swapMethod · 0.45

Tested by

no test coverage detected