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) { public static int getSoftUnclippedStop(SAMRecord read) {
int stop = getSoftUnclippedStart(read); int stop = read.getAlignmentEnd();
for (CigarElement cigarElement : read.getCigar().getCigarElements()) List<CigarElement> cigarElementList = read.getCigar().getCigarElements();
if (cigarElement.getOperator().consumesReadBases()) CigarElement lastCigarElement = cigarElementList.get(cigarElementList.size()-1);
stop += cigarElement.getLength(); if (lastCigarElement.getOperator() == CigarOperator.SOFT_CLIP)
stop += lastCigarElement.getLength();
return stop; return stop;
} }