private AAModMatch?GetModByName(AAModInfo info) { bool structural = false; StaticMod modMatch = null; // First, look in the document/global settings. foreach (var mod in UserDefinedTypedMods.Keys) { bool matchStuctural = UserDefinedTypedMods[mod].IsLight; if (Equals(info.Name, mod.Name) && (!info.UserIndicatedHeavy || !matchStuctural)) { modMatch = mod; structural = matchStuctural; } } // If not found, then look in Unimod. modMatch = modMatch ?? UniMod.GetModification(info.Name, out structural); if (!info.IsModMatch(modMatch) || (info.UserIndicatedHeavy && structural)) { return(null); } return(new AAModMatch { StructuralMod = structural ? modMatch : null, HeavyMod = !structural ? modMatch : null }); }
EnumeratePartialModMatches(Dictionary <IEnumerable <StaticMod>, bool> dictModLists, AAModInfo info) { foreach (var dict in dictModLists) { var mods = dict.Key; // Mod can be null to force search for only light/heavy match. foreach (var mod in mods.Where(mod => mod == null || info.IsModMatch(mod))) { double modMass = mod == null ? 0 : GetDefaultModMass(info.AA, mod); double mass = (info.Mass ?? 0) - modMass; yield return(new PartialMassMatch { Mod = mod == null ? null : mod.ChangeExplicit(true), Structural = dict.Value, UnexplainedMass = Math.Round(mass, info.RoundedTo) }); } } }
private AAModMatch? GetModByName(AAModInfo info) { bool structural = false; StaticMod modMatch = null; // First, look in the document/global settings. foreach (var mod in UserDefinedTypedMods.Keys) { bool matchStuctural = UserDefinedTypedMods[mod].IsLight; if (Equals(info.Name, mod.Name) && (!info.UserIndicatedHeavy || !matchStuctural)) { modMatch = mod; structural = matchStuctural; } } // If not found, then look in Unimod. modMatch = modMatch ?? UniMod.GetModification(info.Name, out structural); if (!info.IsModMatch(modMatch) || (info.UserIndicatedHeavy && structural)) return null; return new AAModMatch { StructuralMod = structural ? modMatch : null, HeavyMod = !structural ? modMatch : null }; }
private static IEnumerable<PartialMassMatch> EnumeratePartialModMatches(Dictionary<IEnumerable<StaticMod>, bool> dictModLists, AAModInfo info) { foreach (var dict in dictModLists) { var mods = dict.Key; // Mod can be null to force search for only light/heavy match. foreach (var mod in mods.Where(mod => mod == null || info.IsModMatch(mod))) { double modMass = mod == null ? 0 : GetDefaultModMass(info.AA, mod); double mass = (info.Mass ?? 0) - modMass; yield return new PartialMassMatch { Mod = mod == null ? null : mod.ChangeExplicit(true), Structural = dict.Value, UnexplainedMass = Math.Round(mass, info.RoundedTo) }; } } }