Example #1
0
        public void BeginSection(string section, long fileLoc)
        {
            if (_sectionRanges.ContainsKey(section))
            {
                throw new UserErrorException($"Multiple beginning for section: {section}!!");
            }

            _sectionRanges[section] = new FileRange(fileLoc);
        }
Example #2
0
        public JasixIndex(Stream stream) : this()
        {
            _stream = stream;
            using (var reader = new ExtendedBinaryReader(stream))
            {
                int version = reader.ReadOptInt32();
                if (version != JasixCommons.Version)
                {
                    throw new InvalidDataException($"Invalid Jasix version: Observed {version}, expected{JasixCommons.Version}");
                }

                int count = reader.ReadOptInt32();

                for (var i = 0; i < count; i++)
                {
                    var chrIndex = new JasixChrIndex(reader);
                    _chrIndices[chrIndex.ReferenceSequence] = chrIndex;
                }

                int synonymCount = reader.ReadOptInt32();
                for (var i = 0; i < synonymCount; i++)
                {
                    string synonym   = reader.ReadAsciiString();
                    string indexName = reader.ReadAsciiString();
                    _synonymToChrName[synonym] = indexName;
                }

                int sectionCount = reader.ReadOptInt32();
                for (var i = 0; i < sectionCount; i++)
                {
                    string sectionName = reader.ReadAsciiString();
                    long   begin       = reader.ReadOptInt64();
                    long   end         = reader.ReadOptInt64();
                    _sectionRanges[sectionName] = new FileRange(begin, end);
                }
            }
        }