| 295 | } |
| 296 | |
| 297 | static void writeEstimate(ostream& out, |
| 298 | const ContigNode& id0, const ContigNode& id1, |
| 299 | unsigned len0, unsigned len1, |
| 300 | const Pairs& pairs, const PMF& pmf) |
| 301 | { |
| 302 | if (pairs.size() < opt::npairs) |
| 303 | return; |
| 304 | |
| 305 | DistanceEst est; |
| 306 | est.distance = estimateDistance(len0, len1, |
| 307 | pairs, pmf, est.numPairs); |
| 308 | est.stdDev = pmf.getSampleStdDev(est.numPairs); |
| 309 | |
| 310 | std::pair<ContigNode, ContigNode> e(id0, id1 ^ id0.sense()); |
| 311 | if (est.numPairs >= opt::npairs) { |
| 312 | if (opt::format == DOT) { |
| 313 | #pragma omp critical(out) |
| 314 | out << get(g_contigNames, e) << " [" << est << "]\n"; |
| 315 | } else if (opt::format == GFA2) { |
| 316 | // Output only one of the two complementary edges. |
| 317 | if (len1 < opt::seedLen || e.first < e.second || e.first == e.second) |
| 318 | #pragma omp critical(out) |
| 319 | out << "G\t*" |
| 320 | << '\t' << get(g_contigNames, e.first) |
| 321 | << '\t' << get(g_contigNames, e.second) |
| 322 | << '\t' << est.distance |
| 323 | << '\t' << (int)ceilf(est.stdDev) |
| 324 | << "\tFC:i:" << est.numPairs |
| 325 | << '\n'; |
| 326 | } else |
| 327 | out << ' ' << get(g_contigNames, id1) << ',' << est; |
| 328 | } else if (opt::verbose > 1) { |
| 329 | #pragma omp critical(cerr) |
| 330 | cerr << "warning: " << get(g_contigNames, e) |
| 331 | << " [d=" << est.distance << "] " |
| 332 | << est.numPairs << " of " << pairs.size() |
| 333 | << " pairs fit the expected distribution\n"; |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | /** Generate distance estimates for the specified alignments. */ |
| 338 | static void writeEstimates(ostream& out, |
no test coverage detected