Return the mapping of the specified sequence. */
| 344 | |
| 345 | /** Return the mapping of the specified sequence. */ |
| 346 | static void find(const FastaIndex& faIndex, const FMIndex& fmIndex, |
| 347 | const FastqRecord& rec) |
| 348 | { |
| 349 | if (rec.seq.empty()) { |
| 350 | cerr << PROGRAM ": error: " |
| 351 | "the sequence `" << rec.id << "' is empty\n"; |
| 352 | exit(EXIT_FAILURE); |
| 353 | } |
| 354 | |
| 355 | Match m, rcm; |
| 356 | tie(m, rcm) = findMatch(fmIndex, rec.seq); |
| 357 | |
| 358 | if (opt::dup) { |
| 359 | printDuplicates(m, rcm, faIndex, fmIndex, rec); |
| 360 | return; |
| 361 | } |
| 362 | |
| 363 | bool rc; |
| 364 | if (opt::ss) { |
| 365 | rc = rec.id.size() > 2 |
| 366 | && rec.id.substr(rec.id.size()-2) == "/1"; |
| 367 | bool prc = rcm.qspan() > m.qspan(); |
| 368 | if (prc != rc && ((rc && rcm.size() > 0) |
| 369 | || (!rc && m.size() > 0))) |
| 370 | #pragma omp atomic |
| 371 | g_count.suboptimal++; |
| 372 | if (prc != rc && ((rc && rcm.size() == 0 && m.size() > 0) |
| 373 | || (!rc && m.size() == 0 && rcm.size() > 0))) |
| 374 | #pragma omp atomic |
| 375 | g_count.subunmapped++; |
| 376 | } else { |
| 377 | rc = rcm.qspan() > m.qspan(); |
| 378 | |
| 379 | // if both matches are the same length, sum up the number of times |
| 380 | // each were seen. |
| 381 | if (rcm.qspan() == m.qspan()) |
| 382 | rc ? rcm.num += m.num : m.num += rcm.num; |
| 383 | } |
| 384 | |
| 385 | vector<string> alts; |
| 386 | Match mm = rc ? rcm : m; |
| 387 | string mseq = rc ? reverseComplement(rec.seq) : rec.seq; |
| 388 | |
| 389 | #if SAM_SEQ_QUAL |
| 390 | if (opt::multi) { |
| 391 | if (mm.qstart > 0) { |
| 392 | string seq = mseq.substr(0, mm.qstart); |
| 393 | Match m1, rcm1; |
| 394 | tie(m1, rcm1) = findMatch(fmIndex, seq); |
| 395 | bool rc1 = rcm1.qspan() > m1.qspan(); |
| 396 | string xa = toXA(faIndex, fmIndex, rc1 ? rcm1 : m1, |
| 397 | rc ^ rc1, mseq.size(), 0); |
| 398 | if (xa != "") |
| 399 | alts.push_back(xa); |
| 400 | } |
| 401 | |
| 402 | if (mm.qend < mseq.size()) { |
| 403 | string seq = |
no test coverage detected