/** * @return 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. */ public boolean hasContextDeterminedNumElements() { return ! hasConstantNumElements() && ! hasValueDeterminedNumElements(); }
/** * @return 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. */ public boolean hasContextDeterminedNumElements() { return ! hasConstantNumElements() && ! hasValueDeterminedNumElements(); }
/** * 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. * * @return */ @Ensures("result != (hasValueDeterminedNumElements() || hasConstantNumElements())") public boolean hasContextDeterminedNumElements() { return ! hasConstantNumElements() && ! hasValueDeterminedNumElements(); }
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(); } }
/** * 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 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 @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); }