From 81993b08e205d8d93112a40d0504648e783ee9c0 Mon Sep 17 00:00:00 2001 From: Eric Banks Date: Wed, 13 Jun 2012 11:43:44 -0400 Subject: [PATCH] Don't put null entries into the key array --- .../sting/gatk/walkers/bqsr/BQSRKeyManager.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/BQSRKeyManager.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/BQSRKeyManager.java index 9880af405..f0c7c080e 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/BQSRKeyManager.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/bqsr/BQSRKeyManager.java @@ -110,7 +110,7 @@ public class BQSRKeyManager { * @return one key in long representation per covariate */ public Long[] longsFromAllKeys(final Long[] allKeys, final EventType eventType) { - final Long[] allFinalKeys = new Long[optionalCovariatesInfo.length > 0 ? optionalCovariatesInfo.length : 1]; // Generate one key per optional covariate + final ArrayList allFinalKeys = new ArrayList(); // Generate one key per optional covariate int covariateIndex = 0; long masterKey = 0L; // This will be a master key holding all the required keys, to replicate later on @@ -128,13 +128,13 @@ public class BQSRKeyManager { long newKey = masterKey | (covariateKey << optionalCovariateOffset); newKey |= (optionalCovariatesInfo[i].covariateID << optionalCovariateIDOffset); - allFinalKeys[i] = newKey; // add this key to the list of keys + allFinalKeys.add(newKey); // add this key to the list of keys } if (optionalCovariatesInfo.length == 0) // special case when we have no optional covariates - allFinalKeys[0] = masterKey; + allFinalKeys.add(masterKey); - return allFinalKeys; + return allFinalKeys.toArray(new Long[allFinalKeys.size()]); } /**