Esempio n. 1
0
        private Dictionary <char, List <TargetVariant> > GetSubstitutionDeltaMass()
        {
            var result = new Dictionary <char, List <TargetVariant> >();

            var aa      = new Aminoacids();
            var validAA = aa.GetVisibleAminoacids();

            foreach (var ai in validAA)
            {
                foreach (var aj in validAA)
                {
                    if (ai == aj)
                    {
                        continue;
                    }

                    if (this.IsSingleNucleotideMutationOnly && !MutationUtils.IsSingleNucleotideMutation(ai, aj))
                    {
                        continue;
                    }

                    if (this.IgnoreDeamidatedMutation && MutationUtils.IsDeamidatedMutation(ai, aj))
                    {
                        continue;
                    }

                    if (!result.ContainsKey(ai))
                    {
                        result[ai] = new List <TargetVariant>();
                    }

                    var deltaMass = aa[aj].MonoMass - aa[ai].MonoMass;
                    if (Math.Abs(deltaMass) < MinimumAminoacidSubstitutionDeltaMass)
                    {
                        continue;
                    }

                    result[ai].Add(new TargetVariant()
                    {
                        Source     = ai.ToString(),
                        Target     = new HashSet <string>(new[] { aj.ToString() }),
                        DeltaMass  = deltaMass,
                        TargetType = VariantType.SingleAminoacidPolymorphism
                    });
                }
            }

            foreach (var v in result.Values)
            {
                v.Sort((m1, m2) => m1.DeltaMass.CompareTo(m2.DeltaMass));
            }
            return(result);
        }
Esempio n. 2
0
        private List <TargetVariant> GetExtensionDeltaMass()
        {
            var result = new List <TargetVariant>();

            var aa      = new Aminoacids();
            var validAA = (from a in aa.GetVisibleAminoacids() where a != 'I' select a).ToArray();

            foreach (var ai in validAA)
            {
                result.Add(new TargetVariant()
                {
                    Source    = string.Empty,
                    Target    = new HashSet <string>(new[] { ai.ToString() }),
                    DeltaMass = aa[ai].MonoMass
                });

                foreach (var aj in validAA)
                {
                    result.Add(new TargetVariant()
                    {
                        Source    = string.Empty,
                        Target    = new HashSet <string>(new[] { ai.ToString() + aj.ToString() }),
                        DeltaMass = aa[ai].MonoMass + aa[aj].MonoMass
                    });

                    foreach (var ak in validAA)
                    {
                        result.Add(new TargetVariant()
                        {
                            Source    = string.Empty,
                            Target    = new HashSet <string>(new[] { ai.ToString() + aj.ToString() + ak.ToString() }),
                            DeltaMass = aa[ai].MonoMass + aa[aj].MonoMass + aa[ak].MonoMass
                        });
                    }
                }
            }

            var grp = result.GroupBy(m => m.DeltaMass).ToList().ConvertAll(l => l.ToList());

            result.Clear();

            foreach (var g in grp)
            {
                var tv = g.First();
                for (int i = 1; i < g.Count; i++)
                {
                    tv.Target.UnionWith(g[i].Target);
                }
                result.Add(tv);
            }

            return(result);
        }
Esempio n. 3
0
    public void TestIsRnaEditing()
    {
      var aas = new Aminoacids();
      var aasstr = aas.GetVisibleAminoacids();
      for (int i = 0; i < aasstr.Length; i++)
      {
        for (int j = 0; j < aasstr.Length; j++)
        {
          if(i == j)
          {
            continue;
          }

          string mutationstr;
          if (aas[aasstr[i]].IsRnaEditing(aas[aasstr[j]], out mutationstr))
          {
            Console.WriteLine(aasstr[i] + "->" + aasstr[j] + " : " + mutationstr);
          }
        }
      }
    }
Esempio n. 4
0
        public void TestIsRnaEditing()
        {
            var aas    = new Aminoacids();
            var aasstr = aas.GetVisibleAminoacids();

            for (int i = 0; i < aasstr.Length; i++)
            {
                for (int j = 0; j < aasstr.Length; j++)
                {
                    if (i == j)
                    {
                        continue;
                    }

                    string mutationstr;
                    if (aas[aasstr[i]].IsRnaEditing(aas[aasstr[j]], out mutationstr))
                    {
                        Console.WriteLine(aasstr[i] + "->" + aasstr[j] + " : " + mutationstr);
                    }
                }
            }
        }
        private static void PrepareRnaEditingMap()
        {
            RnaEditingMap = new Dictionary <Pair <char, char>, string>();

            var aasstr = aas.GetVisibleAminoacids();

            for (int i = 0; i < aasstr.Length; i++)
            {
                for (int j = 0; j < aasstr.Length; j++)
                {
                    if (i == j)
                    {
                        continue;
                    }

                    string mutationstr = null;

                    if (DoIsRnaEditing(aas[aasstr[i]], aas[aasstr[j]], ref mutationstr))
                    {
                        RnaEditingMap[new Pair <char, char>(aasstr[i], aasstr[j])] = mutationstr;
                    }
                }
            }
        }