private void InitializeUserDefinedTypedMods(SrmDocument document)
        {
            var mods = document.Settings.PeptideSettings.Modifications;

            foreach (var type in mods.GetModificationTypes())
            {
                // Set the default heavy type to the first heavy type encountered.
                if (!ReferenceEquals(type, IsotopeLabelType.light) && DefaultHeavyLabelType == null)
                {
                    DefaultHeavyLabelType = type;
                }

                foreach (var mod in mods.GetModificationsByName(type.Name).Modifications.Where(m => !m.IsUserSet))
                {
                    UserDefinedTypedMods.Add(mod);
                }
            }

            var staticMods = new TypedModifications(IsotopeLabelType.light, mods.StaticModifications);
            var heavyMods  = new TypedModifications(DefaultHeavyLabelType, mods.GetModifications(DefaultHeavyLabelType));

            foreach (var mod in staticMods.Modifications.Union(heavyMods.Modifications))
            {
                UserDefinedTypedMods.Add(mod);
            }
        }
        private void InitUserDefTypedModDict(TypedModifications typedModifications, bool includeExplicit)
        {
            var type = typedModifications.LabelType;

            foreach (StaticMod mod in typedModifications.Modifications
                     .Where(mod => includeExplicit || !mod.IsUserSet))
            {
                var modName = mod.Name;
                if (!UserDefinedTypedMods.Keys.Contains(key => Equals(key.Name, modName)))
                {
                    var newMod = mod;
                    // TODO: This appears to be problematic
                    if (includeExplicit && !mod.IsVariable)
                    {
                        newMod = mod.ChangeExplicit(true);
                    }
                    UserDefinedTypedMods.Add(newMod, type);
                }
            }
        }