Beispiel #1
0
        /// <summary>
        /// assigns the reference and alternate codons [TranscriptVariationAllele.pm:259 codon]
        /// </summary>
        public static void Assign(TranscriptAnnotation ta, Transcript transcript, ICompressedSequence compressedSequence)
        {
            // sanity check: make sure this is a coding region
            if (!(ta.HasValidCdsEnd && ta.HasValidCdsStart))
            {
                ta.ReferenceCodon = null;
                ta.AlternateCodon = null;
                return;
            }

            // calculate necessary coordinates and lengths
            int aminoAcidStart = ta.ProteinBegin * 3 - 2;
            int aminoAcidEnd   = ta.ProteinEnd * 3;

            int prefixLen = ta.CodingDnaSequenceBegin - aminoAcidStart;
            int suffixLen = aminoAcidEnd - ta.CodingDnaSequenceEnd;

            var codingSequence = new CodingSequence(compressedSequence, transcript.Translation.CodingRegion.GenomicStart,
                                                    transcript.Translation.CodingRegion.GenomicEnd, transcript.CdnaMaps, transcript.Gene.OnReverseStrand,
                                                    transcript.StartExonPhase);
            var aminoAcidSeq = codingSequence.Sequence();

            int start1 = aminoAcidStart - 1;
            int start2 = aminoAcidEnd - suffixLen;

            int maxSuffixLen = aminoAcidSeq.Length - start2;

            bool atTailEnd = false;

            if (suffixLen > maxSuffixLen)
            {
                suffixLen = maxSuffixLen;
                atTailEnd = true;
            }

            if (start1 < 0)
            {
                start1 = 0;
            }
            if (start2 < 0)
            {
                start2 = 0;
            }
            if (prefixLen < 0)
            {
                prefixLen = 0;
            }

            string prefix = start1 + prefixLen < aminoAcidSeq.Length
                ? aminoAcidSeq.Substring(start1, prefixLen).ToLower()
                : "AAA";

            string suffix = suffixLen > 0
                ? aminoAcidSeq.Substring(start2, suffixLen).ToLower()
                : "";

            ta.HasFrameShift  = false;
            ta.ReferenceCodon = GetCodon(ta.TranscriptReferenceAllele, prefix, suffix, ref ta.HasFrameShift, atTailEnd);
            ta.AlternateCodon = GetCodon(ta.TranscriptAlternateAllele, prefix, suffix, ref ta.HasFrameShift, atTailEnd);
        }
        private void LocateExonIntron(Transcript transcript, int pos)
        {
            var exons = transcript.CdnaMaps;

            if (pos < exons.First().GenomicStart || pos > exons.Last().GenomicEnd)
            {
                return;
            }

            var startIdx = 0;

            while (startIdx < exons.Length)
            {
                if (pos > exons[startIdx].GenomicEnd)
                {
                    startIdx++;
                }
                if (pos < exons[startIdx].GenomicStart)
                {
                    Intron = transcript.Gene.OnReverseStrand ? exons.Length - startIdx : startIdx;
                    return;
                }

                if (pos <= exons[startIdx].GenomicEnd)
                {
                    Exon = transcript.Gene.OnReverseStrand ? exons.Length - startIdx : startIdx + 1;
                    return;
                }
            }
        }
        private static string MapCdnaPosition(Transcript transcript, int breakendPosition)
        {
            if (breakendPosition > transcript.End || breakendPosition < transcript.Start)
            {
                return(null);
            }

            var startIdx = 0;
            var endIdx   = transcript.CdnaMaps.Length - 1;

            while (startIdx <= endIdx)
            {
                if (transcript.CdnaMaps[startIdx].GenomicEnd >= breakendPosition)
                {
                    break;
                }
                startIdx++;
            }

            var inExon = breakendPosition >= transcript.CdnaMaps[startIdx].GenomicStart;

            if (inExon)
            {
                var pos = ConvertGenomicPosToCodingPos(breakendPosition, transcript.CdnaMaps[startIdx],
                                                       transcript.Gene.OnReverseStrand, transcript.Translation.CodingRegion.CdnaStart, transcript.Translation.CodingRegion.CdnaEnd);
                return(pos);
            }

            var distance1 = breakendPosition - transcript.CdnaMaps[startIdx - 1].GenomicEnd;
            var distance2 = transcript.CdnaMaps[startIdx].GenomicStart - breakendPosition;

            var distance      = distance1;
            var mappedExonIdx = startIdx - 1;
            var mappedExonPos = transcript.CdnaMaps[startIdx - 1].GenomicEnd;
            var orientation   = transcript.Gene.OnReverseStrand ? '-' : '+';

            if (distance1 > distance2)
            {
                distance      = distance2;
                mappedExonIdx = startIdx;
                mappedExonPos = transcript.CdnaMaps[startIdx].GenomicStart;
                orientation   = transcript.Gene.OnReverseStrand ? '+' : '-';
            }

            var exonPos = ConvertGenomicPosToCodingPos(mappedExonPos, transcript.CdnaMaps[mappedExonIdx],
                                                       transcript.Gene.OnReverseStrand, transcript.Translation.CodingRegion.CdnaStart, transcript.Translation.CodingRegion.CdnaEnd);

            return(exonPos + orientation + distance);
        }
        public BreakendTranscriptAnnotation(Transcript transcript, int breakendPosition, char isBreakendSuffix)
        {
            var transcriptId = TranscriptUtilities.GetTranscriptId(transcript);

            TranscriptDataSource = transcript.TranscriptSource;

            GeneName = transcript.Gene.Symbol;

            if (transcript.Translation == null || breakendPosition < transcript.Translation.CodingRegion.GenomicStart || breakendPosition > transcript.Translation.CodingRegion.GenomicEnd)
            {
                InCodingRegion = false;
                return;
            }

            InCodingRegion = true;
            var transcriptCdnaLength = transcript.Translation.CodingRegion.CdnaEnd - transcript.Translation.CodingRegion.CdnaStart + 1;

            _referenceName = "chr";
            _codingStart   = transcript.Translation.CodingRegion.GenomicStart;
            _codingEnd     = transcript.Translation.CodingRegion.GenomicEnd;

            // map cdn position
            var complementaryCdnaPosDescription = MapCdnaPosition(transcript, breakendPosition);

            LocateExonIntron(transcript, breakendPosition);

            var transcriptOrientation = transcript.Gene.OnReverseStrand ? '-' : '+';

            ConsistentOrientation = transcriptOrientation == isBreakendSuffix;

            if (ConsistentOrientation)
            {
                HgvsDescription = GeneName + "{" + transcriptId + "}" + ":c." + complementaryCdnaPosDescription + "_" +
                                  transcriptCdnaLength;
            }
            else
            {
                HgvsDescription = GeneName + "{" + transcriptId + "}" + ":c." + 1 + "_" + complementaryCdnaPosDescription;
            }
        }
Beispiel #5
0
        public bool CheckForDuplicationForAltAlleleWithinTranscript(ICompressedSequence compressedSequence, Transcript transcript)
        {
            if (VepVariantType != VariantType.insertion)
            {
                return(false);
            }
            int    altAlleleLen = AlternateAllele.Length;
            string compareRegion;

            if (transcript.Gene.OnReverseStrand)
            {
                if (End + altAlleleLen > transcript.End)
                {
                    return(false);
                }
                compareRegion = compressedSequence.Substring(Start - 1, altAlleleLen);
            }
            else
            {
                if (Start - altAlleleLen < transcript.Start)
                {
                    return(false);
                }
                compareRegion = compressedSequence.Substring(End - altAlleleLen, altAlleleLen);
            }

            if (compareRegion == AlternateAllele)
            {
                return(true);
            }
            return(false);
        }