Actually a better implementation of GATKSAMRecord.getSoftStart(). Last commit was all wrong. Oops.

This commit is contained in:
Eric Banks 2012-10-19 12:41:24 -04:00
parent f7bd4998fc
commit 9c088fe3fe
1 changed files with 8 additions and 3 deletions

View File

@ -388,9 +388,14 @@ public class GATKSAMRecord extends BAMRecord {
public int getSoftStart() {
if (softStart < 0) {
softStart = getAlignmentStart();
final CigarElement firstCig = getCigar().getCigarElement(0);
if (firstCig.getOperator() == CigarOperator.HARD_CLIP)
softStart -= firstCig.getLength();
for (final CigarElement cig : getCigar().getCigarElements()) {
final CigarOperator op = cig.getOperator();
if (op == CigarOperator.SOFT_CLIP)
softStart -= cig.getLength();
else if (op != CigarOperator.HARD_CLIP)
break;
}
}
return softStart;
}