AltAminoAcids, string RefCodons, string AltCodons, string TranscriptAltAllele, string TranscriptRefAllele) AnnotateTranscript(ITranscript transcript, ISimpleVariant variant, AminoAcids aminoAcids, ISequence refSequence) { bool onReverseStrand = transcript.Gene.OnReverseStrand; var start = MappedPositionUtilities.FindRegion(transcript.TranscriptRegions, variant.Start); var end = MappedPositionUtilities.FindRegion(transcript.TranscriptRegions, variant.End); var position = GetMappedPosition(transcript.TranscriptRegions, start.Region, start.Index, end.Region, end.Index, variant, onReverseStrand, transcript.Translation?.CodingRegion, transcript.StartExonPhase, variant.Type == VariantType.insertion); var codingSequence = GetCodingSequence(transcript, refSequence); var cdnaSequence = GetCdnaSequence(transcript, refSequence); string transcriptAltAllele = HgvsUtilities.GetTranscriptAllele(variant.AltAllele, onReverseStrand); var codons = Codons.GetCodons(transcriptAltAllele, position.CdsStart, position.CdsEnd, position.ProteinStart, position.ProteinEnd, codingSequence); var aa = aminoAcids.Translate(codons.Reference, codons.Alternate); (aa, position.ProteinStart, position.ProteinEnd) = TryTrimAminoAcidsAndUpdateProteinPositions(aa, position.ProteinStart, position.ProteinEnd); (position.CoveredCdnaStart, position.CoveredCdnaEnd) = transcript.TranscriptRegions.GetCoveredCdnaPositions(position.CdnaStart, start.Index, position.CdnaEnd, end.Index, onReverseStrand); (position.CoveredCdsStart, position.CoveredCdsEnd, position.CoveredProteinStart, position.CoveredProteinEnd) = MappedPositionUtilities.GetCoveredCdsAndProteinPositions(position.CoveredCdnaStart, position.CoveredCdnaEnd, transcript.StartExonPhase, transcript.Translation?.CodingRegion); var transcriptRefAllele = GetTranscriptRefAllele(position, cdnaSequence, variant, onReverseStrand); SequenceChange coveredAa; // only generate the covered version of ref & alt alleles when CDS start/end is -1 if (position.CdsStart == -1 || position.CdsEnd == -1) { coveredAa = GetCoveredAa(aminoAcids, transcriptAltAllele, position.CoveredCdsStart, position.CoveredCdsEnd, position.CoveredProteinStart, position.CoveredProteinEnd, codingSequence); (coveredAa, position.CoveredProteinStart, position.CoveredProteinEnd) = TryTrimAminoAcidsAndUpdateProteinPositions(coveredAa, position.CoveredProteinStart, position.CoveredProteinEnd); } else { coveredAa = aa; position.CoveredProteinStart = position.ProteinStart; position.CoveredProteinEnd = position.ProteinEnd; } var positionalEffect = GetPositionalEffect(transcript, variant, position, aa.Reference, aa.Alternate, position.CoveredCdnaStart, position.CoveredCdnaEnd, position.CoveredCdsStart, position.CoveredCdsEnd); var variantEffect = new VariantEffect(positionalEffect, variant, transcript, aa.Reference, aa.Alternate, codons.Reference, codons.Alternate, position.ProteinStart, coveredAa.Reference, coveredAa.Alternate); return(variantEffect, position, aa.Reference, aa.Alternate, codons.Reference, codons.Alternate, transcriptAltAllele, transcriptRefAllele); }
public static IAnnotatedTranscript GetAnnotatedTranscript(ITranscript transcript, IVariant variant, ISequence refSequence, AminoAcids aminoAcidsProvider) { var mappedPositions = MappedPositionsUtils.ComputeMappedPositions(variant.Start, variant.End, transcript); var transcriptRefAllele = HgvsUtilities.GetTranscriptAllele(variant.RefAllele, transcript.Gene.OnReverseStrand); var transcriptAltAllele = HgvsUtilities.GetTranscriptAllele(variant.AltAllele, transcript.Gene.OnReverseStrand); var codonsAndAminoAcids = GetCodonsAndAminoAcids(transcript, refSequence, transcriptRefAllele, transcriptAltAllele, variant, mappedPositions, aminoAcidsProvider); var referenceCodons = codonsAndAminoAcids.Item1; var alternateCodons = codonsAndAminoAcids.Item2; var referenceAminoAcids = codonsAndAminoAcids.Item3; var alternateAminoAcids = codonsAndAminoAcids.Item4; var insertionInStartCodonAndNoimpact = variant.Type == VariantType.insertion && mappedPositions.ProteinInterval.Start <= 1 && alternateAminoAcids.EndsWith(referenceAminoAcids); var variantEffect = GetVariantEffect(transcript, variant, mappedPositions, referenceAminoAcids, alternateAminoAcids, referenceCodons, alternateCodons, insertionInStartCodonAndNoimpact); var consequences = GetConsequences(transcript, variant, variantEffect); var proteinBegin = mappedPositions.ProteinInterval.Start == null ? -1 : mappedPositions.ProteinInterval.Start.Value; var proteinEnd = mappedPositions.ProteinInterval.End == null ? -1 : mappedPositions.ProteinInterval.End.Value; var upStreamAminoAcids = GetFlankingPeptides(transcript.Translation?.PeptideSeq, proteinBegin, proteinEnd, FlankingAminoAcidLength, true); var downStreamAminoAcids = consequences.Contains(ConsequenceTag.frameshift_variant)? null: GetFlankingPeptides(transcript.Translation?.PeptideSeq, proteinBegin, proteinEnd, FlankingAminoAcidLength, false); return(new PianoAnnotatedTranscript(transcript, referenceAminoAcids, alternateAminoAcids, mappedPositions, upStreamAminoAcids, downStreamAminoAcids, consequences)); }
AltAminoAcids, string RefCodons, string AltCodons, string TranscriptAltAllele) AnnotateTranscript(ITranscript transcript, ISimpleVariant variant, AminoAcids aminoAcids, ISequence refSequence) { var onReverseStrand = transcript.Gene.OnReverseStrand; var start = MappedPositionUtilities.FindRegion(transcript.TranscriptRegions, variant.Start); var end = MappedPositionUtilities.FindRegion(transcript.TranscriptRegions, variant.End); var position = GetMappedPosition(transcript.TranscriptRegions, start.Region, start.Index, end.Region, end.Index, variant, onReverseStrand, transcript.Translation?.CodingRegion, transcript.StartExonPhase, variant.Type == VariantType.insertion); var transcriptRefAllele = HgvsUtilities.GetTranscriptAllele(variant.RefAllele, onReverseStrand); var transcriptAltAllele = HgvsUtilities.GetTranscriptAllele(variant.AltAllele, onReverseStrand); var codingSequence = transcript.Translation == null ? null : new CodingSequence(refSequence, transcript.Translation.CodingRegion, transcript.TranscriptRegions, transcript.Gene.OnReverseStrand, transcript.StartExonPhase); var codons = Codons.GetCodons(transcriptRefAllele, transcriptAltAllele, position.CdsStart, position.CdsEnd, position.ProteinStart, position.ProteinEnd, codingSequence); var coveredCdna = transcript.TranscriptRegions.GetCoveredCdnaPositions(position.CdnaStart, start.Index, position.CdnaEnd, end.Index, onReverseStrand); var coveredCds = MappedPositionUtilities.GetCoveredCdsPositions(coveredCdna.Start, coveredCdna.End, transcript.StartExonPhase, transcript.Translation?.CodingRegion); var aa = aminoAcids.Translate(codons.Reference, codons.Alternate); var positionalEffect = GetPositionalEffect(transcript, variant, position, aa.Reference, aa.Alternate, coveredCdna.Start, coveredCdna.End, coveredCds.Start, coveredCds.End); var variantEffect = new VariantEffect(positionalEffect, variant, transcript, aa.Reference, aa.Alternate, codons.Reference, codons.Alternate, position.ProteinStart); return(variantEffect, position, aa.Reference, aa.Alternate, codons.Reference, codons.Alternate, transcriptAltAllele); }
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)); }