MISSING_VALUE now gets defaultValue in getAttribute functions

This commit is contained in:
Mark DePristo 2011-09-02 21:12:28 -04:00
parent 82f2131777
commit 124ef6c483
1 changed files with 3 additions and 1 deletions

View File

@ -1,6 +1,8 @@
package org.broadinstitute.sting.utils.variantcontext;
import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
import java.util.*;
@ -213,7 +215,7 @@ public final class InferredGeneticContext {
public int getAttributeAsInt(String key, int defaultValue) {
Object x = getAttribute(key);
if ( x == null ) return defaultValue;
if ( x == null || x == VCFConstants.MISSING_VALUE_v4 ) return defaultValue;
if ( x instanceof Integer ) return (Integer)x;
return Integer.valueOf((String)x); // throws an exception if this isn't a string
}