Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Requires("! strings.isEmpty()") @Ensures("result.isIntegerType()") private final org.broadinstitute.variant.bcf2.BCF2Type encodeStringsByRef(final Collection<String> strings) throws 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:
        private BCF2Type encodeStringsByRef(ICollection <string> strings)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final List<Integer> offsets = new ArrayList<Integer>(strings.size());
            IList <int?> offsets = new List <int?>(strings.Count);

            // iterate over strings until we find one that needs 16 bits, and break
            foreach (String string in strings)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final Integer got = stringDictionaryMap.get(string);
                int?got = stringDictionaryMap[string];
                if (got == null)
                {
                    throw new IllegalStateException("Format error: could not find string " + string + " in header as required by BCF");
                }
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int offset = got;
                int offset = got;
                offsets.Add(offset);
            }

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.broadinstitute.variant.bcf2.BCF2Type type = org.broadinstitute.variant.bcf2.BCF2Utils.determineIntegerType(offsets);
            BCF2Type type = BCF2Utils.determineIntegerType(offsets);

            encoder.encodeTyped(offsets, type);
            return(type);
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Ensures("encodeStream.size() > old(encodeStream.size())") public final void encodeTypedInt(final int v) 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 void encodeTypedInt(int v)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.broadinstitute.variant.bcf2.BCF2Type type = org.broadinstitute.variant.bcf2.BCF2Utils.determineIntegerType(v);
            BCF2Type type = BCF2Utils.determineIntegerType(v);

            encodeTypedInt(v, type);
        }
Ejemplo n.º 3
0
        // ----------------------------------------------------------------------
        //
        // Constructor
        //
        // ----------------------------------------------------------------------

//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Requires({"headerLine != null", "dict != null"}) private BCF2FieldEncoder(final Bio.VCF.VCFCompoundHeaderLine headerLine, final java.util.Map<String, Integer> dict, final org.broadinstitute.variant.bcf2.BCF2Type staticType)
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET:
        private BCF2FieldEncoder(VCFCompoundHeaderLine headerLine, IDictionary <string, int?> dict, BCF2Type staticType)
        {
            this.headerLine = headerLine;
            this.staticType = staticType;

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final Integer offset = dict.get(getField());
            int?offset = dict[Field];

            if (offset == null)
            {
                throw new IllegalStateException("Format error: could not find string " + Field + " in header as required by BCF");
            }
            this.dictionaryOffset = offset;
            dictionaryOffsetType  = BCF2Utils.determineIntegerType(offset);
        }
Ejemplo n.º 4
0
//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);
            }
Ejemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Requires("arg != null") private final org.broadinstitute.variant.bcf2.BCF2Type determineBCFType(final Object arg)
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET:
        private BCF2Type determineBCFType(object arg)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final Object toType = arg instanceof List ? ((List)arg).get(0) : arg;
            object toType = arg is IList ? ((IList)arg)[0] : arg;

            if (toType is int?)
            {
                return(BCF2Utils.determineIntegerType((int?)toType));
            }
            else if (toType is string)
            {
                return(BCF2Type.CHAR);
            }
            else if (toType is double?)
            {
                return(BCF2Type.FLOAT);
            }
            else
            {
                throw new System.ArgumentException("No native encoding for Object of type " + arg.GetType().Name);
            }
        }
Ejemplo n.º 6
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET:
//ORIGINAL LINE: public org.broadinstitute.variant.bcf2.BCF2Type getDynamicType(final Object value)
            public override BCF2Type getDynamicType(object value)
            {
                return(value == null ? BCF2Type.INT8 : BCF2Utils.determineIntegerType(toList(typeof(int?), value)));
            }
Ejemplo n.º 7
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET:
//ORIGINAL LINE: public org.broadinstitute.variant.bcf2.BCF2Type getDynamicType(final Object value)
            public override BCF2Type getDynamicType(object value)
            {
                return(value == null ? BCF2Type.INT8 : BCF2Utils.determineIntegerType((int[])value));
            }