Ejemplo n.º 1
0
        /// <summary>
        /// Get the modification that matches the given mass
        /// </summary>
        /// <param name="massStr"></param>
        /// <returns></returns>
        public static IList <Modification> GetFromMass(string massStr)
        {
            if (massStr.StartsWith("+"))
            {
                massStr = massStr.Substring(1);
            }

            if (MassToModMap.TryGetValue(massStr, out var modList))
            {
                return(modList);
            }

            // Exact match not found; assure the mod mass is properly formatted
            if (double.TryParse(massStr, out var modMass))
            {
                var formattedMass = string.Format(MOD_MASS_FORMAT_STRING, modMass);

                if (MassToModMap.TryGetValue(formattedMass, out var modList2))
                {
                    return(modList2);
                }
            }

            return(null);
        }
Ejemplo n.º 2
0
        public static IList <Modification> GetFromMass(string massStr)
        {
            if (massStr.StartsWith("+"))
            {
                massStr = massStr.Substring(1);
            }
            IList <Modification> modList;

            return(MassToModMap.TryGetValue(massStr, out modList) ? modList : null);
        }