Пример #1
0
        //todo: filter chromIndex=ushort.Max
        public NsaWriter(ExtendedBinaryWriter writer, ExtendedBinaryWriter indexWriter, DataSourceVersion version, ISequenceProvider refProvider, string jsonKey, bool matchByAllele, bool isArray, int schemaVersion, bool isPositional, bool skipIncorrectRefEntries = true, bool throwErrorOnConflicts = false, int blockSize = SaCommon.DefaultBlockSize)
        {
            _stream                  = writer.BaseStream;
            _writer                  = writer;
            _isPositional            = isPositional;
            _skipIncorrectRefEntries = skipIncorrectRefEntries;
            _throwErrorOnConflicts   = throwErrorOnConflicts;
            _block       = new NsaBlock(new Zstandard(), blockSize);
            _refProvider = refProvider;

            _index     = new ChunkedIndex(indexWriter, refProvider.Assembly, version, jsonKey, matchByAllele, isArray, schemaVersion, isPositional);
            _memBuffer = new byte[short.MaxValue * 2];
            _memStream = new MemoryStream(_memBuffer);
            _memWriter = new ExtendedBinaryWriter(_memStream);
        }
Пример #2
0
        //todo: filter chromIndex=ushort.Max
        public NsaWriter(Stream nsaStream, Stream indexStream, IDataSourceVersion version, ISequenceProvider refProvider, string jsonKey, bool matchByAllele, bool isArray, int schemaVersion, bool isPositional, bool skipIncorrectRefEntries = true, bool throwErrorOnConflicts = false, int blockSize = SaCommon.DefaultBlockSize, GenomeAssembly assembly = GenomeAssembly.Unknown, bool leaveOpen = false)
        {
            _stream                  = nsaStream;
            _indexStream             = indexStream;
            _writer                  = new ExtendedBinaryWriter(_stream, System.Text.Encoding.Default, leaveOpen);
            _indexWriter             = new ExtendedBinaryWriter(_indexStream, System.Text.Encoding.Default, leaveOpen);
            _isPositional            = isPositional;
            _skipIncorrectRefEntries = skipIncorrectRefEntries;
            _throwErrorOnConflicts   = throwErrorOnConflicts;
            _refProvider             = refProvider;
            _leaveOpen               = leaveOpen;

            assembly = _refProvider?.Assembly ?? assembly;

            _block     = new NsaBlock(new Zstandard(), blockSize);
            _index     = new NsaIndex(_indexWriter, assembly, version, jsonKey, matchByAllele, isArray, schemaVersion, isPositional);
            _memBuffer = new byte[blockSize];
            _memStream = new MemoryStream(_memBuffer);
            _memWriter = new ExtendedBinaryWriter(_memStream);
        }