diff --git a/public/java/src/org/broadinstitute/sting/utils/sam/GATKSAMRecord.java b/public/java/src/org/broadinstitute/sting/utils/sam/GATKSAMRecord.java index 62beb8814..504e718d0 100644 --- a/public/java/src/org/broadinstitute/sting/utils/sam/GATKSAMRecord.java +++ b/public/java/src/org/broadinstitute/sting/utils/sam/GATKSAMRecord.java @@ -25,6 +25,7 @@ package org.broadinstitute.sting.utils.sam; +import com.google.java.contract.Ensures; import net.sf.samtools.*; import org.broadinstitute.sting.utils.NGSPlatform; import org.broadinstitute.sting.utils.exceptions.ReviewedStingException; @@ -579,7 +580,8 @@ public class GATKSAMRecord extends BAMRecord { * * @return the result of calling ReadUtils.getAdaptorBoundary on this read */ - public int getAdapterBoundary() { + @Ensures("result == ReadUtils.getAdaptorBoundary(this)") + public int getAdaptorBoundary() { if ( adapterBoundary == null ) adapterBoundary = ReadUtils.getAdaptorBoundary(this); return adapterBoundary; diff --git a/public/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java b/public/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java index 3c0f9038b..c17e81b9c 100644 --- a/public/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java +++ b/public/java/src/org/broadinstitute/sting/utils/sam/ReadUtils.java @@ -169,7 +169,7 @@ public class ReadUtils { * @return whether or not the base is in the adaptor */ public static boolean isBaseInsideAdaptor(final GATKSAMRecord read, long basePos) { - final int adaptorBoundary = read.getAdapterBoundary(); + final int adaptorBoundary = read.getAdaptorBoundary(); if (adaptorBoundary == CANNOT_COMPUTE_ADAPTOR_BOUNDARY || read.getInferredInsertSize() > DEFAULT_ADAPTOR_SIZE) return false; diff --git a/public/java/test/org/broadinstitute/sting/utils/sam/ReadUtilsUnitTest.java b/public/java/test/org/broadinstitute/sting/utils/sam/ReadUtilsUnitTest.java index b11f2af24..7b48b1b69 100644 --- a/public/java/test/org/broadinstitute/sting/utils/sam/ReadUtilsUnitTest.java +++ b/public/java/test/org/broadinstitute/sting/utils/sam/ReadUtilsUnitTest.java @@ -48,7 +48,7 @@ public class ReadUtilsUnitTest extends BaseTest { }}); tests.add( new Object[]{ new GetAdaptorFunc() { - @Override public int getAdaptor(final GATKSAMRecord record) { return record.getAdapterBoundary(); } + @Override public int getAdaptor(final GATKSAMRecord record) { return record.getAdaptorBoundary(); } }}); return tests.toArray(new Object[][]{});