Esempio n. 1
0
        /// <summary>
        /// Apply a Variant to a marker. Variant is a duplication
        /// </summary>
        /// <param name="variant"></param>
        /// <returns></returns>
        protected Interval ApplyDup(Variant variant)
        {
            Interval m = new Interval(this);

            if (variant.OneBasedEnd < m.OneBasedStart)
            {
                // Duplication before marker start? => Adjust both coordinates
                long lenChange = variant.LengthChange();
                m.OneBasedStart += lenChange;
                m.OneBasedEnd   += lenChange;
            }
            else if (variant.Includes(m))
            {
                // Duplication includes whole marker? => Adjust both coordinates
                long lenChange = variant.LengthChange();
                m.OneBasedStart += lenChange;
                m.OneBasedEnd   += lenChange;
            }
            else if (m.Includes(variant))
            {
                // Duplication included in marker? => Adjust end coordinate
                m.OneBasedEnd += variant.LengthChange();
            }
            else if (variant.Intersects(m))
            {
                // Duplication includes part of marker? => Adjust end
                m.OneBasedEnd += variant.IntersectSize(m);
            }
            else
            {
                // Duplication after end, no effect on marker coordinates
            }

            return(m);
        }
Esempio n. 2
0
 /// <summary>
 /// Does the variant intersect any exons?
 /// </summary>
 /// <returns></returns>
 protected bool IntersectsExons()
 {
     foreach (Exon ex in Transcript.Exons)
     {
         if (Variant.Intersects(ex))
         {
             return(true);
         }
     }
     return(false);
 }
        /// <summary>
        /// How many full / partial exons does the variant affect?
        /// </summary>
        protected void CountAffectedExons()
        {
            exonFull    = 0;
            exonPartial = 0;

            foreach (Exon ex in Transcript.Exons)
            {
                if (Variant.Includes(ex))
                {
                    exonFull++;
                }
                else if (Variant.Intersects(ex))
                {
                    exonPartial++;
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Do something with a variant within this interval
        /// </summary>
        /// <param name="variant"></param>
        public override Interval ApplyVariant(Variant variant)
        {
            IntervalSequence newIntervalSeq = new IntervalSequence(base.ApplyVariant(variant), new Sequence(Sequence)); // adds the variant to the variant list

            if (variant.Intersects(this) && Sequence != null && Sequence.Count != 0)
            {
                switch (variant.VarType)
                {
                case Variant.VariantType.SNV:
                    ApplySnp(variant, newIntervalSeq);
                    break;

                case Variant.VariantType.INS:
                    ApplyIns(variant, newIntervalSeq);
                    break;

                case Variant.VariantType.DEL:
                    ApplyDel(variant, newIntervalSeq);
                    break;

                case Variant.VariantType.DUP:
                    ApplyDup(variant, newIntervalSeq);
                    break;

                case Variant.VariantType.MNV:
                    ApplyMnp(variant, newIntervalSeq);
                    break;

                case Variant.VariantType.MIXED:
                    // When applying a MIXED variant, it is decomposed into two
                    // variants (MNP+InDel) and each of them is applied to the
                    // marker. So at this point the variants have been fully
                    // applied and there is no need for further processing.
                    break;

                default:
                    throw new ArgumentException("Unimplemented method for variant change type " + variant.VarType + "\n\tVariant: " + variant);
                }
            }

            return(newIntervalSeq);
        }
Esempio n. 5
0
        /// <summary>
        /// Deletion analysis using full transcript information. This is done only when the variant affects more than one exons.
        /// </summary>
        protected override void Exons()
        {
            if (exonFull == 0 && exonPartial == 1)
            {
                // Variant partially affects only one exon?
                // => Use the standard (by exon) method
                codonChangeSuper();
                return;
            }
            else if (exonFull > 0)
            {
                // Full exons deleted
                ExonLoss();

                // Only whole exons deleted? We are done
                if (exonPartial == 0)
                {
                    return;
                }
            }

            //---
            // A combination of partial and full exons affected
            //---
            CodonsRefAlt();
            EffectType effType;
            int        lenDiff = cdsAlt.Length - cdsRef.Length;

            if (lenDiff % CODON_SIZE != 0)
            {
                effType = EffectType.FRAME_SHIFT;
            }
            else if (CodonStartIndex == 0)
            {
                effType = EffectType.CODON_DELETION;
            }
            else
            {
                if (CodonsAlternate == "" || CodonsReference.StartsWith(CodonsAlternate))
                {
                    effType = EffectType.CODON_DELETION;
                }
                else
                {
                    effType = EffectType.CODON_CHANGE_PLUS_CODON_DELETION;
                }
            }

            // Assign to first exon
            foreach (Exon ex in Transcript.Exons)
            {
                if (Variant.Includes(ex) || Variant.Intersects(ex))
                {
                    Exon = ex;
                    break;
                }
            }

            // Add variant effect
            Effect(Exon, effType, false);
        }