Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_enzyme Class Reference

Represent a single entry in the enzymes file. More...

#include <ms_enzyme.hpp>

Inheritance diagram for ms_enzyme:
Collaboration diagram for ms_enzyme:

Public Types

enum  cuttertype {
  UNDEFINED_CUTTER = 0x0000 ,
  NTERM_CUTTER = 0x0001 ,
  CTERM_CUTTER = 0x0002
}
 Definitions for types of cutter. More...
 

Public Member Functions

 ms_enzyme ()
 Default constructor.
 
 ms_enzyme (const ms_enzyme &src)
 Copying constructor.
 
 ~ms_enzyme ()
 Destructor.
 
void addCutter (const cuttertype type, const char *cleaveAtStr, const char *restrictStr)
 Adds an cutter to the enzyme.
 
void appendProperty (const char *name, const char *value, const char *delimiter, const bool bFirstPlace=false)
 Adds a new property with the given parameters.
 
void appendText (const char *line, const bool bFirstPlace=false)
 Adds a new non-parsed property.
 
bool canCleave (const int cutterNum, const char leftResidue, const char rightResidue) const
 Returns TRUE if the cutter can cut between the two residues.
 
void clearAllCutters ()
 Deletes all cutters from the list.
 
void copyFrom (const ms_customproperty *src)
 Copies all properties and comments from another instance.
 
void copyFrom (const ms_enzyme *right)
 Can be used to create a clone.
 
void defaultValues ()
 Use this member to re-initialise an instance to default values.
 
void delNonEmpty ()
 Deletes all non-comment properties.
 
void delProp (const char *name)
 Deletes all properties with the specified name.
 
void delPropByNumber (const int index)
 Deletes a single property with the specified number only.
 
void delPropStart (const char *nameBeginning)
 Deletes all properties whose names start with the given string.
 
int findProperty (const char *name, const int startFrom=0) const
 Searches the list for a property with the given name.
 
int findPropertyBeginning (const char *nameBeginning, const int startFrom=0) const
 Searches the list for a property with the partially matching name.
 
std::string getCleave (const int cutterNum) const
 Returns the list of cleavage points for a cutter.
 
ms_enzyme::cuttertype getCutterType (const int cutterNum) const
 Return the number of cutters that make up the enzyme definition.
 
std::string getDefaultDelimiter () const
 Return current default delimiter string used for parsing/storing properties.
 
std::string getDelimiterByNumber (const int index) const
 Returns a specific delimiter used for the property.
 
int getNumberOfCutters () const
 Returns the number of cutters.
 
int getNumberOfProperties () const
 Returns a total number of property/comment entries.
 
std::string getPreceedingComments () const
 Returns any comments preceeding the section.
 
std::string getPropertyName (const int index) const
 Returns a property name for a given index.
 
std::string getPropValStringByName (const char *name) const
 Retrieves property value by name.
 
std::string getPropValStringByNumber (const int index) const
 Retrieves property raw text values by number.
 
std::string getRestrict (const int cutterNum) const
 Returns the list of restriction points for a cutter.
 
std::string getTitle () const
 Returns a name of the enzyme as appears in the file.
 
bool isIndependent () const
 Check whether multiple enzymes have been applied independently.
 
bool isSemiSpecific () const
 Returns TRUE if the enzyme is semi-specific.
 
bool isValid () const
 Use this method to do basic check on a newly created object.
 
ms_enzymeoperator= (const ms_enzyme &right)
 C++ style operator= for copying.
 
void setDefaultDelimiter (const char *delim)
 Allows to set a specific delimiter string to be used when no property-specific delimiter is supplied.
 
void setIndependent (const bool bit)
 Sets the flag that specifies whether multiple enzymes have been applied independently.
 
void setPreceedingComments (const std::string &comments)
 Sets any comments preceeding the section.
 
void setPropertyName (const int index, const char *name)
 Changes name of the property with the given index.
 
void setPropValBoolByName (const char *name, const bool value, const bool bFirstPlace=false)
 Changes a boolean value of the first entry with the given name or creates a new property if it is not found.
 
void setPropValCharByName (const char *name, const char value, const bool bFirstPlace=false)
 Changes a single character value of the first entry with the given name or creates a new property if it is not found.
 
void setPropValFloatByName (const char *name, const double value, const bool bFirstPlace=false)
 Changes an floating point value of the first entry with the given name or creates a new property if it is not found.
 
void setPropValInt64ByName (const char *name, const INT64 value, const bool bFirstPlace=false)
 Changes a long 64-bit integer value of the first entry with the given name or creates a new property if it is not found.
 
void setPropValIntByName (const char *name, const int value, const bool bFirstPlace=false)
 Changes an integer value of the first entry with the given name or creates a new property if it is not found.
 
void setPropValStringByName (const char *name, const char *value, const bool bFirstPlace=false)
 Changes a string value of the first entry with the given name or creates a new property if it is not found.
 
void setPropValStringByNumber (const int index, const char *value)
 Changes an string value of an existing property with the given index.
 
void setSemiSpecific (const bool value)
 Sets a new value for the semi specific flag.
 
void setTitle (const char *str)
 Sets a new title for the enzyme.
 
bool uncommentProp (const int index, const char *delimeter=0)
 Uncomments a line in the configuration file.
 
bool verifyEnzyme (ms_errs *errObj) const
 Tries to detect any inconsistencies in the enzyme definition.
 

Detailed Description

Represent a single entry in the enzymes file.

An instance of this class is normally be created by calling matrix_science::ms_enzymefile::getEnzymeByNumber() or matrix_science::ms_enzymefile::getEnzymeByName() and should then only be used in 'read-only' mode.

As well as 'simple' enzymes, the following cases are supported:

In case of independent enzymes an instance contains several enzyme definitions that can be iterated through. Otherwise several enzymes with mixed-term cutting are combined together.

Also get yourselves acquainted with the base class ms_customproperty. It facilitates the following tasks:

  • Retrieving an unsupported property.
  • Retrieving a raw/text/XML property representation.
  • Checking for existence of a certain property rather than dealing with its default value.
  • Accessing commented lines in a section.

More functionality is described in the documentation for ms_customproperty.

Examples
config_enzymes.cpp, and tools_aahelper.cpp.

Member Enumeration Documentation

◆ cuttertype

enum cuttertype

Definitions for types of cutter.

See Using enumerated values and static const ints in Perl, Java, Python and C#.

Enumerator
UNDEFINED_CUTTER 

Undefined - normally due to an invalid parameter when calling a function.

NTERM_CUTTER 

N Terminus cutter - cuts before the specified residue(s).

CTERM_CUTTER 

C Terminus cutter - cuts after the specified residue(s).

Constructor & Destructor Documentation

◆ ms_enzyme() [1/2]

ms_enzyme ( )

Default constructor.

An enzyme object should normally be created using matrix_science::ms_enzymefile::getEnzymeByNumber() or matrix_science::ms_enzymefile::getEnzymeByName().

◆ ms_enzyme() [2/2]

ms_enzyme ( const ms_enzyme src)

Copying constructor.

Note
You cannot use this constructor in programming languages other than C++.
Parameters
srcis the enzyme to make a copy of.

◆ ~ms_enzyme()

~ms_enzyme ( )

Destructor.

Called automatically from C++ and other languages.

Member Function Documentation

◆ addCutter()

void addCutter ( const cuttertype  type,
const char *  cleaveAtStr,
const char *  restrictStr 
)

Adds an cutter to the enzyme.

This function doesn't perform any checks for valid residues etc, so the verifyEnzyme() function should be called after adding a cutter.

Parameters
typeis either ms_enzyme::NTERM_CUTTER or ms_enzyme::CTERM_CUTTER.
cleaveAtStrOne or more residue letters which are the potential cleavage points.
restrictStrZero or more residue letters that are restriction points.

◆ appendProperty()

void appendProperty ( const char *  name,
const char *  value,
const char *  delimiter,
const bool  bFirstPlace = false 
)
inherited

Adds a new property with the given parameters.

Parameters
namea property name to use.
valuea property value to use.
delimitera specific delimiter or an empty string for a default one to be used.
bFirstPlaceforces a new property to be put on top of the list.

◆ appendText()

void appendText ( const char *  l,
const bool  bFirstPlace = false 
)
inherited

Adds a new non-parsed property.

All property elements will be retrieved from the first parameter. Before calling this method, a specific default delimiter can be set using setDefaultDelimiter().

Parameters
lraw text representation of the property to be parsed.
bFirstPlaceforces a new property to be put on top of the list.

◆ canCleave()

bool canCleave ( const int  cutterNum,
const char  leftResidue,
const char  rightResidue 
) const

Returns TRUE if the cutter can cut between the two residues.

Gives an answer for the question: Will the enzyme cut at the this position or not?

This function doesn't take into account the semi specific flag.

Parameters
cutterNummust be in the range 0..getNumberOfCutters()-1.
leftResidueamino acid letter representing a residue before the cutting point.
rightResidueamino acid letter representing a residue after the cutting point.
Returns
True if the enzyme can cleave at this point.

◆ clearAllCutters()

void clearAllCutters ( )

Deletes all cutters from the list.

Only useful when defining enzymes 'on the fly'.

◆ copyFrom()

void copyFrom ( const ms_enzyme right)

Can be used to create a clone.

Simply create an instance of the class using the default constructor and call this method.

Parameters
rightpointer to another instance to copy from.

◆ defaultValues()

void defaultValues ( )

Use this member to re-initialise an instance to default values.

The default values are no cutters, no title, independent = false and semiSpecific = false.

◆ delProp()

void delProp ( const char *  str)
inherited

Deletes all properties with the specified name.

Parameters
strProperty name to find a match and then delete.

◆ delPropStart()

void delPropStart ( const char *  str)
inherited

Deletes all properties whose names start with the given string.

Parameters
strBeginning a first part of the property name to delete.

◆ findProperty()

int findProperty ( const char *  name,
const int  startFrom = 0 
) const
inherited

Searches the list for a property with the given name.

If no property found with the given name -1 will be returned. There may be several property entries in the list with the same name.

Parameters
namea property name to be found.
startFroma minimal property index to start search from.
Returns
a property index or -1 if no property found.

◆ findPropertyBeginning()

int findPropertyBeginning ( const char *  nameBeginning,
const int  startFrom = 0 
) const
inherited

Searches the list for a property with the partially matching name.

If no property found with the given name part -1 will be returned. There may be several property entries in the list whose names start with the given string.

Parameters
nameBeginningfirst part of a property name to be found.
startFroma minimal property index to start search from.
Returns
a property index or -1 if no property found.

◆ getCleave()

std::string getCleave ( const int  cutterNum) const

Returns the list of cleavage points for a cutter.

Returns the residues after which an enzyme may cut (for a CTERM_CUTTER) or before which an enzyme may cut (for an NTERM_CUTTER).

See also
getRestrict()
Parameters
cutterNummust be in the range 0..getNumberOfCutters()-1.
Returns
A string of possible cleaveage points.
Examples
config_enzymes.cpp.

◆ getCutterType()

ms_enzyme::cuttertype getCutterType ( const int  cutterNum) const

Return the number of cutters that make up the enzyme definition.

Parameters
cutterNummust be in the range 0..getNumberOfCutters()-1.
Returns
ms_enzyme::NTERM_CUTTER, or ms_enzyme::CTERM_CUTTER or ms_enzyme::UNDEFINED_CUTTER if cutterNum is an invalid value.
Examples
config_enzymes.cpp.

◆ getDefaultDelimiter()

std::string getDefaultDelimiter ( ) const
inherited

Return current default delimiter string used for parsing/storing properties.

Returns
default delimiter

◆ getDelimiterByNumber()

std::string getDelimiterByNumber ( const int  index) const
inherited

Returns a specific delimiter used for the property.

Parameters
indexIndex for which to get a delimiter
Returns
corresponding delimiter

◆ getNumberOfCutters()

int getNumberOfCutters ( ) const

Returns the number of cutters.

For most enzymes, there will be just one cutter. See isIndependent() for details of multiple cutters in an enzyme.

The limit of 5 cutters per enzyme was raised to a limit of 20 cutters per enzyme in Parser 2.3.01.

Returns
The number of cutters.
Examples
config_enzymes.cpp.

◆ getNumberOfProperties()

int getNumberOfProperties ( ) const
inherited

Returns a total number of property/comment entries.

Returns
Number of property/comment entries

◆ getPreceedingComments()

std::string getPreceedingComments ( ) const
inherited

Returns any comments preceeding the section.

Sections in the mascot.dat file may have comments preceeding them. In most cases, these comments need to stay 'attached' to the section.

Multiple line comments are supported by having a single string with newline characters

See also
setPreceedingComments()
Returns
any comments preceeding the section

◆ getPropertyName()

std::string getPropertyName ( const int  index) const
inherited

Returns a property name for a given index.

Parameters
indexproperty number from 0 to (getNumberOfProperties()-1).
Returns
Rroperty name of an empty string for comments.

◆ getPropValStringByName()

std::string getPropValStringByName ( const char *  name) const
inherited

Retrieves property value by name.

Don't use this method for comments as they all have empty name. Also note that there might be several entries corresponding to the same name . – only the first value will be returned. If in doubt use findProperty() and getPropValStringByNumber() instead.

Parameters
nameName for which to get a property value
Returns
corresponding property value

◆ getPropValStringByNumber()

std::string getPropValStringByNumber ( const int  index) const
inherited

Retrieves property raw text values by number.

Parameters
indexIndex for which to get a property value
Returns
corresponding property value

◆ getRestrict()

std::string getRestrict ( const int  cutterNum) const

Returns the list of restriction points for a cutter.

Returns the residues after which an enzyme may cut (for a CTERM_CUTTER) or before which an enzyme may cut (for an NTERM_CUTTER).

See also
getCleave()
Parameters
cutterNummust be in the range 0..getNumberOfCutters()-1.
Returns
A string of possible cleaveage points.
Examples
config_enzymes.cpp.

◆ isIndependent()

bool isIndependent ( ) const

Check whether multiple enzymes have been applied independently.

In cases where a single enzyme has been used, the 'independent' flag has no meaning and would normally be set to false. Where multiple enzymes are used on a single sample, these can have been applied in two different ways:

  • Independent = true indicates that the specificities should be treated as if independent digests had been performed on separate sample aliquots and the resulting peptide mixtures combined. Thus, any given peptide will conform to the specificity of one cleavage type only. In the case of CNBr+Trypsin, if Independent was true, you would not find any peptides resulting from cleavage after K or R at one end, and cleavage after M at the other.
  • Independent = false indicates that the specificities are combined, as if the reagents had been applied simultaneously or serially to a single sample aliquot.
See also
getNumberOfCutters()
Returns
True if the cutters are applied independently.

◆ isSemiSpecific()

bool isSemiSpecific ( ) const

Returns TRUE if the enzyme is semi-specific.

Enzymes don't function perfectly all the time. In most cases where they fail to cut at the specified cleavage point, this only affects one terminus. In Mascot, when a semi specific enzyme is defined, peptides only need to conform to the cleavage specificity at one end.

All enzymes represented by the entry have to be either semi-specific or not.

Returns
True if the enzyme is semi specific.

◆ isValid()

bool isValid ( ) const

Use this method to do basic check on a newly created object.

This function calls verifyEnzyme() and is merely provided to give a consistently available function interface to the object. To determine the cause of any inconsistencies or errors, call verifyEnzyme() with an error object.

Returns
False if there are any errors in the enzyme definition.

◆ operator=()

ms_enzyme & operator= ( const ms_enzyme right)

C++ style operator= for copying.

Note
This operator is only available in C++.

Acts identically to copyFrom().

Parameters
rightis the enzyme definition to copy from.
Returns
reference to the current object

◆ setDefaultDelimiter()

void setDefaultDelimiter ( const char *  delim)
inherited

Allows to set a specific delimiter string to be used when no property-specific delimiter is supplied.

Parameters
delimString to set the default delimiter

◆ setIndependent()

void setIndependent ( const bool  bit)

Sets the flag that specifies whether multiple enzymes have been applied independently.

In cases where a single enzyme has been used, the 'independent' flag has no meaning and would normally be set to false. Where multiple enzymes are used on a single sample, these can have been applied in two different ways:

  • Independent = true indicates that the specificities should be treated as if independent digests had been performed on separate sample aliquots and the resulting peptide mixtures combined. Thus, any given peptide will conform to the specificity of one cleavage type only. In the case of CNBr+Trypsin, if Independent was true, you would not find any peptides resulting from cleavage after K or R at one end, and cleavage after M at the other.
  • Independent = false indicates that the specificities are combined, as if the reagents had been applied simultaneously or serially to a single sample aliquot.
See also
getNumberOfCutters()
Parameters
bitis the new value.

◆ setPreceedingComments()

void setPreceedingComments ( const std::string &  comments)
inherited

Sets any comments preceeding the section.

Sections in the mascot.dat file may have comments preceeding them. In most cases, these comments need to stay 'attached' to the section.

Multiple line comments are supported by having a single string with newline characters

See also
getPreceedingComments()
Parameters
commentsany comments preceeding the section

◆ setPropertyName()

void setPropertyName ( const int  index,
const char *  name 
)
inherited

Changes name of the property with the given index.

Parameters
indexproperty number from 0 to (getNumberOfProperties()-1).
namenew name to be given to the property.

◆ setPropValBoolByName()

void setPropValBoolByName ( const char *  name,
const bool  value,
const bool  bFirstPlace = false 
)
inherited

Changes a boolean value of the first entry with the given name or creates a new property if it is not found.

A new value will be converted into 1 (for TRUE) or 0 (for FALSE) character.

Parameters
namea name of the property to find or add.
valuea new boolean value for the property.
bFirstPlaceif not found a new property can be put on top of the list.

◆ setPropValCharByName()

void setPropValCharByName ( const char *  name,
const char  value,
const bool  bFirstPlace = false 
)
inherited

Changes a single character value of the first entry with the given name or creates a new property if it is not found.

Parameters
namea name of the property to find or add.
valuea new single character value for the property.
bFirstPlaceif not found a new property can be put on top of the list.

◆ setPropValFloatByName()

void setPropValFloatByName ( const char *  name,
const double  value,
const bool  bFirstPlace = false 
)
inherited

Changes an floating point value of the first entry with the given name or creates a new property if it is not found.

Parameters
namea name of the property to find or add.
valuea new floating point value for the property.
bFirstPlaceif not found a new property can be put on top of the list.

◆ setPropValInt64ByName()

void setPropValInt64ByName ( const char *  name,
const INT64  value,
const bool  bFirstPlace = false 
)
inherited

Changes a long 64-bit integer value of the first entry with the given name or creates a new property if it is not found.

Parameters
namea name of the property to find or add.
valuea new long 64-bit integer value for the property.
bFirstPlaceif not found a new property can be put on top of the list.

◆ setPropValIntByName()

void setPropValIntByName ( const char *  name,
const int  value,
const bool  bFirstPlace = false 
)
inherited

Changes an integer value of the first entry with the given name or creates a new property if it is not found.

Parameters
namea name of the property to find or add.
valuea new integer value for the property.
bFirstPlaceif not found a new property can be put on top of the list.

◆ setPropValStringByName()

void setPropValStringByName ( const char *  name,
const char *  value,
const bool  bFirstPlace = false 
)
inherited

Changes a string value of the first entry with the given name or creates a new property if it is not found.

Parameters
namea name of the property to find or add.
valuea new string value for the property.
bFirstPlaceif not found a new property can be put on top of the list.

◆ setPropValStringByNumber()

void setPropValStringByNumber ( const int  index,
const char *  str 
)
inherited

Changes an string value of an existing property with the given index.

Parameters
indexan index of an existing property.
strString value for the property.

◆ setSemiSpecific()

void setSemiSpecific ( const bool  value)

Sets a new value for the semi specific flag.

C++ If you load an enzyme using matrix_science::ms_enzymefile::getEnzymeByNumber() or matrix_science::ms_enzymefile::getEnzymeByName(), you will not be able to call this member because those functions return a const pointer.

Calling this function will not affect the enzymes file. See ms_enzymefile::updateByNumber() and ms_enzymefile::updateByName().

Enzymes don't function perfectly all the time. In most cases where they fail to cut at the specified cleavage point, this only affects one terminus. In Mascot, when a semi specific enzyme is defined, peptides only need to conform to the cleavage specificity at one end.

All enzymes represented by the entry have to be either semi-specific or not.

Parameters
valueis the new flag to specify if the enzyme is semi specific.
Examples
config_enzymes.cpp.

◆ setTitle()

void setTitle ( const char *  str)

Sets a new title for the enzyme.

C++: If you load an enzyme using matrix_science::ms_enzymefile::getEnzymeByNumber() or matrix_science::ms_enzymefile::getEnzymeByName(), you will not be able to call this member because those functions return a const pointer.

Calling this will not affect the enzymes file. See ms_enzymefile::updateByNumber() and ms_enzymefile::updateByName().

Parameters
stris the new name for the enzyme.

◆ uncommentProp()

bool uncommentProp ( const int  index,
const char *  delimeter = 0 
)
inherited

Uncomments a line in the configuration file.

Removes a # and any white space. Finds the delimeter and extracts the property name and value.

Parameters
indexmust be a value between 0 and getNumberOfProperties().
delimeterwill often be a space. If not supplied, the default delimeter will be used.
Returns
true if the delimiter was found, false otherwise

◆ verifyEnzyme()

bool verifyEnzyme ( ms_errs errObj) const

Tries to detect any inconsistencies in the enzyme definition.

If errors are found in the enzyme definition, the ms_errs::ERR_MSP_ENZYME_DEFINITION_PROBLEM error will be set, once for each error. Each error message will also include one of following additional text strings.

The reason or method required to 'fix' the error are the following:

  • "empty title" - Need to call setTitle().
  • "no cutting rules" - Need to call addCutter() at least once.
  • "more restrict than cleave rules for C-term" - probably an internal parser error.
  • "more restrict than cleave rules for N-term" - probably an internal parser error.
  • "no cleavage residues for a cutter" - addCutter() has been called with an empty or invalid cleaveAtStr().
  • "too many cleavage residues specified" - all residues have been specified for cleaving at.
  • "too many restricting residues specified" - all residues have been specified as restriction, meaning that the enzyme won't cut anywhere.
  • "cleavage residues must be uppercase A-Z" - a lower case letter or a non alphabetic character has been specified.
  • "restrict residues must be uppercase A-Z" - a lower case letter or a non alphabetic character has been specified.
Parameters
errObjpassed error-object to store error messages.
Returns
true if the enzyme definition is valid.

The documentation for this class was generated from the following files: