Update inferred insert size of cleaned reads when they are paired

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@982 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2009-06-11 16:29:13 +00:00
parent 3796654069
commit 4d9a88153a
1 changed files with 18 additions and 2 deletions

View File

@ -788,8 +788,24 @@ public class IntervalCleanerWalker extends LocusWindowWalker<Integer, Integer>
}
public void finalizeUpdate() {
read.setCigar(newCigar);
read.setAlignmentStart(newStart);
// if it's a paired end read, we need to update the insert size
if ( read.getReadPairedFlag() ) {
int insertSize = read.getInferredInsertSize();
if ( insertSize > 0 ) {
read.setCigar(newCigar);
read.setInferredInsertSize(insertSize + read.getAlignmentStart() - newStart);
read.setAlignmentStart(newStart);
} else {
// note that the correct order of actions is crucial here
int oldEnd = read.getAlignmentEnd();
read.setCigar(newCigar);
read.setAlignmentStart(newStart);
read.setInferredInsertSize(insertSize + oldEnd - read.getAlignmentEnd());
}
} else {
read.setCigar(newCigar);
read.setAlignmentStart(newStart);
}
}
public String getBaseQualityString() {