Ejemplo n.º 1
0
        public void DetermineExonicEffect(ITranscript transcript, IInterval variant, IMappedPosition position,
                                          int coveredCdnaStart, int coveredCdnaEnd, int coveredCdsStart, int coveredCdsEnd, string altAllele,
                                          bool startCodonInsertionWithNoImpact)
        {
            HasExonOverlap = position.ExonStart != -1 || position.ExonEnd != -1;

            if (transcript.Translation != null)
            {
                var codingRegion = transcript.Translation.CodingRegion;
                AfterCoding  = IsAfterCoding(variant.Start, variant.End, transcript.End, codingRegion.End);
                BeforeCoding = IsBeforeCoding(variant.Start, variant.End, transcript.Start, codingRegion.Start);
                WithinCds    = IsWithinCds(coveredCdsStart, coveredCdsEnd, codingRegion, variant);
                IsCoding     = !startCodonInsertionWithNoImpact && (position.CdsStart != -1 || position.CdsEnd != -1);
            }

            WithinCdna = IsWithinCdna(coveredCdnaStart, coveredCdnaEnd, transcript.TotalExonLength);

            if (coveredCdsStart != -1 && coveredCdsEnd != -1)
            {
                var varLen    = coveredCdsEnd - coveredCdsStart + 1;
                var alleleLen = altAllele?.Length ?? 0;
                HasFrameShift = position.CdsStart != -1 && position.CdsEnd != -1 && !Codons.IsTriplet(alleleLen - varLen);
            }

            OverlapWithMicroRna = IsMatureMirnaVariant(position.CdnaStart, position.CdnaEnd, transcript.MicroRnas,
                                                       transcript.BioType == BioType.miRNA);
        }
Ejemplo n.º 2
0
        private static TranscriptPositionalEffect GetPositionalEffect(ITranscript transcript, ISimpleVariant variant,
                                                                      IMappedPosition position, string refAminoAcid, string altAminoAcid, int coveredCdnaStart,
                                                                      int coveredCdnaEnd, int coveredCdsStart, int coveredCdsEnd)
        {
            bool startCodonInsertionWithNoImpact = variant.Type == VariantType.insertion &&
                                                   position.ProteinStart <= 1 &&
                                                   altAminoAcid.EndsWith(refAminoAcid);

            var positionalEffect = new TranscriptPositionalEffect();

            positionalEffect.DetermineIntronicEffect(transcript.TranscriptRegions, variant, variant.Type);
            positionalEffect.DetermineExonicEffect(transcript, variant, position, coveredCdnaStart, coveredCdnaEnd,
                                                   coveredCdsStart, coveredCdsEnd, variant.AltAllele, startCodonInsertionWithNoImpact);
            return(positionalEffect);
        }
Ejemplo n.º 3
0
 public AnnotatedTranscript(ITranscript transcript, string referenceAminoAcids, string alternateAminoAcids,
                            string referenceCodons, string alternateCodons, IMappedPosition mappedPosition, string hgvsCoding,
                            string hgvsProtein, PredictionScore sift, PredictionScore polyphen,
                            List <ConsequenceTag> consequences, bool?completeOverlap)
 {
     Transcript          = transcript;
     ReferenceAminoAcids = referenceAminoAcids;
     AlternateAminoAcids = alternateAminoAcids;
     ReferenceCodons     = referenceCodons;
     AlternateCodons     = alternateCodons;
     MappedPosition      = mappedPosition;
     HgvsCoding          = hgvsCoding;
     HgvsProtein         = hgvsProtein;
     Sift            = sift;
     PolyPhen        = polyphen;
     Consequences    = consequences;
     CompleteOverlap = completeOverlap;
 }
Ejemplo n.º 4
0
 public AnnotatedTranscript(ITranscript transcript, string referenceAminoAcids, string alternateAminoAcids,
                            string referenceCodons, string alternateCodons, IMappedPosition mappedPosition, string hgvsCoding,
                            string hgvsProtein, PredictionScore sift, PredictionScore polyphen,
                            IEnumerable <ConsequenceTag> consequences, IGeneFusionAnnotation geneFusionAnnotation)
 {
     Transcript          = transcript;
     ReferenceAminoAcids = referenceAminoAcids;
     AlternateAminoAcids = alternateAminoAcids;
     ReferenceCodons     = referenceCodons;
     AlternateCodons     = alternateCodons;
     MappedPosition      = mappedPosition;
     HgvsCoding          = hgvsCoding;
     HgvsProtein         = hgvsProtein;
     Sift                 = sift;
     PolyPhen             = polyphen;
     Consequences         = consequences;
     GeneFusionAnnotation = geneFusionAnnotation;
     PluginData           = new List <IPluginData>();
 }
Ejemplo n.º 5
0
        private static string GetTranscriptRefAllele(IMappedPosition position, ISequence cdnaSequence, ISimpleVariant variant,
                                                     bool onReverseStrand)
        {
            var variantRef = HgvsUtilities.GetTranscriptAllele(variant.RefAllele, onReverseStrand);

            if (position == null || cdnaSequence == null)
            {
                return(variantRef);
            }
            var start = position.CoveredCdnaStart;
            var end   = position.CoveredCdnaEnd;

            if (start == -1 && end == -1)
            {
                return(variantRef);
            }
            if (start != -1 && end != -1 && end < start)
            {
                Swap.Int(ref start, ref end);
            }

            return(cdnaSequence.Substring(start - 1, end - start + 1));
        }
Ejemplo n.º 6
0
        public static string GetHgvsProteinAnnotation(
            ITranscript transcript,
            string refAminoAcids,
            string altAminoAcids,
            string transcriptAltAllele,
            IMappedPosition position,
            VariantEffect variantEffect,
            ISimpleVariant variant,
            ISequence refSequence,
            string hgvscNotation,
            bool isMitochondrial)
        {
            if (IsHgvspNull(transcriptAltAllele, position.CdsStart, position.CdsEnd, variant, hgvscNotation))
            {
                return(null);
            }

            var peptideSeq = transcript.Translation.PeptideSeq;

            // Amino acid seq should never go past the stop codon
            refAminoAcids = !refAminoAcids.EndsWith(AminoAcids.StopCodon) && refAminoAcids.Contains(AminoAcids.StopCodon)
                ? refAminoAcids.OptimizedSplit(AminoAcids.StopCodon[0])[0] + AminoAcids.StopCodon
                : refAminoAcids;

            int proteinStart = position.ProteinStart;

            HgvsUtilities.ShiftAndRotateAlleles(ref proteinStart, ref refAminoAcids, ref altAminoAcids, peptideSeq);

            var end             = proteinStart + refAminoAcids.Length - 1;
            var refAbbreviation = AminoAcids.GetAbbreviations(refAminoAcids);
            var altAbbreviation = AminoAcids.GetAbbreviations(altAminoAcids);

            var proteinId     = transcript.Translation.ProteinId.WithVersion;
            var proteinChange = GetProteinChange(proteinStart, refAminoAcids, altAminoAcids, peptideSeq, variantEffect);

            // ReSharper disable once SwitchStatementMissingSomeCases
            switch (proteinChange)
            {
            case ProteinChange.Substitution:
                return(HgvspNotation.GetSubstitutionNotation(proteinId, proteinStart, refAbbreviation, altAbbreviation));

            case ProteinChange.Unknown:
                return(HgvspNotation.GetUnknownNotation(proteinId, proteinStart, end, refAbbreviation, altAbbreviation));

            case ProteinChange.Deletion:
                return(HgvspNotation.GetDeletionNotation(proteinId, proteinStart, end, refAbbreviation, variantEffect.IsStopGained()));

            case ProteinChange.Duplication:
                proteinStart -= altAminoAcids.Length;
                return(HgvspNotation.GetDuplicationNotation(proteinId, proteinStart, end, altAbbreviation));

            case ProteinChange.Frameshift:
                return(GetHgvsFrameshiftNotation(refSequence, position.CdsStart, position.CdsEnd, transcriptAltAllele,
                                                 transcript, isMitochondrial, proteinId, proteinStart, end));

            case ProteinChange.None:
                return(HgvspNotation.GetSilentNotation(hgvscNotation, proteinStart, refAbbreviation, variantEffect.IsStopRetained()));

            case ProteinChange.DelIns:
                return(HgvspNotation.GetDelInsNotation(proteinId, proteinStart, end, refAbbreviation, altAbbreviation));

            case ProteinChange.Insertion:
                Swap.Int(ref proteinStart, ref end);
                return(HgvspNotation.GetInsertionNotation(proteinId, proteinStart, end, altAbbreviation, peptideSeq));

            case ProteinChange.Extension:
                var altPeptideSequence = HgvsUtilities.GetAltPeptideSequence(refSequence, position.CdsStart, position.CdsEnd,
                                                                             transcriptAltAllele, transcript, isMitochondrial);
                altAbbreviation = proteinStart <= altPeptideSequence.Length ? AminoAcids.ConvertAminoAcidToAbbreviation(altPeptideSequence[proteinStart - 1]): "Ter";
                var countToStop = HgvsUtilities.GetNumAminoAcidsUntilStopCodon(altPeptideSequence, peptideSeq, proteinStart - 1, false);

                return(HgvspNotation.GetExtensionNotation(proteinId, proteinStart, refAbbreviation, altAbbreviation, countToStop));

            case ProteinChange.StartLost:
                return(HgvspNotation.GetStartLostNotation(proteinId, proteinStart, end, refAbbreviation));
            }

            return(null);
        }
Ejemplo n.º 7
0
        private static (PredictionScore Sift, PredictionScore PolyPhen) GetPredictionScores(IMappedPosition position,
                                                                                            string refAminoAcid, string altAminoAcid, IPredictionCache siftCache, IPredictionCache polyphenCache,
                                                                                            int siftIndex, int polyphenIndex)
        {
            if (!NeedPredictionScore(position.ProteinStart, position.ProteinEnd, refAminoAcid, altAminoAcid) ||
                position.ProteinStart == -1)
            {
                return(null, null);
            }

            var newAminoAcid  = altAminoAcid[0];
            var siftScore     = GetPredictionScore(position.ProteinStart, newAminoAcid, siftCache, siftIndex);
            var polyphenScore = GetPredictionScore(position.ProteinStart, newAminoAcid, polyphenCache, polyphenIndex);

            return(siftScore, polyphenScore);
        }