public final void encodeRawFloat(final double value) throws IOException { encodeRawBytes(Float.floatToIntBits((float) value), BCF2Type.FLOAT); }
public final void encodeRawFloat(final double value) throws IOException { encodeRawBytes(Float.floatToIntBits((float) value), BCF2Type.FLOAT); }
public final void encodeRawFloat(final double value) throws IOException { encodeRawBytes(Float.floatToIntBits((float) value), BCF2Type.FLOAT); }
@Override public void encodeValue(final BCF2Encoder encoder, final Object value, final BCF2Type type, final int minValues) throws IOException { encoder.encodeRawBytes(1, getStaticType()); } }
@Override public void encodeValue(final BCF2Encoder encoder, final Object value, final BCF2Type type, final int minValues) throws IOException { encoder.encodeRawBytes(1, getStaticType()); } }
public final void encodeRawMissingValue(final BCF2Type type) throws IOException { encodeRawBytes(type.getMissingBytes(), type); }
public final void encodeRawMissingValue(final BCF2Type type) throws IOException { encodeRawBytes(type.getMissingBytes(), type); }
@Override @Requires({"minValues <= 1", "value != null", "value instanceof Boolean", "((Boolean)value) == true"}) public void encodeValue(final BCF2Encoder encoder, final Object value, final BCF2Type type, final int minValues) throws IOException { encoder.encodeRawBytes(1, getStaticType()); } }
@Ensures("encodeStream.size() > old(encodeStream.size())") public final void encodeRawMissingValue(final BCF2Type type) throws IOException { encodeRawBytes(type.getMissingBytes(), type); }
@Override public void addGenotype(final BCF2Encoder encoder, final VariantContext vc, final Genotype g) throws IOException { final int samplePloidy = g.getPloidy(); for ( int i = 0; i < nValuesPerGenotype; i++ ) { if ( i < samplePloidy ) { // we encode the actual allele final Allele a = g.getAllele(i); final int offset = getAlleleOffset(a); final int encoded = ((offset+1) << 1) | ((g.isPhased() && i!=0) ? 0x01 : 0x00); encoder.encodeRawBytes(encoded, encodingType); } else { // we need to pad with missing as we have ploidy < max for this sample encoder.encodeRawBytes(encodingType.getMissingBytes(), encodingType); } } }
@Override public void addGenotype(final BCF2Encoder encoder, final VariantContext vc, final Genotype g) throws IOException { final int samplePloidy = g.getPloidy(); for ( int i = 0; i < nValuesPerGenotype; i++ ) { if ( i < samplePloidy ) { // we encode the actual allele final Allele a = g.getAllele(i); final int offset = getAlleleOffset(a); final int encoded = ((offset+1) << 1) | ((g.isPhased() && i!=0) ? 0x01 : 0x00); encoder.encodeRawBytes(encoded, encodingType); } else { // we need to pad with missing as we have ploidy < max for this sample encoder.encodeRawBytes(encodingType.getMissingBytes(), encodingType); } } }
public final <T extends Object> void encodeRawValue(final T value, final BCF2Type type) throws IOException { try { if ( value == type.getMissingJavaValue() ) encodeRawMissingValue(type); else { switch (type) { case INT8: case INT16: case INT32: encodeRawBytes((Integer) value, type); break; case FLOAT: encodeRawFloat((Double) value); break; case CHAR: encodeRawChar((Byte) value); break; default: throw new IllegalArgumentException("Illegal type encountered " + type); } } } catch ( ClassCastException e ) { throw new ClassCastException("BUG: invalid type cast to " + type + " from " + value); } }
public final <T extends Object> void encodeRawValue(final T value, final BCF2Type type) throws IOException { try { if ( value == type.getMissingJavaValue() ) encodeRawMissingValue(type); else { switch (type) { case INT8: case INT16: case INT32: encodeRawBytes((Integer) value, type); break; case FLOAT: encodeRawFloat((Double) value); break; case CHAR: encodeRawChar((Byte) value); break; default: throw new IllegalArgumentException("Illegal type encountered " + type); } } } catch ( ClassCastException e ) { throw new ClassCastException("BUG: invalid type cast to " + type + " from " + value); } }
@Override public void addGenotype(final BCF2Encoder encoder, final VariantContext vc, final Genotype g) throws IOException { final int samplePloidy = g.getPloidy(); for ( int i = 0; i < nValuesPerGenotype; i++ ) { if ( i < samplePloidy ) { // we encode the actual allele final Allele a = g.getAllele(i); final int offset = getAlleleOffset(a); final int encoded = ((offset+1) << 1) | (g.isPhased() ? 0x01 : 0x00); encoder.encodeRawBytes(encoded, encodingType); } else { // we need to pad with missing as we have ploidy < max for this sample encoder.encodeRawBytes(encodingType.getMissingBytes(), encodingType); } } }
public final <T extends Object> void encodeRawValue(final T value, final BCF2Type type) throws IOException { try { if ( value == type.getMissingJavaValue() ) encodeRawMissingValue(type); else { switch (type) { case INT8: case INT16: case INT32: encodeRawBytes((Integer) value, type); break; case FLOAT: encodeRawFloat((Double) value); break; case CHAR: encodeRawChar((Byte) value); break; default: throw new IllegalArgumentException("Illegal type encountered " + type); } } } catch ( ClassCastException e ) { throw new ClassCastException("BUG: invalid type cast to " + type + " from " + value); } }