Example #1
0
        public void Serialization()
        {
            ICytogeneticBands expectedCytogeneticBands = GetCytogeneticBands();
            ICytogeneticBands observedCytogeneticBands;

            using (var ms = new MemoryStream())
            {
                using (var writer = new ExtendedBinaryWriter(ms, Encoding.UTF8, true))
                {
                    expectedCytogeneticBands.Write(writer);
                }

                ms.Seek(0, SeekOrigin.Begin);

                using (var reader = new ExtendedBinaryReader(ms))
                {
                    var bands = CytogeneticBands.Read(reader);
                    observedCytogeneticBands = new CytogeneticBands(bands, _renamer);
                }
            }

            var expectedCytogeneticBand = expectedCytogeneticBands.GetCytogeneticBand(10, 88400000, 92900000);
            var observedCytogeneticBand = observedCytogeneticBands.GetCytogeneticBand(10, 88400000, 92900000);

            Assert.NotNull(observedCytogeneticBand);
            Assert.Equal(expectedCytogeneticBand, observedCytogeneticBand);
        }
Example #2
0
        /// <summary>
        /// returns true if the specified reference sequence is in the standard reference sequences and in VEP
        /// </summary>
        public void Annotate(IAnnotatedPosition annotatedPosition)
        {
            LoadChromosome(annotatedPosition.Position.Chromosome);
            if (annotatedPosition.AnnotatedVariants == null)
            {
                return;
            }

            annotatedPosition.CytogeneticBand = _cytogeneticBands.GetCytogeneticBand(annotatedPosition.Position.Chromosome, annotatedPosition.Position.Start,
                                                                                     annotatedPosition.Position.End);

            if (annotatedPosition.Position.Chromosome.UcscName != "chrM")
            {
                return;
            }
            const string assertionNumber = "NC_012920.1";

            foreach (var annotatedVariant in annotatedPosition.AnnotatedVariants)
            {
                annotatedVariant.HgvsgNotation = HgvsgNotation.GetNotation(assertionNumber, annotatedVariant.Variant, Sequence, new Interval(0, Sequence.Length));
            }
        }