Beispiel #1
0
        // close BAM file
        public override void Close()
        {
            if (!IsOpen)
            {
                return;
            }
            IsOpen = false;

            _header = "";
            _reader.Dispose();        //.net core changes
            BgzfFileStream.Dispose(); //.net core changes
        }
Beispiel #2
0
        // close BAM file
        public override void Close()
        {
            if (!IsOpen)
            {
                return;
            }
            IsOpen = false;

            _header = "";

            _reader.Close();
            BgzfFileStream.Close();
        }
Beispiel #3
0
        // returns file pointer to beginning of alignments
        public void Rewind()
        {
            BlockLength  = 0;
            BlockOffset  = (int)(_alignmentsOffset & 0xFFFF);
            BlockAddress = (_alignmentsOffset >> 16) & 0xFFFFFFFFFFFF;

            try
            {
                BgzfFileStream.Seek(BlockAddress, SeekOrigin.Begin);
            }
            catch (IOException e)
            {
                throw new ApplicationException(string.Format("ERROR: Unable to seek in the BAM file: {0}", e.Message));
            }
        }
Beispiel #4
0
        // close Bgzipped file
        public override void Close()
        {
            if (!IsOpen)
            {
                return;
            }
            IsOpen = false;

            // flush the current BGZF block
            FlushBlock();

            if (_compressQueue != null)
            {
                // Signal that we're not going to add any more data to the queue.
                _compressQueue.CompleteAdding();

                // Wait for our compression threads to finish.
                int numCompressionThreads = _compressionThreads.Length;
                for (int i = 0; i < numCompressionThreads; ++i)
                {
                    _compressionThreads[i].Join();
                }

                // Signal to the writing thread that compression is complete.
                _writeQueue.CompleteAdding();

                // Wait for the writing thread to finish.
                _writingThread.Join();
            }

            // write an empty block (as EOF marker)
            FlushSingleBlock();

            //_writer.Close(); not supported with .net core
            //BgzfFileStream.Close();not supported with .net core
            _writer.Dispose();
            BgzfFileStream.Dispose();
        }