//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Requires("vc != null") public void start(final BCF2Encoder encoder, final org.broadinstitute.variant.variantcontext.VariantContext vc) throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET: public virtual void start(BCF2Encoder encoder, VariantContext vc) { fieldEncoder.writeFieldKey(encoder); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void start(final BCF2Encoder encoder, final org.broadinstitute.variant.variantcontext.VariantContext vc) throws java.io.IOException //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET: public override void start(BCF2Encoder encoder, VariantContext vc) { if (vc.NAlleles > BCF2Utils.MAX_ALLELES_IN_GENOTYPES) { throw new IllegalStateException("Current BCF2 encoder cannot handle sites " + "with > " + BCF2Utils.MAX_ALLELES_IN_GENOTYPES + " alleles, but you have " + vc.NAlleles + " at " + vc.Chr + ":" + vc.Start); } encodingType = BCF2Type.INT8; buildAlleleMap(vc); nValuesPerGenotype = vc.getMaxPloidy(2); base.start(encoder, vc); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void addGenotype(final BCF2Encoder encoder, final org.broadinstitute.variant.variantcontext.VariantContext vc, final org.broadinstitute.variant.variantcontext.Genotype g) throws java.io.IOException //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET: public override void addGenotype(BCF2Encoder encoder, VariantContext vc, Genotype g) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int samplePloidy = g.getPloidy(); int samplePloidy = g.Ploidy; for (int i = 0; i < nValuesPerGenotype; i++) { if (i < samplePloidy) { // we encode the actual allele //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.broadinstitute.variant.variantcontext.Allele a = g.getAllele(i); Allele a = g.getAllele(i); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int offset = getAlleleOffset(a); int offset = getAlleleOffset(a); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int encoded = ((offset+1) << 1) | (g.isPhased() ? 0x01 : 0x00); int encoded = ((offset + 1) << 1) | (g.Phased ? 0x01 : 0x00); encoder.encodeRawBytes(encoded, encodingType); } else { // we need to pad with missing as we have ploidy < max for this sample encoder.encodeRawBytes(encodingType.MissingBytes, encodingType); } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void addGenotype(final BCF2Encoder encoder, final org.broadinstitute.variant.variantcontext.VariantContext vc, final org.broadinstitute.variant.variantcontext.Genotype g) throws java.io.IOException //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET: public override void addGenotype(BCF2Encoder encoder, VariantContext vc, Genotype g) { FieldEncoder.encodeValue(encoder, ige.getValues(g), encodingType, nValuesPerGenotype); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void addGenotype(final BCF2Encoder encoder, final org.broadinstitute.variant.variantcontext.VariantContext vc, final org.broadinstitute.variant.variantcontext.Genotype g) throws java.io.IOException //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET: public override void addGenotype(BCF2Encoder encoder, VariantContext vc, Genotype g) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final String fieldValue = g.getFilters(); string fieldValue = g.Filters; FieldEncoder.encodeValue(encoder, fieldValue, encodingType, nValuesPerGenotype); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void start(final BCF2Encoder encoder, final org.broadinstitute.variant.variantcontext.VariantContext vc) throws java.io.IOException //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET: public override void start(BCF2Encoder encoder, VariantContext vc) { // the only value that is dynamic are integers //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.List<Integer> values = new java.util.ArrayList<Integer>(vc.getNSamples()); IList<int?> values = new List<int?>(vc.NSamples); foreach (Genotype g in vc.Genotypes) { foreach (Object i in BCF2Utils.toList(g.getExtendedAttribute(Field, null))) { if (i != null) // we know they are all integers { values.Add((int?)i); } } } encodingType = BCF2Utils.determineIntegerType(values); base.start(encoder, vc); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void start(final BCF2Encoder encoder, final org.broadinstitute.variant.variantcontext.VariantContext vc) throws java.io.IOException //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET: public override void start(BCF2Encoder encoder, VariantContext vc) { // TODO // TODO this piece of code consumes like 10% of the runtime alone because fo the vc.getGenotypes() iteration // TODO encodingType = BCF2Type.INT8; foreach (Genotype g in vc.Genotypes) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int[] pls = ige.getValues(g); int[] pls = ige.getValues(g); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.broadinstitute.variant.bcf2.BCF2Type plsType = getFieldEncoder().getType(pls); BCF2Type plsType = FieldEncoder.getType(pls); encodingType = BCF2Utils.maxIntegerType(encodingType, plsType); if (encodingType == BCF2Type.INT32) { break; // stop early } } base.start(encoder, vc); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Requires({"encodingType != null", "nValuesPerGenotype >= 0"}) public void addGenotype(final BCF2Encoder encoder, final org.broadinstitute.variant.variantcontext.VariantContext vc, final org.broadinstitute.variant.variantcontext.Genotype g) throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET: public virtual void addGenotype(BCF2Encoder encoder, VariantContext vc, Genotype g) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final Object fieldValue = g.getExtendedAttribute(getField(), null); object fieldValue = g.getExtendedAttribute(Field, null); FieldEncoder.encodeValue(encoder, fieldValue, encodingType, nValuesPerGenotype); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Override @Requires({"encodingType != null", "nValuesPerGenotype >= 0 || ! getFieldEncoder().hasConstantNumElements()"}) @Ensures("nValuesPerGenotype >= 0") public void start(final BCF2Encoder encoder, final org.broadinstitute.variant.variantcontext.VariantContext vc) throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET: public override void start(BCF2Encoder encoder, VariantContext vc) { // writes the key information base.start(encoder, vc); // only update if we need to if (!FieldEncoder.hasConstantNumElements()) { if (FieldEncoder.hasContextDeterminedNumElements()) // we are cheap -- just depends on genotype of allele counts { nValuesPerGenotype = FieldEncoder.numElements(vc); } else // we have to go fishing through the values themselves (expensive) { nValuesPerGenotype = computeMaxSizeOfGenotypeFieldFromValues(vc); } } encoder.encodeType(nValuesPerGenotype, encodingType); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void site(final BCF2Encoder encoder, final org.broadinstitute.variant.variantcontext.VariantContext vc) throws java.io.IOException //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET: public override void site(BCF2Encoder encoder, VariantContext vc) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final Object rawValue = vc.getAttribute(getField(), null); object rawValue = vc.getAttribute(Field, null); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.broadinstitute.variant.bcf2.BCF2Type type = getFieldEncoder().getType(rawValue); BCF2Type type = FieldEncoder.getType(rawValue); if (rawValue == null) { // the value is missing, just write in null encoder.encodeType(0, type); } else { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int valueCount = getFieldEncoder().numElements(vc, rawValue); int valueCount = FieldEncoder.numElements(vc, rawValue); encoder.encodeType(valueCount, type); FieldEncoder.encodeValue(encoder, rawValue, type, valueCount); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public abstract void site(final BCF2Encoder encoder, final org.broadinstitute.variant.variantcontext.VariantContext vc) throws java.io.IOException; //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET: public abstract void site(BCF2Encoder encoder, VariantContext vc);
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void done(final BCF2Encoder encoder, final org.broadinstitute.variant.variantcontext.VariantContext vc) throws java.io.IOException //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET: public virtual void done(BCF2Encoder encoder, VariantContext vc) // TODO -- overload done so that we null out values and test for correctness { }