示例#1
0
        /// <summary>
        /// Can we add an effectType to the previous variatnEffect?
        /// </summary>
        /// <param name="variant"></param>
        /// <param name="marker"></param>
        /// <returns>true if transcript IDs and variant's genotypes match (i.e. we can add effectType)</returns>
        private bool CanAddType(Variant variant, Interval marker)
        {
            VariantEffect veff = Get();

            if (veff == null || veff.Variant == null)
            {
                return(false);
            }

            // Do genotypes match?
            var gt  = veff.Variant.Genotype;
            var vgt = variant.Genotype;

            if (((vgt != null) ^ (gt != null)) || // One null and one non-null?
                ((vgt != null) && (gt != null) && !variant.Genotype.Equals(variant.Genotype))        // Both non-null, but different?
                )
            {
                return(false);
            }

            // Do transcripts match?
            Transcript trMarker = (Transcript)marker.FindParent(typeof(Transcript));

            Transcript tr = veff.GetTranscript();

            if (tr == null || trMarker == null)
            {
                return(false);
            }

            return(tr.ID == trMarker.ID);
        }
示例#2
0
        /// <summary>
        /// Add an effect
        /// </summary>
        /// <param name="variant"></param>
        /// <param name="marker"></param>
        /// <param name="effectType"></param>
        /// <param name="effectImpact"></param>
        /// <param name="message"></param>
        private void AddEffect(Variant variant, Interval marker, EffectType effectType, EffectImpact effectImpact, String message)
        {
            VariantEffect effNew = new VariantEffect(variant);

            effNew.Set(marker, effectType, effectImpact, message);
            AddEffect(effNew);
        }
示例#3
0
        /// <summary>
        /// Add an effect
        /// </summary>
        /// <param name="marker"></param>
        /// <param name="effectType"></param>
        /// <param name="effectImpact"></param>
        /// <param name="codonsOld"></param>
        /// <param name="codonsNew"></param>
        /// <param name="codonNum"></param>
        /// <param name="codonIndex"></param>
        /// <param name="allowReplace"></param>
        /// <returns></returns>
        private VariantEffect Effect(Interval marker, EffectType effectType, EffectImpact effectImpact, string codonsOld, string codonsNew, int codonNum, int codonIndex, bool allowReplace)
        {
            // Create and add variant affect
            long          cDnaPos = Transcript.BaseNumber2MRnaPos(Variant.OneBasedStart);
            VariantEffect varEff  = new VariantEffect(Variant, marker, effectType, effectImpact, codonsOld, codonsNew, codonNum, codonIndex, cDnaPos);

            VariantEffects.AddEffect(varEff);

            // Are there any additional effects? Sometimes a new effect arises from setting codons (e.g. FRAME_SHIFT disrupts a STOP codon)
            EffectType addEffType = AdditionalEffect(codonsOld, codonsNew, codonNum, codonIndex);

            if (addEffType != EffectType.NONE && addEffType != effectType)
            {
                if (allowReplace && addEffType.CompareTo(effectType) < 0)
                {
                    // Replace main effect (using default impact)
                    varEff.SetEffect(addEffType);
                }
                else
                {
                    // Add effect to list (using default impact)
                    varEff.AddEffect(addEffType);
                }
            }

            return(varEff);
        }
示例#4
0
        public override bool CreateVariantEffect(Variant variant, VariantEffects variantEffects)
        {
            // Has the whole UTR been deleted?
            if (variant.Includes(this) && variant.VarType == Variant.VariantType.DEL)
            {
                variantEffects.AddEffect(variant, this, EffectType.UTR_5_DELETED, ""); // A UTR was removed entirely
                return(true);
            }

            // Add distance
            Transcript    tr            = (Transcript)FindParent(typeof(Transcript));
            long          distance      = utrDistance(variant, tr);
            VariantEffect variantEffect = new VariantEffect(variant);

            variantEffect.Set(this, IntervalType, EffectTypeMethods.EffectDictionary[IntervalType], distance >= 0 ? distance + " bases from TSS" : "");
            variantEffect.Distance = distance;
            variantEffects.AddEffect(variantEffect);

            // Start gained?
            string gained = startGained(variant);

            if (gained != "")
            {
                variantEffects.AddEffect(variant, this, EffectType.START_GAINED, gained);
            }

            return(true);
        }
示例#5
0
        public void SetMarker(Interval marker)
        {
            VariantEffect veff = Get();

            if (veff != null)
            {
                veff.SetMarker(marker);
            }
        }
示例#6
0
        public bool HasMarker()
        {
            VariantEffect veff = Get();

            if (veff == null)
            {
                return(false);
            }
            return(veff.Marker != null);
        }
示例#7
0
        /// <summary>
        /// Add an error or warning
        /// </summary>
        /// <param name="variant"></param>
        /// <param name="errwarn"></param>
        public void AddErrorWarning(Variant variant, ErrorWarningType errwarn)
        {
            VariantEffect veff = Get();

            if (veff != null)
            {
                veff.AddErrorWarningInfo(errwarn);
            }
            else
            {
                veff = new VariantEffect(variant);
                veff.AddErrorWarningInfo(errwarn);
                AddEffect(veff);
            }
        }
示例#8
0
        public override bool CreateVariantEffect(Variant variant, VariantEffects variantEffects)
        {
            if (!Intersects(variant))
            {
                return(false);
            }

            if (variant.Includes(this) && variant.VarType == Variant.VariantType.DEL)
            {
                variantEffects.AddEffectType(variant, this, EffectType.UTR_3_DELETED); // A UTR was removed entirely
                return(true);
            }

            Transcript tr       = (Transcript)FindParent(typeof(Transcript));
            long       distance = utrDistance(variant, tr);

            VariantEffect variantEffect = new VariantEffect(variant);

            variantEffect.Set(this, EffectType.UTR_3_PRIME, EffectTypeMethods.EffectDictionary[EffectType.UTR_3_PRIME], distance >= 0 ? distance + " bases from CDS" : "");
            variantEffect.Distance = distance;
            variantEffects.AddEffect(variantEffect);

            return(true);
        }
示例#9
0
 /// <summary>
 /// Add an effect
 /// </summary>
 /// <param name="variantEffect"></param>
 public void AddEffect(VariantEffect variantEffect)
 {
     Effects.Add(variantEffect);
 }