/** * A convenience access for the number of elements. * @param vc * @param value * @return the number of encoded elements, either from the fixed number * it has, from the VC, or from the value itself. */ public final int numElements(final VariantContext vc, final Object value) { if ( hasConstantNumElements() ) return numElements(); else if ( hasContextDeterminedNumElements() ) return numElements(vc); else return numElements(value); }
/** * A convenience access for the number of elements. * @param vc * @param value * @return the number of encoded elements, either from the fixed number * it has, from the VC, or from the value itself. */ public final int numElements(final VariantContext vc, final Object value) { if ( hasConstantNumElements() ) return numElements(); else if ( hasContextDeterminedNumElements() ) return numElements(vc); else return numElements(value); }
/** * A convenience access for the number of elements, returning * the number of encoded elements, either from the fixed number * it has, from the VC, or from the value itself. * @param vc * @param value * @return */ @Ensures("result >= 0") public final int numElements(final VariantContext vc, final Object value) { if ( hasConstantNumElements() ) return numElements(); else if ( hasContextDeterminedNumElements() ) return numElements(vc); else return numElements(value); }
@Override protected int numElements(final VariantContext vc, final Genotype g) { return getFieldEncoder().numElements(vc, g.getFilters()); } }
protected GenotypesWriter(final VCFHeader header, final BCF2FieldEncoder fieldEncoder) { super(header, fieldEncoder); if ( fieldEncoder.hasConstantNumElements() ) { nValuesPerGenotype = getFieldEncoder().numElements(); } }
protected GenotypesWriter(final VCFHeader header, final BCF2FieldEncoder fieldEncoder) { super(header, fieldEncoder); if ( fieldEncoder.hasConstantNumElements() ) { nValuesPerGenotype = getFieldEncoder().numElements(); } }
protected GenotypesWriter(final VCFHeader header, final BCF2FieldEncoder fieldEncoder) { super(header, fieldEncoder); if ( fieldEncoder.hasConstantNumElements() ) { nValuesPerGenotype = getFieldEncoder().numElements(); } }
@Override protected int numElements(final VariantContext vc, final Genotype g) { return getFieldEncoder().numElements(vc, g.getFilters()); } }
@Override protected int numElements(final VariantContext vc, final Genotype g) { return getFieldEncoder().numElements(vc, g.getFilters()); } }
protected int numElements(final VariantContext vc, final Genotype g) { return getFieldEncoder().numElements(vc, g.getExtendedAttribute(getField())); }
protected int numElements(final VariantContext vc, final Genotype g) { return getFieldEncoder().numElements(vc, g.getExtendedAttribute(getField())); }
@Ensures({"result >= 0"}) protected int numElements(final VariantContext vc, final Genotype g) { return getFieldEncoder().numElements(vc, g.getExtendedAttribute(getField())); }
@Override public void start(final BCF2Encoder encoder, final VariantContext vc) throws IOException { // writes the key information super.start(encoder, vc); // only update if we need to if ( ! getFieldEncoder().hasConstantNumElements() ) { if ( getFieldEncoder().hasContextDeterminedNumElements() ) // we are cheap -- just depends on genotype of allele counts nValuesPerGenotype = getFieldEncoder().numElements(vc); else // we have to go fishing through the values themselves (expensive) nValuesPerGenotype = computeMaxSizeOfGenotypeFieldFromValues(vc); } encoder.encodeType(nValuesPerGenotype, encodingType); }
@Override public void start(final BCF2Encoder encoder, final VariantContext vc) throws IOException { // writes the key information super.start(encoder, vc); // only update if we need to if ( ! getFieldEncoder().hasConstantNumElements() ) { if ( getFieldEncoder().hasContextDeterminedNumElements() ) // we are cheap -- just depends on genotype of allele counts nValuesPerGenotype = getFieldEncoder().numElements(vc); else // we have to go fishing through the values themselves (expensive) nValuesPerGenotype = computeMaxSizeOfGenotypeFieldFromValues(vc); } encoder.encodeType(nValuesPerGenotype, encodingType); }
@Override public void site(final BCF2Encoder encoder, final VariantContext vc) throws IOException { final Object rawValue = vc.getAttribute(getField(), null); final BCF2Type type = getFieldEncoder().getType(rawValue); if ( rawValue == null ) { // the value is missing, just write in null encoder.encodeType(0, type); } else { final int valueCount = getFieldEncoder().numElements(vc, rawValue); encoder.encodeType(valueCount, type); getFieldEncoder().encodeValue(encoder, rawValue, type, valueCount); } } }
@Override public void site(final BCF2Encoder encoder, final VariantContext vc) throws IOException { final Object rawValue = vc.getAttribute(getField(), null); final BCF2Type type = getFieldEncoder().getType(rawValue); if ( rawValue == null ) { // the value is missing, just write in null encoder.encodeType(0, type); } else { final int valueCount = getFieldEncoder().numElements(vc, rawValue); encoder.encodeType(valueCount, type); getFieldEncoder().encodeValue(encoder, rawValue, type, valueCount); } } }
@Override public void site(final BCF2Encoder encoder, final VariantContext vc) throws IOException { final Object rawValue = vc.getAttribute(getField(), null); final BCF2Type type = getFieldEncoder().getType(rawValue); if ( rawValue == null ) { // the value is missing, just write in null encoder.encodeType(0, type); } else { final int valueCount = getFieldEncoder().numElements(vc, rawValue); encoder.encodeType(valueCount, type); getFieldEncoder().encodeValue(encoder, rawValue, type, valueCount); } } }
@Override @Requires({"encodingType != null", "nValuesPerGenotype >= 0 || ! getFieldEncoder().hasConstantNumElements()"}) @Ensures("nValuesPerGenotype >= 0") public void start(final BCF2Encoder encoder, final VariantContext vc) throws IOException { // writes the key information super.start(encoder, vc); // only update if we need to if ( ! getFieldEncoder().hasConstantNumElements() ) { if ( getFieldEncoder().hasContextDeterminedNumElements() ) // we are cheap -- just depends on genotype of allele counts nValuesPerGenotype = getFieldEncoder().numElements(vc); else // we have to go fishing through the values themselves (expensive) nValuesPerGenotype = computeMaxSizeOfGenotypeFieldFromValues(vc); } encoder.encodeType(nValuesPerGenotype, encodingType); }