Fixed index for getSoftUnclippedEnd()

Unclipped end can be calculated simply by looking at the last cigar element and adding it's length in case it's a soft clip.
This commit is contained in:
Mauricio Carneiro 2011-08-16 18:54:28 -04:00
parent 07c1e113cd
commit ed8f769dce
1 changed files with 5 additions and 4 deletions

View File

@ -670,10 +670,11 @@ public class ReadUtils {
}
public static int getSoftUnclippedStop(SAMRecord read) {
int stop = getSoftUnclippedStart(read);
for (CigarElement cigarElement : read.getCigar().getCigarElements())
if (cigarElement.getOperator().consumesReadBases())
stop += cigarElement.getLength();
int stop = read.getAlignmentEnd();
List<CigarElement> cigarElementList = read.getCigar().getCigarElements();
CigarElement lastCigarElement = cigarElementList.get(cigarElementList.size()-1);
if (lastCigarElement.getOperator() == CigarOperator.SOFT_CLIP)
stop += lastCigarElement.getLength();
return stop;
}