示例#1
0
        public void Add(string chr, int start, int end, long fileLoc)
        {
            if (!_chrIndices.ContainsKey(chr))
            {
                _chrIndices[chr] = new JasixChrIndex(chr);
            }

            _chrIndices[chr].Add(start, end, fileLoc);
        }
示例#2
0
        public void Add(string chr, int start, int end, long fileLoc, string chrSynonym = null)
        {
            if (!string.IsNullOrEmpty(chrSynonym))
            {
                _synonymToChrName[chrSynonym] = chr;
            }

            if (_chrIndices.TryGetValue(chr, out var chrIndex))
            {
                chrIndex.Add(start, end, fileLoc);
            }
            else
            {
                _chrIndices[chr] = new JasixChrIndex(chr);
                _chrIndices[chr].Add(start, end, fileLoc);
            }
        }
示例#3
0
        private JasixIndex(IExtendedBinaryReader reader) : this()
        {
            var version = reader.ReadOptInt32();

            if (version != JasixCommons.Version)
            {
                throw new InvalidDataException($"Invalid Jasix version: Observed {version}, expected{JasixCommons.Version}");
            }

            HeaderLine = reader.ReadAsciiString();
            var count = reader.ReadOptInt32();

            for (var i = 0; i < count; i++)
            {
                var chrIndex = new JasixChrIndex(reader);
                _chrIndices[chrIndex.ReferenceSequence] = chrIndex;
            }
        }
示例#4
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);
                }
            }
        }