From 613badc835b8e6b38ee45654d98dcdf0b9d50455 Mon Sep 17 00:00:00 2001 From: Eric Banks Date: Tue, 12 Jun 2012 15:47:32 -0400 Subject: [PATCH] Very minor optimizations for the context covariate --- .../sting/gatk/walkers/bqsr/ContextCovariate.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/ContextCovariate.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/ContextCovariate.java index 94b2dfe50..76b84807d 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/ContextCovariate.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/ContextCovariate.java @@ -122,10 +122,11 @@ public class ContextCovariate implements StandardCovariate { * @param contextSize context size to use building the context * @return the key representing the context */ - private Long contextWith(byte[] bases, int offset, int contextSize) { + private Long contextWith(final byte[] bases, final int offset, final int contextSize) { Long result = null; - if (offset - contextSize + 1 >= 0) { - final byte[] context = Arrays.copyOfRange(bases, offset - contextSize + 1, offset + 1); + final int start = offset - contextSize + 1; + if (start >= 0) { + final byte[] context = Arrays.copyOfRange(bases, start, offset + 1); if (!BaseUtils.containsBase(context, BaseUtils.N)) result = keyFromContext(context); }