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

Function find

Map/map.cc:346–475  ·  view source on GitHub ↗

Return the mapping of the specified sequence. */

Source from the content-addressed store, hash-verified

344
345/** Return the mapping of the specified sequence. */
346static 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 =

Callers 15

inOriginalIntigsMethod · 0.85
inOriginalOutigsMethod · 0.85
VertexClass · 0.85
add_edgeMethod · 0.85
VertexClass · 0.85
mainFunction · 0.85
connectPairFunction · 0.85
addOverlapEdgeFunction · 0.85
mergePathFunction · 0.85
addMissingEdgesFunction · 0.85
assemblePathGraphFunction · 0.85
alignAtSeedFunction · 0.85

Calls 15

findMatchFunction · 0.85
printDuplicatesFunction · 0.85
toXAFunction · 0.85
toSAMFunction · 0.85
assert_goodFunction · 0.85
qspanMethod · 0.80
popMethod · 0.80
isUnmappedMethod · 0.80
pushMethod · 0.80
reverseComplementFunction · 0.50
startsWithFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected