Add contract to ensure that getAdapterBoundary returns the right result
-- Also renamed the function to getAdaptorBoundary for consistency across the codebase
This commit is contained in:
parent
e445c71161
commit
b8c0b05785
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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[][]{});
|
||||
|
|
|
|||
Loading…
Reference in New Issue