Esempio n. 1
0
            public static Phenotype ReadPhenotype(ExtendedBinaryReader reader)
            {
                var mimNumber    = reader.ReadOptInt32();
                var phenotype    = reader.ReadAsciiString();
                var mapping      = (Mapping)reader.ReadByte();
                var comments     = (Comments)reader.ReadByte();
                var inheritance  = reader.ReadOptArray(reader.ReadAsciiString);
                var inheritances = inheritance == null ? null : new HashSet <string>(inheritance);

                return(new Phenotype(mimNumber, phenotype, mapping, comments, inheritances));
            }
Esempio n. 2
0
        public void ReadOptArray_NoElements()
        {
            string[] observedStrings;

            using (var ms = new MemoryStream())
            {
                using (var writer = new ExtendedBinaryWriter(ms, Encoding.UTF8, true))
                {
                    writer.WriteOptArray(null as string[], writer.WriteOptAscii);
                }

                ms.Position = 0;

                using (var reader = new ExtendedBinaryReader(ms))
                {
                    observedStrings = reader.ReadOptArray(reader.ReadAsciiString);
                }
            }

            Assert.Null(observedStrings);
        }
Esempio n. 3
0
        public void ReadOptArray_ThreeElements()
        {
            var expectedStrings = new[] { "Huey", "Duey", "Louie" };

            string[] observedStrings;

            using (var ms = new MemoryStream())
            {
                using (var writer = new ExtendedBinaryWriter(ms, Encoding.UTF8, true))
                {
                    writer.WriteOptArray(expectedStrings, writer.WriteOptAscii);
                }

                ms.Position = 0;

                using (var reader = new ExtendedBinaryReader(ms))
                {
                    observedStrings = reader.ReadOptArray(reader.ReadAsciiString);
                }
            }

            Assert.Equal(expectedStrings, observedStrings);
        }
Esempio n. 4
0
        public ClinVarItem(ExtendedBinaryReader reader)
        {
            _alleleOrigins = reader.ReadOptArray(reader.ReadAsciiString)?.ToList();
            SaAltAllele    = reader.ReadAsciiString();
            AltAllele      = SaAltAllele != null?SupplementaryAnnotationUtilities.ReverseSaReducedAllele(SaAltAllele) : "";                 // A

            ReferenceAllele = reader.ReadAsciiString();
            ID               = reader.ReadAsciiString();
            ReviewStatus     = (ReviewStatusEnum)reader.ReadByte();
            IsAlleleSpecific = reader.ReadAsciiString();
            _medgenIds       = reader.ReadOptArray(reader.ReadAsciiString)?.ToList();
            _omimIds         = reader.ReadOptArray(reader.ReadAsciiString)?.ToList();
            _orphanetIds     = reader.ReadOptArray(reader.ReadAsciiString)?.ToList();
            _phenotypes      = reader.ReadOptArray(reader.ReadUtf8String)?.ToList();
            Significance     = reader.ReadAsciiString();
            LastUpdatedDate  = reader.ReadOptInt64();
            _pubmedIds       = reader.ReadOptArray(reader.ReadOptInt64)?.ToList();
        }