Very minor optimizations for the context covariate
This commit is contained in:
parent
0f79adb2aa
commit
613badc835
|
|
@ -122,10 +122,11 @@ public class ContextCovariate implements StandardCovariate {
|
||||||
* @param contextSize context size to use building the context
|
* @param contextSize context size to use building the context
|
||||||
* @return the key representing 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;
|
Long result = null;
|
||||||
if (offset - contextSize + 1 >= 0) {
|
final int start = offset - contextSize + 1;
|
||||||
final byte[] context = Arrays.copyOfRange(bases, offset - contextSize + 1, offset + 1);
|
if (start >= 0) {
|
||||||
|
final byte[] context = Arrays.copyOfRange(bases, start, offset + 1);
|
||||||
if (!BaseUtils.containsBase(context, BaseUtils.N))
|
if (!BaseUtils.containsBase(context, BaseUtils.N))
|
||||||
result = keyFromContext(context);
|
result = keyFromContext(context);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue