// close BAM file public override void Close() { if (!IsOpen) { return; } IsOpen = false; _header = ""; _reader.Close(); BgzfFileStream.Close(); }
// close Bgzipped file public override void Close() { if (!IsOpen) { return; } IsOpen = false; 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(); } // flush the current BGZF block FlushBlock(); // write an empty block (as EOF marker) FlushSingleBlock(); _writer.Close(); BgzfFileStream.Close(); }