Class BCF2FieldEncoder.StringOrCharacter
java.lang.Object
htsjdk.variant.variantcontext.writer.BCF2FieldEncoder
htsjdk.variant.variantcontext.writer.BCF2FieldEncoder.StringOrCharacter
- Enclosing class:
- BCF2FieldEncoder
-
Nested Class Summary
Nested classes/interfaces inherited from class htsjdk.variant.variantcontext.writer.BCF2FieldEncoder
BCF2FieldEncoder.AtomicInt, BCF2FieldEncoder.Flag, BCF2FieldEncoder.Float, BCF2FieldEncoder.GenericInts, BCF2FieldEncoder.IntArray, BCF2FieldEncoder.StringOrCharacter
-
Constructor Summary
ConstructorDescriptionStringOrCharacter
(VCFCompoundHeaderLine headerLine, Map<String, Integer> dict) -
Method Summary
Modifier and TypeMethodDescriptionvoid
encodeValue
(BCF2Encoder encoder, Object value, BCF2Type type, int minValues) Key abstract method that should encode a value of the given type into the encoder.boolean
boolean
boolean
protected int
numElementsFromValue
(Object value) Given a value, return the number of elements we will encode for it.Methods inherited from class htsjdk.variant.variantcontext.writer.BCF2FieldEncoder
getCountType, getDynamicType, getField, getStaticType, getType, isDynamicallyTyped, isStaticallyTyped, numElements, numElements, numElements, numElements, toString, writeFieldKey
-
Constructor Details
-
StringOrCharacter
-
-
Method Details
-
encodeValue
public void encodeValue(BCF2Encoder encoder, Object value, BCF2Type type, int minValues) throws IOException Description copied from class:BCF2FieldEncoder
Key abstract method that should encode a value of the given type into the encoder. Value will be of a type appropriate to the underlying encoder. If the genotype field is represented as an int[], this will be value, and the encoder needs to handle encoding all of the values in the int[]. The argument should be used, not the getType() method in the superclass as an outer loop might have decided a more general type (int16) to use, even through this encoder could have been done with int8. If minValues > 0, then encodeValue must write in at least minValues items from value. If value is atomic, this means that minValues - 1 MISSING values should be added to the encoder. If minValues is a collection type (int[]) then minValues - values.length should be added. This argument is intended to handle padding of values in genotype fields.- Specified by:
encodeValue
in classBCF2FieldEncoder
- Throws:
IOException
-
hasConstantNumElements
public boolean hasConstantNumElements()- Overrides:
hasConstantNumElements
in classBCF2FieldEncoder
- Returns:
- True if this field has a constant, fixed number of elements (such as 1 for an atomic integer)
-
hasContextDeterminedNumElements
public boolean hasContextDeterminedNumElements()- Overrides:
hasContextDeterminedNumElements
in classBCF2FieldEncoder
- Returns:
- True if this field has a non-fixed number of elements that depends only on the properties of the current VariantContext, such as one value per Allele or per genotype configuration.
-
hasValueDeterminedNumElements
public boolean hasValueDeterminedNumElements()- Overrides:
hasValueDeterminedNumElements
in classBCF2FieldEncoder
- Returns:
- True if the only way to determine how many elements this field contains is by inspecting the actual value directly, such as when the number of elements is a variable length list per site or per genotype.
-
numElementsFromValue
Description copied from class:BCF2FieldEncoder
Given a value, return the number of elements we will encode for it. Assumes the value is encoded as a List- Overrides:
numElementsFromValue
in classBCF2FieldEncoder
- Returns:
- the number of elements we will encode for .
-