示例#1
0
        public static SupplementaryInterval Read(ExtendedBinaryReader reader, IChromosomeRenamer renamer)
        {
            var referenceName      = reader.ReadAsciiString();
            var start              = reader.ReadOptInt32();
            var end                = reader.ReadOptInt32();
            var alternateAllele    = reader.ReadAsciiString();
            var sequenceAlteration = (VariantType)reader.ReadByte();
            var source             = reader.ReadAsciiString();

            // strings
            var count        = reader.ReadOptInt32();
            var stringValues = new Dictionary <string, string>(count);

            for (var i = 0; i < count; i++)
            {
                var key   = reader.ReadAsciiString();
                var value = reader.ReadAsciiString();
                stringValues[key] = value;
            }

            // integers
            count = reader.ReadOptInt32();
            var intValues = new Dictionary <string, int>(count);

            for (var i = 0; i < count; i++)
            {
                var key   = reader.ReadAsciiString();
                var value = reader.ReadOptInt32();
                intValues[key] = value;
            }

            // booleans
            count = reader.ReadOptInt32();
            var boolList = new List <string>(count);

            for (var i = 0; i < count; i++)
            {
                boolList.Add(reader.ReadAsciiString());
            }

            // doubles
            count = reader.ReadOptInt32();
            var doubleValues = new Dictionary <string, double>(count);

            for (var i = 0; i < count; i++)
            {
                var key   = reader.ReadAsciiString();
                var value = reader.ReadOptDouble();
                doubleValues[key] = value;
            }

            // frequencies
            count = reader.ReadOptInt32();
            var freqValues = new Dictionary <string, double>(count);

            for (var i = 0; i < count; i++)
            {
                var key   = reader.ReadAsciiString();
                var value = reader.ReadOptDouble();
                freqValues[key] = value;
            }

            //stringLists
            count = reader.ReadOptInt32();
            var stringLists = new Dictionary <string, IEnumerable <string> >(count);

            for (var i = 0; i < count; i++)
            {
                var key        = reader.ReadAsciiString();
                var valueCount = reader.ReadOptInt32();
                var values     = ReadStringLists(reader, valueCount);
                stringLists[key] = values;
            }

            return(new SupplementaryInterval(start, end, referenceName, alternateAllele, sequenceAlteration, source,
                                             renamer, intValues, doubleValues, freqValues, stringValues, boolList, stringLists));
        }