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); }
private static bool DoIsMutationOne(IsMutationOneDelegate func, string fromPeptide, string toPeptide, ref int mutationSite, bool ignoreNtermMutation, bool ignoreDeamidatedMutation, bool ignoreMultipleNucleotideMutation) { if (func(fromPeptide, toPeptide, ref mutationSite)) { if (ignoreNtermMutation && 0 == mutationSite) { return(false); } if (ignoreDeamidatedMutation && MutationUtils.IsDeamidatedMutation(fromPeptide[mutationSite], toPeptide[mutationSite])) { return(false); } if (ignoreMultipleNucleotideMutation && IsSingleNucleotideMutation(fromPeptide[mutationSite], toPeptide[mutationSite])) { return(false); } return(true); } return(false); }