Ejemplo n.º 1
0
        // ReSharper disable once UnusedParameter.Local
        private static void CheckString(IExtendedBinaryReader reader, string expectedString)
        {
            string s = reader.ReadAsciiString();

            Assert.NotNull(s);
            Assert.Equal(expectedString.Length, s.Length);
            Assert.Equal(expectedString, s);
        }
Ejemplo n.º 2
0
        public static IGene Read(IExtendedBinaryReader 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));
        }
Ejemplo n.º 3
0
        public static IAnnotatedGene Read(IExtendedBinaryReader reader)
        {
            var geneName         = reader.ReadAsciiString();
            var annotationLength = reader.ReadOptInt32();
            var annotations      = new IGeneAnnotationSource[annotationLength];

            for (int i = 0; i < annotationLength; i++)
            {
                annotations[i] = GeneAnnotationSource.Read(reader);
            }

            return(geneName == NullGene ? null : new AnnotatedGene(geneName, annotations));
        }
Ejemplo n.º 4
0
        public static IGeneAnnotationSource Read(IExtendedBinaryReader reader)
        {
            var dataSource       = reader.ReadAsciiString();
            var isArray          = reader.ReadBoolean();
            var jsonStringLength = reader.ReadOptInt32();
            var jsonStrings      = new string[jsonStringLength];

            for (int i = 0; i < jsonStringLength; i++)
            {
                jsonStrings[i] = reader.ReadString();
            }

            return(new GeneAnnotationSource(dataSource, jsonStrings, isArray));
        }
Ejemplo n.º 5
0
        private JasixIndex(IExtendedBinaryReader reader) : this()
        {
            var version = reader.ReadOptInt32();

            if (version != JasixCommons.Version)
            {
                throw new InvalidDataException($"Invalid Jasix version: Observed {version}, expected{JasixCommons.Version}");
            }

            HeaderLine = reader.ReadAsciiString();
            var count = reader.ReadOptInt32();

            for (var i = 0; i < count; i++)
            {
                var chrIndex = new JasixChrIndex(reader);
                _chrIndices[chrIndex.ReferenceSequence] = chrIndex;
            }
        }
Ejemplo n.º 6
0
        public JasixChrIndex(IExtendedBinaryReader reader) : this("")
        {
            ReferenceSequence = reader.ReadAsciiString();
            var count = reader.ReadOptInt32();

            for (var i = 0; i < count; i++)
            {
                _nodes.Add(new JasixNode(reader));
            }

            var intervalCount = reader.ReadOptInt32();

            if (intervalCount == 0)
            {
                return;
            }

            for (var i = 0; i < intervalCount; i++)
            {
                _largeVariants.Add(ReadInterval(reader));
            }

            _intervalArray = new IntervalArray <long>(_largeVariants.ToArray());
        }