Esempio n. 1
0
        public static IInterval Read(IBufferedBinaryReader reader)
        {
            int start = reader.ReadOptInt32();
            int end   = reader.ReadOptInt32();

            return(new Interval(start, end));
        }
Esempio n. 2
0
        private static IntervalArray <T>[] ReadIntervals <T>(IBufferedBinaryReader reader, Func <T> readMethod) where T : IInterval
        {
            var numRefSeqs     = reader.ReadOptInt32();
            var intervalArrays = new IntervalArray <T> [numRefSeqs];

            for (int refSeqIndex = 0; refSeqIndex < numRefSeqs; refSeqIndex++)
            {
                var numItems = reader.ReadOptInt32();
                if (numItems == 0)
                {
                    continue;
                }

                var intervals = new Interval <T> [numItems];

                for (int i = 0; i < numItems; i++)
                {
                    var item = readMethod();
                    intervals[i] = new Interval <T>(item.Start, item.End, item);
                }

                intervalArrays[refSeqIndex] = new IntervalArray <T>(intervals);
            }

            CheckGuard(reader);
            return(intervalArrays);
        }
Esempio n. 3
0
        public static IRegulatoryRegion Read(IBufferedBinaryReader reader, IDictionary <ushort, IChromosome> chromosomeIndexDictionary)
        {
            var refIndex = reader.ReadOptUInt16();
            int start    = reader.ReadOptInt32();
            int end      = reader.ReadOptInt32();
            var type     = (RegulatoryRegionType)reader.ReadByte();
            var id       = CompactId.Read(reader);

            return(new RegulatoryRegion(chromosomeIndexDictionary[refIndex], start, end, id, type));
        }
Esempio n. 4
0
        public static IGene Read(IBufferedBinaryReader reader, IDictionary <ushort, IChromosome> indexToChromosome)
        {
            ushort referenceIndex  = reader.ReadOptUInt16();
            int    start           = reader.ReadOptInt32();
            int    end             = reader.ReadOptInt32();
            bool   onReverseStrand = reader.ReadBoolean();
            string symbol          = reader.ReadAsciiString();
            int    hgncId          = reader.ReadOptInt32();
            var    entrezId        = CompactId.Read(reader);
            var    ensemblId       = CompactId.Read(reader);

            return(new Gene(indexToChromosome[referenceIndex], start, end, onReverseStrand, symbol, hgncId, entrezId, ensemblId));
        }
Esempio n. 5
0
        private static T[] ReadIndices <T>(IBufferedBinaryReader reader, T[] cachedItems)
        {
            int numItems = reader.ReadOptInt32();
            var items    = new T[numItems];

            for (int i = 0; i < numItems; i++)
            {
                var index = reader.ReadOptInt32();
                items[i] = cachedItems[index];
            }

            return(items);
        }
Esempio n. 6
0
        internal static T[] ReadItems <T>(IBufferedBinaryReader reader, Func <T> readMethod)
        {
            var numItems = reader.ReadOptInt32();
            var items    = new T[numItems];

            for (int i = 0; i < numItems; i++)
            {
                items[i] = readMethod();
            }
            CheckGuard(reader);
            return(items);
        }