MCPcopy Create free account
hub / github.com/OpenGene/fastp / processPairEnd

Method processPairEnd

src/peprocessor.cpp:362–708  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

360}
361
362bool PairEndProcessor::processPairEnd(ReadPack* leftPack, ReadPack* rightPack, ThreadConfig* config){
363 if(leftPack->count != rightPack->count) {
364 cerr << endl;
365 cerr << "WARNING: different read numbers of the " << mPackProcessedCounter << " pack" << endl;
366 cerr << "Read1 pack size: " << leftPack->count << endl;
367 cerr << "Read2 pack size: " << rightPack->count << endl;
368 cerr << "Ignore the unmatched reads" << endl << endl;
369 shouldStopReading = true;
370 }
371 int tid = config->getThreadId();
372
373 // build output on stack strings, move to heap only when handing off to writers
374 string outstr1, outstr2, unpairedOut1, unpairedOut2;
375 string singleOutput, mergedOutput, failedOut, overlappedOut;
376 // reserve capacity for main outputs to avoid repeated reallocation
377 const size_t estimatedCapacity = leftPack->count * 320;
378 outstr1.reserve(estimatedCapacity);
379 outstr2.reserve(estimatedCapacity);
380
381 int readPassed = 0;
382 int mergedCount = 0;
383 for(int p=0;p<leftPack->count && p<rightPack->count;p++){
384 Read* or1 = leftPack->data[p];
385 Read* or2 = rightPack->data[p];
386
387 int lowQualNum1 = 0;
388 int nBaseNum1 = 0;
389 int lowQualNum2 = 0;
390 int nBaseNum2 = 0;
391
392 // stats the original read before trimming
393 config->getPreStats1()->statRead(or1);
394 config->getPreStats2()->statRead(or2);
395
396 // handling the duplication profiling
397 bool dedupOut = false;
398 if(mDuplicate) {
399 bool isDup = mDuplicate->checkPair(or1, or2);
400 if(mOptions->duplicate.dedup && isDup)
401 dedupOut = true;
402 }
403
404 // filter by index
405 if(mOptions->indexFilter.enabled && mFilter->filterByIndex(or1, or2)) {
406 recycleToPool1(tid, or1);
407 or1 = NULL;
408 recycleToPool2(tid, or2);
409 or2 = NULL;
410 continue;
411 }
412
413 // fix MGI
414 if(mOptions->fixMGI) {
415 or1->fixMGI();
416 or2->fixMGI();
417 }
418 // umi processing
419 if(mOptions->umi.enabled)

Callers

nothing calls this directly

Calls 15

getThreadIdMethod · 0.80
statReadMethod · 0.80
getPreStats1Method · 0.80
getPreStats2Method · 0.80
checkPairMethod · 0.80
filterByIndexMethod · 0.80
fixMGIMethod · 0.80
trimAndCutMethod · 0.80
getFilterResultMethod · 0.80
incTrimmedAdapterReadMethod · 0.80
appendToStringMethod · 0.80
resizeMethod · 0.80

Tested by

no test coverage detected