Esempio n. 1
0
        public GeneFusionUtilitiesTests()
        {
            IGene mzt2BGene = new Gene(ChromosomeUtilities.Chr2, 0, 0, false, "MZT2B", 0, CompactId.Empty, CompactId.Empty);
            IGene mzt2AGene = new Gene(ChromosomeUtilities.Chr2, 0, 0, true, "MZT2A", 0, CompactId.Empty, CompactId.Empty);

            var transcriptRegions = new ITranscriptRegion[5];

            transcriptRegions[0] = new TranscriptRegion(TranscriptRegionType.Exon, 1, 130181729, 130181797, 1, 61);
            transcriptRegions[1] = new TranscriptRegion(TranscriptRegionType.Intron, 1, 130181798, 130182626, 61, 62);
            transcriptRegions[2] = new TranscriptRegion(TranscriptRegionType.Exon, 2, 130182627, 130182775, 62, 210);
            transcriptRegions[3] = new TranscriptRegion(TranscriptRegionType.Intron, 2, 130182776, 130190468, 210, 211);
            transcriptRegions[4] = new TranscriptRegion(TranscriptRegionType.Exon, 3, 130190469, 130190713, 211, 455);

            var codingRegion = new CodingRegion(130181737, 130190626, 1, 368, 369);
            var translation  = new Translation(codingRegion, CompactId.Empty, null);

            _enst00000425361 = new Transcript(ChromosomeUtilities.Chr2, 130181737, 130190713, CompactId.Convert("ENST00000425361", 5), translation, BioType.other,
                                              mzt2BGene, 0, 0, false, transcriptRegions, 0, null, 0, 0, Source.Ensembl, false, false, null, null);
            _originTranscripts = new[] { _enst00000425361 };

            var transcriptRegions2 = new ITranscriptRegion[10];

            transcriptRegions2[0] = new TranscriptRegion(TranscriptRegionType.Exon, 5, 131464900, 131465047, 532, 679);
            transcriptRegions2[1] = new TranscriptRegion(TranscriptRegionType.Intron, 4, 131465048, 131470205, 531, 532);
            transcriptRegions2[2] = new TranscriptRegion(TranscriptRegionType.Exon, 4, 131470206, 131470343, 394, 531);
            transcriptRegions2[3] = new TranscriptRegion(TranscriptRegionType.Intron, 3, 131470344, 131472067, 393, 394);
            transcriptRegions2[4] = new TranscriptRegion(TranscriptRegionType.Exon, 3, 131472068, 131472182, 279, 393);
            transcriptRegions2[5] = new TranscriptRegion(TranscriptRegionType.Intron, 2, 131472183, 131491875, 278, 279);
            transcriptRegions2[6] = new TranscriptRegion(TranscriptRegionType.Exon, 2, 131491876, 131492024, 130, 278);
            transcriptRegions2[7] = new TranscriptRegion(TranscriptRegionType.Intron, 1, 131492025, 131492206, 129, 130);
            transcriptRegions2[8] = new TranscriptRegion(TranscriptRegionType.Exon, 1, 131492207, 131492335, 1, 129);
            transcriptRegions2[9] = new TranscriptRegion(TranscriptRegionType.Intron, 0, 131492336, 131492341, 0, 0);

            var codingRegion2 = new CodingRegion(131470316, 131492335, 1, 421, 423);
            var translation2  = new Translation(codingRegion2, CompactId.Empty, null);

            _enst00000427024 = new Transcript(ChromosomeUtilities.Chr2, 131464900, 131492335, CompactId.Convert("ENST00000427024", 5), translation2, BioType.other,
                                              mzt2AGene, 0, 0, false, transcriptRegions2, 0, null, 0, 0, Source.Ensembl, false, false, null, null);

            var transcriptRegions3 = new ITranscriptRegion[5];

            transcriptRegions3[0] = new TranscriptRegion(TranscriptRegionType.Exon, 3, 131483960, 131484218, 366, 624);
            transcriptRegions3[1] = new TranscriptRegion(TranscriptRegionType.Intron, 2, 131484219, 131491875, 365, 366);
            transcriptRegions3[2] = new TranscriptRegion(TranscriptRegionType.Exon, 2, 131491876, 131492024, 217, 365);
            transcriptRegions3[3] = new TranscriptRegion(TranscriptRegionType.Intron, 1, 131492025, 131492206, 216, 217);
            transcriptRegions3[4] = new TranscriptRegion(TranscriptRegionType.Exon, 1, 131492207, 131492422, 1, 216);

            var codingRegion3 = new CodingRegion(131484061, 131492376, 47, 523, 477);
            var translation3  = new Translation(codingRegion3, CompactId.Empty, null);

            var enst00000309451 = new Transcript(ChromosomeUtilities.Chr2, 131483960, 131492422, CompactId.Convert("ENST00000309451", 6), translation3, BioType.other,
                                                 mzt2AGene, 0, 0, false, transcriptRegions3, 0, null, 0, 0, Source.Ensembl, false, false, null, null);

            _partnerTranscripts = new[] { _enst00000427024, enst00000309451 };
        }
Esempio n. 2
0
        public void FixExonEndpointInsertion_VariantStart_ExonStart_Forward()
        {
            var startRegion = new TranscriptRegion(TranscriptRegionType.Exon, 2, 99459243, 99459360, 108, 225);
            var endRegion   = new TranscriptRegion(TranscriptRegionType.Intron, 1, 99456512, 99459242, 107, 108);

            var result = MappedPositionUtilities.FixExonEndpointInsertion(108, -1, false, startRegion, endRegion,
                                                                          new Interval(99459243, 99459242));

            Assert.Equal(108, result.CdnaStart);
            Assert.Equal(107, result.CdnaEnd);
        }
Esempio n. 3
0
        public void FixExonEndpointInsertion_VariantEnd_ExonEnd_Forward()
        {
            var startRegion = new TranscriptRegion(TranscriptRegionType.Intron, 16, 89521770, 89528546, 3071, 3072);
            var endRegion   = new TranscriptRegion(TranscriptRegionType.Exon, 16, 89521614, 89521769, 2916, 3071);

            var result = MappedPositionUtilities.FixExonEndpointInsertion(-1, 3071, false, startRegion, endRegion,
                                                                          new Interval(89521770, 89521769));

            Assert.Equal(3072, result.CdnaStart);
            Assert.Equal(3071, result.CdnaEnd);
        }
Esempio n. 4
0
        public void FixExonEndpointInsertion_VariantEnd_ExonEnd_Reverse()
        {
            var startRegion = new TranscriptRegion(TranscriptRegionType.Intron, 7, 243736351, 243776972, 762, 763);
            var endRegion   = new TranscriptRegion(TranscriptRegionType.Exon, 8, 243736228, 243736350, 763, 885);

            var result = MappedPositionUtilities.FixExonEndpointInsertion(-1, 763, true, startRegion, endRegion,
                                                                          new Interval(243736351, 243736350));

            Assert.Equal(762, result.CdnaStart);
            Assert.Equal(763, result.CdnaEnd);
        }
Esempio n. 5
0
        private static ITranscriptRegion[] GetTranscriptRegions()
        {
            var regions = new ITranscriptRegion[5];

            regions[0] = new TranscriptRegion(TranscriptRegionType.Exon, 1, 100, 199, 300, 399);
            regions[1] = new TranscriptRegion(TranscriptRegionType.Intron, 1, 200, 299, 400, 499);
            regions[2] = new TranscriptRegion(TranscriptRegionType.Exon, 2, 300, 399, 500, 599);
            regions[3] = new TranscriptRegion(TranscriptRegionType.Intron, 2, 400, 499, 600, 699);
            regions[4] = new TranscriptRegion(TranscriptRegionType.Exon, 3, 500, 599, 700, 799);
            return(regions);
        }
        /// <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, () => Interval.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));
        }
Esempio n. 7
0
        public void FixExonEndpointInsertion_VariantStart_ExonStart_Reverse()
        {
            // N.B. this configuration has never been spotted in the wild
            var startRegion = new TranscriptRegion(TranscriptRegionType.Exon, 2, 2000, 2199, 1, 200);
            var endRegion   = new TranscriptRegion(TranscriptRegionType.Intron, 2, 1999, 1000, 200, 201);

            var result = MappedPositionUtilities.FixExonEndpointInsertion(200, -1, true, startRegion, endRegion,
                                                                          new Interval(2000, 1999));

            Assert.Equal(200, result.CdnaStart);
            Assert.Equal(201, result.CdnaEnd);
        }
        private static ITranscriptRegion[] ToInterfaceArray(this IReadOnlyList <MutableTranscriptRegion> mutableRegions)
        {
            var regions = new ITranscriptRegion[mutableRegions.Count];

            for (var i = 0; i < mutableRegions.Count; i++)
            {
                var region = mutableRegions[i];
                regions[i] = new TranscriptRegion(region.Type, region.Id, region.Start, region.End, region.CdnaStart,
                                                  region.CdnaEnd);
            }
            return(regions);
        }
Esempio n. 9
0
        public void ApplyDuplicationAdjustments_NonCoding_Reverse()
        {
            var regions = new ITranscriptRegion[3];

            regions[0] = new TranscriptRegion(TranscriptRegionType.Exon, 2, 20976856, 20977050, 154, 348);
            regions[1] = new TranscriptRegion(TranscriptRegionType.Intron, 1, 20977051, 20977054, 153, 154);
            regions[2] = new TranscriptRegion(TranscriptRegionType.Exon, 1, 20977055, 20977207, 1, 153);

            var observedResults = regions.ShiftDuplication(20977006, "AACT", true);

            Assert.Equal("AACT", observedResults.RefAllele);
            Assert.Equal(20977009, observedResults.Start);
            Assert.Equal(20977006, observedResults.End);
        }
Esempio n. 10
0
        public void ApplyDuplicationAdjustments_Coding_Forward()
        {
            var regions = new ITranscriptRegion[41];

            for (int i = 0; i < 22; i++)
            {
                regions[i] = new TranscriptRegion(TranscriptRegionType.Exon, 0, 107000000, 107334926, 1, 1564);
            }
            for (int i = 23; i < regions.Length; i++)
            {
                regions[i] = new TranscriptRegion(TranscriptRegionType.Exon, 0, 107335162, 108000000, 1662, 1700);
            }
            regions[21] = new TranscriptRegion(TranscriptRegionType.Intron, 11, 107334926, 107335065, 1565, 1566);
            regions[22] = new TranscriptRegion(TranscriptRegionType.Exon, 12, 107335066, 107335161, 1566, 1661);

            var observedResults = regions.ShiftDuplication(107335068, "AGTC", false);

            Assert.Equal("AGTC", observedResults.RefAllele);
            Assert.Equal(107335064, observedResults.Start);
            Assert.Equal(107335067, observedResults.End);
        }
Esempio n. 11
0
        public void TranscriptRegion_EndToEnd()
        {
            var expectedResults = new ITranscriptRegion[]
            {
                new TranscriptRegion(TranscriptRegionType.Exon, 13, 100, 200, 300, 400),
                new TranscriptRegion(TranscriptRegionType.Gap, 0, 120, 230, 10, 20),
                new TranscriptRegion(TranscriptRegionType.Intron, 14, 130, 230, 330, 430)
            };

            var observedResults = new ITranscriptRegion[expectedResults.Length];

            using (var ms = new MemoryStream())
            {
                using (var writer = new ExtendedBinaryWriter(ms, Encoding.UTF8, true))
                {
                    foreach (var region in expectedResults)
                    {
                        region.Write(writer);
                    }
                }

                ms.Position = 0;

                using (var reader = new BufferedBinaryReader(ms))
                {
                    for (int i = 0; i < expectedResults.Length; i++)
                    {
                        observedResults[i] = TranscriptRegion.Read(reader);
                    }
                }
            }

            var comparer = new TranscriptRegionComparer();

            Assert.Equal(expectedResults, observedResults, comparer);
        }