Exemple #1
0
 public Enzyme(string name, string cleavage, string restrict, SequenceTerminus type)
     : this(name,
            type == SequenceTerminus.C ? cleavage : null,
            type == SequenceTerminus.C ? restrict : null,
            type == SequenceTerminus.N ? cleavage : null,
            type == SequenceTerminus.N ? restrict : null)
 {
 }
Exemple #2
0
        public void OkDialog()
        {
            var helper = new MessageBoxHelper(this);

            string name;

            if (!helper.ValidateNameTextBox(textName, out name))
            {
                return;
            }

            if (_existing.Contains(m => !ReferenceEquals(_measuredIon, m) && Equals(name, m.Name)))
            {
                helper.ShowTextBoxError(textName, Resources.EditMeasuredIonDlg_OkDialog_The_special_ion__0__already_exists, name);
                return;
            }

            if (radioFragment.Checked)
            {
                string cleavage;
                if (!ValidateAATextBox(helper, textFragment, false, out cleavage))
                {
                    return;
                }
                string restrict;
                if (!ValidateAATextBox(helper, textRestrict, true, out restrict))
                {
                    return;
                }

                SequenceTerminus direction = (comboDirection.SelectedIndex == 0 ?
                                              SequenceTerminus.C : SequenceTerminus.N);

                int minAas;
                if (!helper.ValidateNumberTextBox(textMinAas, MeasuredIon.MIN_MIN_FRAGMENT_LENGTH,
                                                  MeasuredIon.MAX_MIN_FRAGMENT_LENGTH, out minAas))
                {
                    return;
                }

                _measuredIon = new MeasuredIon(name, cleavage, restrict, direction, minAas);
            }
            else
            {
                var customIon = ValidateCustomIon(name);
                if (customIon == null)
                {
                    return;
                }
                _measuredIon = customIon;
            }

            DialogResult = DialogResult.OK;
        }
Exemple #3
0
        private static string GetRegex(string cleavage, string restrict, SequenceTerminus terminus)
        {
            if (string.IsNullOrEmpty(cleavage))
            {
                return(null);
            }
            string cut   = "[" + cleavage + "]";                                               // Not L10N
            string nocut = (string.IsNullOrEmpty(restrict) ? "[A-Z]" : "[^" + restrict + "]"); // Not L10N

            return(terminus == SequenceTerminus.C ? cut + nocut : nocut + cut);
        }
Exemple #4
0
 /// <summary>
 /// Constructor for a special fragment
 /// </summary>
 /// <param name="name">The name by which it is stored in the settings list</param>
 /// <param name="fragment">Amino acid residues with weak bonds</param>
 /// <param name="restrict">Adjacent amino acids that form stronger bonds</param>
 /// <param name="terminus">Terminal side which has the weak bond</param>
 /// <param name="minFragmentLength">Minimum length to allow as a special fragment</param>
 public MeasuredIon(string name,
                    string fragment,
                    string restrict,
                    SequenceTerminus terminus,
                    int minFragmentLength)
     : base(name)
 {
     Fragment          = fragment;
     Restrict          = restrict;
     Terminus          = terminus;
     MinFragmentLength = minFragmentLength;
     Validate();
 }
Exemple #5
0
 private static string ToString(string cleavage, string restrict, SequenceTerminus term)
 {
     if (string.IsNullOrEmpty(cleavage))
     {
         return(string.Empty);
     }
     if (string.IsNullOrEmpty(restrict))
     {
         restrict = "-";  // Not L10N
     }
     return(term == SequenceTerminus.C
         ? "[" + cleavage + " | " + restrict + "]"   // Not L10N
         : "[" + restrict + " | " + cleavage + "]"); // Not L10N
 }
Exemple #6
0
 /// <summary>
 /// Constructor for a special fragment
 /// </summary>
 /// <param name="name">The name by which it is stored in the settings list</param>
 /// <param name="fragment">Amino acid residues with weak bonds</param>
 /// <param name="restrict">Adjacent amino acids that form stronger bonds</param>
 /// <param name="terminus">Terminal side which has the weak bond</param>
 /// <param name="minFragmentLength">Minimum length to allow as a special fragment</param>
 public MeasuredIon(string name,
     string fragment,
     string restrict,
     SequenceTerminus terminus,
     int minFragmentLength)
     : base(name)
 {
     Fragment = fragment;
     Restrict = restrict;
     Terminus = terminus;
     MinFragmentLength = minFragmentLength;
     Charge = 1;
     Validate();
 }
Exemple #7
0
 private static string ToString(string cleavage, string restrict, SequenceTerminus term)
 {
     if (string.IsNullOrEmpty(cleavage))
     {
         return(string.Empty);
     }
     if (string.IsNullOrEmpty(restrict))
     {
         restrict = @"-";
     }
     return(term == SequenceTerminus.C
         ? @"[" + cleavage + @" | " + restrict + @"]"
         : @"[" + restrict + @" | " + cleavage + @"]");
 }
Exemple #8
0
 public Protease(string cleavage, string restrict, SequenceTerminus type)
 {
     Cleavage = cleavage;
     Restrict = restrict;
     Type = type;
 }
Exemple #9
0
 private static string ToString(string cleavage, string restrict, SequenceTerminus term)
 {
     if (string.IsNullOrEmpty(cleavage))
         return string.Empty;
     if (string.IsNullOrEmpty(restrict))
         restrict = "-";  // Not L10N
     return term == SequenceTerminus.C
         ? "[" + cleavage + " | " + restrict + "]"   // Not L10N
         : "[" + restrict + " | " + cleavage + "]";  // Not L10N
 }
Exemple #10
0
 private static string GetRegex(string cleavage, string restrict, SequenceTerminus terminus)
 {
     if (string.IsNullOrEmpty(cleavage))
         return null;
     string cut = "[" + cleavage + "]"; // Not L10N
     string nocut = (string.IsNullOrEmpty(restrict) ? "[A-Z]" : "[^" + restrict + "]"); // Not L10N
     return terminus == SequenceTerminus.C ? cut + nocut : nocut + cut;
 }
Exemple #11
0
 public Enzyme(string name, string cleavage, string restrict, SequenceTerminus type)
     : this(name,
         type == SequenceTerminus.C ? cleavage : null,
         type == SequenceTerminus.C ? restrict : null,
         type == SequenceTerminus.N ? cleavage : null,
         type == SequenceTerminus.N ? restrict : null)
 {
 }
Exemple #12
0
 public Protease(string cleavage, string restrict, SequenceTerminus type)
 {
     Cleavage = cleavage;
     Restrict = restrict;
     Type     = type;
 }