Find a path for the specified distance estimates. * @param out [out] the solution path */
| 459 | * @param out [out] the solution path |
| 460 | */ |
| 461 | static void handleEstimate(const Graph& g, |
| 462 | const EstimateRecord& er, bool dirIdx, |
| 463 | ContigPath& out) |
| 464 | { |
| 465 | if (er.estimates[dirIdx].empty()) |
| 466 | return; |
| 467 | |
| 468 | ContigNode origin(er.refID, dirIdx); |
| 469 | ostringstream vout_ss; |
| 470 | ostream bitBucket(NULL); |
| 471 | ostream& vout = opt::verbose > 0 ? vout_ss : bitBucket; |
| 472 | vout << "\n* " << get(vertex_name, g, origin) << '\n'; |
| 473 | |
| 474 | unsigned minNumPairs = UINT_MAX; |
| 475 | // generate the reachable set |
| 476 | Constraints constraints; |
| 477 | for (Estimates::const_iterator iter |
| 478 | = er.estimates[dirIdx].begin(); |
| 479 | iter != er.estimates[dirIdx].end(); ++iter) { |
| 480 | ContigNode v = iter->first; |
| 481 | const DistanceEst& ep = iter->second; |
| 482 | minNumPairs = min(minNumPairs, ep.numPairs); |
| 483 | constraints.push_back(Constraint(v, |
| 484 | ep.distance + allowedError(ep.stdDev))); |
| 485 | } |
| 486 | |
| 487 | vout << "Constraints:"; |
| 488 | printConstraints(vout, g, constraints) << '\n'; |
| 489 | |
| 490 | ContigPaths solutions; |
| 491 | unsigned numVisited = 0; |
| 492 | constrainedSearch(g, origin, constraints, solutions, numVisited); |
| 493 | bool tooComplex = numVisited >= opt::maxCost; |
| 494 | bool tooManySolutions = solutions.size() > opt::maxPaths; |
| 495 | |
| 496 | set<ContigID> repeats = findRepeats(er.refID, solutions); |
| 497 | if (!repeats.empty()) { |
| 498 | vout << "Repeats:"; |
| 499 | for (set<ContigID>::const_iterator it = repeats.begin(); |
| 500 | it != repeats.end(); ++it) |
| 501 | vout << ' ' << get(g_contigNames, *it); |
| 502 | vout << '\n'; |
| 503 | } |
| 504 | |
| 505 | unsigned numPossiblePaths = solutions.size(); |
| 506 | if (numPossiblePaths > 0) |
| 507 | vout << "Paths: " << numPossiblePaths << '\n'; |
| 508 | |
| 509 | for (ContigPaths::iterator solIter = solutions.begin(); |
| 510 | solIter != solutions.end();) { |
| 511 | vout << *solIter << '\n'; |
| 512 | |
| 513 | // Calculate the path distance to each node and see if |
| 514 | // it is within the estimated distance. |
| 515 | map<ContigNode, int> distanceMap |
| 516 | = makeDistanceMap(g, origin, *solIter); |
| 517 | |
| 518 | // Remove solutions whose distance estimates are not correct. |
no test coverage detected