Esempio n. 1
0
        private string LofteeAnalysis(IAnnotatedTranscript ta, IAnnotatedAlternateAllele allele,
                                      ICompressedSequence sequence)
        {
            if (!LofteeUtilities.IsApplicable(ta))
            {
                return(null);
            }

            var filters    = new HashSet <LofteeFilter.Filter>();
            var flags      = new HashSet <LofteeFilter.Flag>();
            var transcript = _transcriptsById[ta.TranscriptID];

            CheckSingleExon(transcript, flags);

            if (LofteeUtilities.IsInExon(ta))
            {
                CheckEndTruncation(ta, transcript, filters);
                CheckIncompleteCds();
                CheckNonCanonicalSpliceSurr(ta, transcript, filters, sequence);
            }

            var intronIdx = LofteeUtilities.GetIntronIndex(ta, transcript);

            if (LofteeUtilities.IsSpliceVariant(ta) && intronIdx != -1)
            {
                CheckSmallIntron(intronIdx, transcript, filters);
                CheckNonCanonicalSplice(intronIdx, transcript, filters, sequence);
                CheckNagnagSite(transcript, allele, flags, sequence);
            }

            return(GetLofteeString(filters, flags));
        }
Esempio n. 2
0
        private static IAnnotatedTranscript GetAnnotatedTranscript(IVariant variant, ISequence compressedSequence,
                                                                   ITranscript transcript, Status annotationStatus, IPredictionCache siftCache, IPredictionCache polyphenCache)
        {
            IAnnotatedTranscript annotatedTranscript = null;

            // ReSharper disable once SwitchStatementMissingSomeCases
            switch (annotationStatus)
            {
            case Status.FlankingAnnotation:
                annotatedTranscript =
                    FlankingTranscriptAnnotator.GetAnnotatedTranscript(variant.End, transcript);
                break;

            case Status.ReducedAnnotation:
                annotatedTranscript = ReducedTranscriptAnnotator.GetAnnotatedTranscript(transcript, variant);
                break;

            case Status.RohAnnotation:
                annotatedTranscript = RohTranscriptAnnotator.GetAnnotatedTranscript(transcript);
                break;

            case Status.FullAnnotation:
                var acidsProvider = variant.Chromosome.UcscName == "chrM"
                        ? MitoAminoAcidsProvider
                        : AminoAcidsProvider;
                annotatedTranscript = FullTranscriptAnnotator.GetAnnotatedTranscript(transcript, variant,
                                                                                     compressedSequence, siftCache, polyphenCache, acidsProvider);
                break;
            }

            return(annotatedTranscript);
        }
        private void AddConservationScore(IAnnotatedTranscript annotatedTranscript)
        {
            if (_conservationProvider == null)
            {
                return;
            }
            if (annotatedTranscript.MappedPosition == null)
            {
                return;
            }

            var scores = new List <double>();
            var start  = annotatedTranscript.MappedPosition.ProteinStart;
            var end    = annotatedTranscript.MappedPosition.ProteinEnd;

            if (start == -1 || end == -1)
            {
                return;
            }
            for (int aaPos = start; aaPos <= end; aaPos++)
            {
                var transcriptId = annotatedTranscript.Transcript.Id.WithVersion;
                var score        = _conservationProvider.GetConservationScore(transcriptId, aaPos);
                if (score == -1)
                {
                    return;              //don't add conservation scores
                }
                scores.Add(1.0 * score / 100);
            }

            annotatedTranscript.ConservationScores = scores;
        }
Esempio n. 4
0
        public static int GetIntronIndex(IAnnotatedTranscript ta, Transcript transcript)
        {
            if (ta.Introns == null)
            {
                return(-1);
            }
            int affectedIntron = Convert.ToInt32(ta.Introns.Split('/').First().Split('-').First());
            var totalIntrons   = transcript.Introns.Length;

            return(transcript.Gene.OnReverseStrand ? totalIntrons - affectedIntron : affectedIntron - 1);
        }
Esempio n. 5
0
        private void CheckEndTruncation(IAnnotatedTranscript ta, Transcript transcript, HashSet <LofteeFilter.Filter> filters)
        {
            if (!ta.Consequence.Contains("stop_gained") && !ta.Consequence.Contains("frameshift_variant"))
            {
                return;
            }

            var cdsPositions = ta.CdsPosition.Split('-');
            var startCdPos   = Convert.ToInt32(cdsPositions[0]);

            var cdsLen = CodingSequence.GetCodingSequenceLength(transcript.CdnaMaps,
                                                                transcript.Translation.CodingRegion.GenomicStart, transcript.Translation.CodingRegion.GenomicEnd,
                                                                transcript.StartExonPhase);

            if ((double)startCdPos / cdsLen > 0.95)
            {
                filters.Add(LofteeFilter.Filter.end_trunc);
            }
        }
Esempio n. 6
0
        private static bool IsFlankingTranscript(IAnnotatedTranscript transcript)
        {
            if (transcript.Consequences == null)
            {
                return(false);
            }

            // ReSharper disable once LoopCanBeConvertedToQuery
            foreach (var consequence in transcript.Consequences)
            {
                if (consequence == ConsequenceTag.downstream_gene_variant ||
                    consequence == ConsequenceTag.upstream_gene_variant)
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 7
0
        private void CheckNonCanonicalSpliceSurr(IAnnotatedTranscript ta, Transcript transcript,
                                                 HashSet <LofteeFilter.Filter> filters, ICompressedSequence sequence)
        {
            if (ta.Exons == null)
            {
                return;
            }
            int affectedExonIndex = Convert.ToInt32(ta.Exons.Split('/').First().Split('-').First());
            var totalExons        = transcript.CdnaMaps.Length;

            string surrDonor    = null;
            string surrAcceptor = null;

            if (totalExons <= 1)
            {
                return;
            }

            var onReverseStrand = transcript.Gene.OnReverseStrand;

            if (affectedExonIndex > 1)
            {
                var intron        = onReverseStrand ? transcript.Introns[totalExons - affectedExonIndex] : transcript.Introns[affectedExonIndex - 2];
                int acceptorStart = onReverseStrand ? intron.Start : intron.End - 1;
                var acceptorSeq   = sequence.Substring(acceptorStart - 1, 2);
                surrAcceptor = onReverseStrand ? SequenceUtilities.GetReverseComplement(acceptorSeq) : acceptorSeq;
            }

            if (affectedExonIndex < totalExons)
            {
                var intron     = onReverseStrand ? transcript.Introns[totalExons - affectedExonIndex - 1] : transcript.Introns[affectedExonIndex - 1];
                int donorStart = onReverseStrand ? intron.End - 1 : intron.Start;
                var donorSeq   = sequence.Substring(donorStart - 1, 2);
                surrDonor = onReverseStrand ? SequenceUtilities.GetReverseComplement(donorSeq) : donorSeq;
            }

            if (surrAcceptor != null && surrAcceptor != "AG" || surrDonor != null && surrDonor != "GT")
            {
                filters.Add(LofteeFilter.Filter.non_can_splice_surr);
            }
        }
Esempio n. 8
0
 public static bool IsInExon(IAnnotatedTranscript ta) => !string.IsNullOrEmpty(ta.Exons);
Esempio n. 9
0
 public static bool IsApplicable(IAnnotatedTranscript ta)
 {
     return(ta.Consequence.Contains("stop_gained") || ta.Consequence.Contains("frameshift_variant") ||
            ta.Consequence.Contains("splice_donor_variant") || ta.Consequence.Contains("splice_acceptor_variant"));
 }
Esempio n. 10
0
 private static bool IsSpliceAcceptor(IAnnotatedTranscript ta) => ta.Consequence.Contains("splice_acceptor_variant");
Esempio n. 11
0
 public static bool IsSpliceVariant(IAnnotatedTranscript ta) => IsSpliceDonor(ta) || IsSpliceAcceptor(ta);