Skip to content

Commit

Permalink
revise the insert size estimation a little when trim front is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
sfchen committed Mar 29, 2019
1 parent 2c5bdad commit 8c756ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/peprocessor.cpp
Expand Up @@ -288,7 +288,7 @@ bool PairEndProcessor::processPairEnd(ReadPairPack* pack, ThreadConfig* config){
OverlapResult ov = OverlapAnalysis::analyze(r1, r2, mOptions->overlapDiffLimit, mOptions->overlapRequire);
// we only use thread 0 to evaluae ISIZE
if(config->getThreadId() == 0) {
statInsertSize(r1, r2, ov);
statInsertSize(r1, r2, ov, frontTrimmed1, frontTrimmed2);
isizeEvaluated = true;
}
if(mOptions->correction.enabled) {
Expand All @@ -307,7 +307,7 @@ bool PairEndProcessor::processPairEnd(ReadPairPack* pack, ThreadConfig* config){

if(config->getThreadId() == 0 && !isizeEvaluated && r1 != NULL && r2!=NULL) {
OverlapResult ov = OverlapAnalysis::analyze(r1, r2, mOptions->overlapDiffLimit, mOptions->overlapRequire);
statInsertSize(r1, r2, ov);
statInsertSize(r1, r2, ov, frontTrimmed1, frontTrimmed2);
isizeEvaluated = true;
}

Expand Down Expand Up @@ -435,13 +435,13 @@ bool PairEndProcessor::processPairEnd(ReadPairPack* pack, ThreadConfig* config){
return true;
}

void PairEndProcessor::statInsertSize(Read* r1, Read* r2, OverlapResult& ov) {
void PairEndProcessor::statInsertSize(Read* r1, Read* r2, OverlapResult& ov, int frontTrimmed1, int frontTrimmed2) {
int isize = mOptions->insertSizeMax;
if(ov.overlapped) {
if(ov.offset > 0)
isize = r1->length() + r2->length() - ov.overlap_len;
isize = r1->length() + r2->length() - ov.overlap_len + frontTrimmed1 + frontTrimmed2;
else
isize = ov.overlap_len;
isize = ov.overlap_len + frontTrimmed1 + frontTrimmed2;
}

if(isize > mOptions->insertSizeMax)
Expand Down
2 changes: 1 addition & 1 deletion src/peprocessor.h
Expand Up @@ -57,7 +57,7 @@ class PairEndProcessor{
void initConfig(ThreadConfig* config);
void initOutput();
void closeOutput();
void statInsertSize(Read* r1, Read* r2, OverlapResult& ov);
void statInsertSize(Read* r1, Read* r2, OverlapResult& ov, int frontTrimmed1 = 0, int frontTrimmed2 = 0);
int getPeakInsertSize();
void writeTask(WriterThread* config);

Expand Down

0 comments on commit 8c756ae

Please sign in to comment.