fixed soft unclipped calculation

* getRefCoordSoftUnclippedEnd was not resetting the shift when hitting insertions. Fixed.
* getReadCoordinateForReferenceCoordinateBeforeAlignmentEnd was returning the wrong read coordinate position. Fixed.
This commit is contained in:
Mauricio Carneiro 2011-08-30 02:31:00 -04:00
parent 39d8dccc9c
commit 0cd9438ac2
1 changed files with 4 additions and 2 deletions

View File

@ -680,6 +680,8 @@ public class ReadUtils {
lastOperator = cigarElement.getOperator(); lastOperator = cigarElement.getOperator();
if (cigarElement.getOperator().consumesReferenceBases() || cigarElement.getOperator() == CigarOperator.SOFT_CLIP || cigarElement.getOperator() == CigarOperator.HARD_CLIP) if (cigarElement.getOperator().consumesReferenceBases() || cigarElement.getOperator() == CigarOperator.SOFT_CLIP || cigarElement.getOperator() == CigarOperator.HARD_CLIP)
shift = cigarElement.getLength(); shift = cigarElement.getLength();
else
shift = 0;
} }
return (lastOperator == CigarOperator.HARD_CLIP) ? stop-1 : stop+shift-1 ; return (lastOperator == CigarOperator.HARD_CLIP) ? stop-1 : stop+shift-1 ;
} }
@ -710,8 +712,8 @@ public class ReadUtils {
*/ */
@Requires({"refCoord <= read.getUnclippedEnd()", "refCoord > read.getAlignmentEnd()"}) @Requires({"refCoord <= read.getUnclippedEnd()", "refCoord > read.getAlignmentEnd()"})
private static int getReadCoordinateForReferenceCoordinateBeforeAlignmentEnd(SAMRecord read, int refCoord) { private static int getReadCoordinateForReferenceCoordinateBeforeAlignmentEnd(SAMRecord read, int refCoord) {
if (getRefCoordSoftUnclippedEnd(read) > refCoord) if (getRefCoordSoftUnclippedEnd(read) >= refCoord)
return refCoord - read.getAlignmentEnd() + 1; return refCoord - getRefCoordSoftUnclippedStart(read) + 1;
return -1; return -1;
} }