/// <summary> /// writes the annotations to the current database file /// </summary> internal void Write(Prediction.Entry[] lut, Prediction[][] predictionsPerRef) { _blockStream.WriteHeader(_header.Write); WriteLookupTable(_writer, lut); _blockStream.Flush(); WritePredictions(predictionsPerRef); }
private static void WriteBlockStream(ICompressionAlgorithm compressionAlgorithm, CacheHeader header, DemoCustomHeader customHeader, MemoryStream ms, string s) { using (var blockStream = new BlockStream(compressionAlgorithm, ms, CompressionMode.Compress, true)) using (var writer = new ExtendedBinaryWriter(blockStream)) { CheckReadException(blockStream); blockStream.WriteHeader(header.Write); var bp = new BlockStream.BlockPosition(); // detect that we have written a block blockStream.GetBlockPosition(bp); writer.WriteOptAscii(s); blockStream.GetBlockPosition(bp); // here we write a test string that won't invoke a new block blockStream.GetBlockPosition(customHeader.DemoPosition); writer.WriteOptAscii(SmallString); blockStream.GetBlockPosition(bp); Assert.Equal(customHeader.DemoPosition.FileOffset, blockStream.Position); blockStream.Flush(); // this will be flushed during dispose writer.WriteOptAscii(FinalString); } }
/// <summary> /// writes the annotations to the current database file /// </summary> public void Write(Prediction.Entry[] lut, Prediction[][] predictionsPerRef) { // write the header _blockStream.WriteHeader(_header); // write the LUT WriteLookupTable(_writer, lut); _blockStream.Flush(); // write the predictions WritePredictions(predictionsPerRef); }
/// <summary> /// writes the annotations to the current database file /// </summary> public void Write(DataStructures.GlobalCache cache) { // write the header _blockStream.WriteHeader(_header); // write out each of our arrays WriteItems(cache.RegulatoryElements); WriteItems(cache.Genes); WriteItems(cache.Introns); WriteItems(cache.MicroRnas); WriteItems(cache.PeptideSeqs); // write our transcripts WriteTranscripts(cache); }
/// <summary> /// writes the annotations to the current database file /// </summary> public void Write(TranscriptCacheData cacheData) { _blockStream.WriteHeader(_header.Write); WriteItems(_writer, cacheData.Genes, x => x.Write(_writer)); WriteItems(_writer, cacheData.TranscriptRegions, x => x.Write(_writer)); WriteItems(_writer, cacheData.Mirnas, x => x.Write(_writer)); WriteItems(_writer, cacheData.PeptideSeqs, x => _writer.WriteOptAscii(x)); var geneComparer = new GeneComparer(); var transcriptRegionComparer = new TranscriptRegionComparer(); var intervalComparer = new IntervalComparer(); var geneIndices = CreateIndex(cacheData.Genes, geneComparer); var transcriptRegionIndices = CreateIndex(cacheData.TranscriptRegions, transcriptRegionComparer); var microRnaIndices = CreateIndex(cacheData.Mirnas, intervalComparer); var peptideIndices = CreateIndex(cacheData.PeptideSeqs, EqualityComparer <string> .Default); WriteIntervals(_writer, cacheData.RegulatoryRegionIntervalArrays, x => x.Write(_writer)); WriteIntervals(_writer, cacheData.TranscriptIntervalArrays, x => x.Write(_writer, geneIndices, transcriptRegionIndices, microRnaIndices, peptideIndices)); }
private static void WriteBlockStream(ICompressionAlgorithm compressionAlgorithm, DemoHeader header, DemoCustomHeader customHeader, Stream ms, string s) { using (var blockStream = new BlockStream(compressionAlgorithm, ms, CompressionMode.Compress, true)) using (var writer = new ExtendedBinaryWriter(blockStream)) { CheckReadException(blockStream); blockStream.WriteHeader(header.Write); writer.WriteOptAscii(s); (customHeader.FileOffset, customHeader.InternalOffset) = blockStream.GetBlockPosition(); Assert.Equal(customHeader.FileOffset, blockStream.Position); writer.WriteOptAscii(SmallString); blockStream.Flush(); // this will be flushed during dispose writer.WriteOptAscii(FinalString); } }