Example #1
0
        public void ReadItems_EndToEnd()
        {
            var expectedStrings = new[] { "Huey", "Duey", "Louie" };

            string[] observedStrings;

            using (var ms = new MemoryStream())
            {
                // ReSharper disable AccessToDisposedClosure
                using (var writer = new ExtendedBinaryWriter(ms, Encoding.UTF8, true))
                {
                    TranscriptCacheWriter.WriteItems(writer, expectedStrings, x => writer.WriteOptAscii(x));
                }

                ms.Position = 0;

                using (var reader = new BufferedBinaryReader(ms))
                {
                    observedStrings = TranscriptCacheReader.ReadItems(reader, () => reader.ReadAsciiString());
                }
                // ReSharper restore AccessToDisposedClosure
            }

            Assert.NotNull(observedStrings);
            Assert.Equal(expectedStrings, observedStrings);
        }
Example #2
0
        public static IRnaEdit Read(BufferedBinaryReader reader)
        {
            int    start = reader.ReadOptInt32();
            int    end   = reader.ReadOptInt32();
            string bases = reader.ReadAsciiString();

            return(new RnaEdit(start, end, bases));
        }
Example #3
0
        /// <summary>
        /// parses the database cache file and populates the specified lists and interval trees
        /// </summary>
        public TranscriptCacheData Read(IDictionary <ushort, IChromosome> refIndexToChromosome)
        {
            var genes             = ReadItems(_reader, () => Gene.Read(_reader, refIndexToChromosome));
            var transcriptRegions = ReadItems(_reader, () => TranscriptRegion.Read(_reader));
            var mirnas            = ReadItems(_reader, () => IntervalExtensions.Read(_reader));
            var peptideSeqs       = ReadItems(_reader, () => _reader.ReadAsciiString());
            var regulatoryRegions = ReadIntervals(_reader, () => RegulatoryRegion.Read(_reader, refIndexToChromosome));
            var transcripts       = ReadIntervals(_reader, () => Transcript.Read(_reader, refIndexToChromosome, genes, transcriptRegions, mirnas, peptideSeqs));

            return(new TranscriptCacheData(Header, genes, transcriptRegions, mirnas, peptideSeqs, transcripts, regulatoryRegions));
        }