Merge pull request #400 from broadinstitute/mm_bugfix_combine_variants_implicit_casting

Bug fix: annotation values ar parsed as Doubles when they should be parsed as Integers due to implicit conversion.
This commit is contained in:
Ryan Poplin 2013-09-25 11:47:17 -07:00
commit f362597f69
2 changed files with 6 additions and 2 deletions

View File

@ -194,7 +194,7 @@ public class CombineVariantsIntegrationTest extends WalkerTest {
" --excludeNonVariants -combineAnnotations -setKey null" +
" -L 20:10,000,000-10,001,000", b37KGReference),
1,
Arrays.asList("2e15db35359144683f1e58e147362679"));
Arrays.asList("0413f0725fc5ec3a4f1ee246f6cb3a2a"));
cvExecuteTest("combineSingleSamplePipelineGVCF", spec, true);
}

View File

@ -891,7 +891,11 @@ public class GATKVariantContextUtils {
}
try {
final String stringValue = value.toString();
values.add(stringValue.contains(".") ? Double.parseDouble(stringValue) : Integer.parseInt(stringValue));
// Branch to avoid unintentional, implicit type conversions that occur with the ? operator.
if (stringValue.contains("."))
values.add(Double.parseDouble(stringValue));
else
values.add(Integer.parseInt(stringValue));
} catch (NumberFormatException e) {
badAnnotation = true;
}