CSMSL.Proteomics.Protease.Protease C# (CSharp) Method

Protease() public method

public Protease ( string name, Terminus terminus, string cut, string nocut = "", string cleavePattern = "" ) : System
name string
terminus Terminus
cut string
nocut string
cleavePattern string
return System
        public Protease(string name, Terminus terminus, string cut, string nocut = "", string cleavePattern = "")
        {
            Name = name;
            Terminal = terminus;
            Cut = cut;
            NoCut = nocut;

            if (string.IsNullOrEmpty(cleavePattern))
            {
                StringBuilder constructedRegex = new StringBuilder();

                // Add grouping [ ] if more than one residue
                string cutregex = (Cut.Length > 1) ? "[" + Cut + "]" : Cut;
                string nocutregex = (NoCut.Length > 1) ? "[" + NoCut + "]" : NoCut;

                if (terminus == Terminus.N)
                {
                    // Apply negative look-a-head for N-terminal no cuts
                    if (!string.IsNullOrEmpty(nocut))
                    {
                        constructedRegex.Append("(?<!" + nocutregex + ")");
                    }
                    constructedRegex.Append("(?'cut')");
                    constructedRegex.Append(cutregex);
                }
                else
                {
                    constructedRegex.Append(cutregex);
                    constructedRegex.Append("(?'cut')");
                    if (!string.IsNullOrEmpty(nocut))
                    {
                        constructedRegex.Append("(?!" + nocutregex + ")");
                    }
                }

                _cleavageRegex = new Regex(constructedRegex.ToString(), RegexOptions.Compiled);
            }
            else
            {
                _cleavageRegex = new Regex(cleavePattern, RegexOptions.Compiled);
            }
        }

Same methods

Protease::Protease ( ) : System