This class encapsulates a single entry (an instrument) from a fragmentation_rules
file.
More...
#include <ms_fragmentationrules.hpp>
Public Types | |
enum | FRAG_SERIES_TYPE { FRAG_IMMONIUM = 4 , FRAG_A_SERIES = 5 , FRAG_A_MINUS_NH3 = 6 , FRAG_A_MINUS_H2O = 7 , FRAG_B_SERIES = 8 , FRAG_B_MINUS_NH3 = 9 , FRAG_B_MINUS_H2O = 10 , FRAG_C_SERIES = 11 , FRAG_X_SERIES = 12 , FRAG_Y_SERIES = 13 , FRAG_Y_MINUS_NH3 = 14 , FRAG_Y_MINUS_H2O = 15 , FRAG_Z_SERIES = 16 , FRAG_INTERNAL_YB = 17 , FRAG_INTERNAL_YA = 18 , FRAG_Z_PLUS_1 = 21 , FRAG_D_SERIES = 22 , FRAG_V_SERIES = 23 , FRAG_W_SERIES = 24 , FRAG_Z_PLUS_2 = 25 } |
Definitions for ID-constants for series used. More... | |
Public Member Functions | |
ms_fragmentationrules () | |
Default constructor is used to create an empty object. | |
ms_fragmentationrules (const ms_fragmentationrules &src) | |
Copying constructor. | |
~ms_fragmentationrules () | |
Destructor. | |
bool | anyNLseriesUsed (const int series) const |
Will return true if any 'neutral loss' series is specified for this series. | |
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. | |
void | clearSeries () |
Deletes all series usage information. | |
void | copyFrom (const ms_customproperty *src) |
Copies all properties and comments from another instance. | |
void | copyFrom (const ms_fragmentationrules *right) |
Copies all information from another instance of the class. | |
void | defaultValues () |
Initialises the instance with 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 | 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. | |
double | getMaxInternalMass () const |
Returns the maximum mass to be considered for internal fragments. | |
double | getMinInternalMass () const |
Returns the minimum mass to be considered for internal fragments. | |
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 | getTitle () const |
Returns the title of the instrument. | |
bool | isCharged2Plus () const |
Returns true if the 'doubly charged 2+' fragmentation rule is specified. | |
bool | isCharged3Plus () const |
Returns true if the 'doubly charged 3+' fragmentation rule is specified. | |
bool | isSeriesUsed (const int series) const |
Returns true if a given series is specified for the instrument. | |
bool | isSinglyCharged () const |
Returns true if the 'singly charged' fragmentation rule is specified. | |
bool | isValid () const |
Use this method to do a basic check on a newly created object. | |
ms_fragmentationrules & | operator= (const ms_fragmentationrules &right) |
Assignment operator. | |
void | setCharged2Plus (const bool value) |
Change the availability the of 'doubly charged 2+' fragmentation rule. | |
void | setCharged3Plus (const bool value) |
Change the availability the of 'doubly charged 3+' fragmentation rule. | |
void | setDefaultDelimiter (const char *delim) |
Allows to set a specific delimiter string to be used when no property-specific delimiter is supplied. | |
void | setMaxInternalMass (const double mass) |
Sets the maximum mass to be considered for internal fragments. | |
void | setMinInternalMass (const double mass) |
Set the minimum mass to be considered for internal fragments. | |
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 | setSeriesUsed (const int series, const bool val) |
Sets availability on a given series. | |
void | setSinglyCharged (const bool value) |
Change the availability of the 'singly charged' fragmentation rule. | |
void | setTitle (const char *title) |
Assigns a new title to the rule. | |
bool | uncommentProp (const int index, const char *delimeter=0) |
Uncomments a line in the configuration file. | |
bool | verifyRule (ms_errs *err_, const bool tryToFix) |
Tries to detect any inconsistencies in the instrument definition. | |
Static Public Member Functions | |
static int | getFirstSerie () |
The lowest series number that can be used. | |
static int | getFirstSeries () |
The lowest series number that can be used. | |
static int | getLastSerie () |
The highest series number that can be used. | |
static int | getLastSeries () |
The highest series number that can be used. | |
static std::string | getSeriesDescription (const int series) |
Returns a description string for a given series. | |
static std::string | getSeriesName (const int series) |
Returns a short series name. | |
static int | getTotalSeriesOutput () |
Returns the length of the series string output in a Mascot results file. | |
static bool | isBackboneSeries (const int series) |
Returns true if the series is a 'backbone' fragment. | |
static bool | isNeutralLossSeries (const int series) |
Returns true if the series is a 'neutral loss' series. | |
This class encapsulates a single entry (an instrument) from a fragmentation_rules
file.
Objects of this class are normally created by loading a file using the ms_fragrulesfile class.
Also get yourselves acquainted with the base class ms_customproperty. It facilitates the following tasks:
More functionality is described in the documentation for ms_customproperty.
enum FRAG_SERIES_TYPE |
Definitions for ID-constants for series used.
See Using enumerated values and static const ints in Perl, Java, Python and C#.
See http://www.matrixscience.com/help/fragmentation_help.html for details of ions types.
Default constructor is used to create an empty object.
Use member functions to fill up the list of allowed series.
Destructor.
Frees all memory allocated for the object.
bool anyNLseriesUsed | ( | const int | series | ) | const |
Will return true if any 'neutral loss' series is specified for this series.
series | must be a number between getFirstSeries() and getLastSeries() inclusive. |
|
inherited |
Adds a new property with the given parameters.
name | a property name to use. |
value | a property value to use. |
delimiter | a specific delimiter or an empty string for a default one to be used. |
bFirstPlace | forces a new property to be put on top of the list. |
|
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().
l | raw text representation of the property to be parsed. |
bFirstPlace | forces a new property to be put on top of the list. |
void clearSeries | ( | ) |
Deletes all series usage information.
All series are set to be unused, but the instrument title is retained.
void copyFrom | ( | const ms_fragmentationrules * | right | ) |
Copies all information from another instance of the class.
right | is the fragmentation rules to copy from. |
void defaultValues | ( | ) |
Initialises the instance with default values.
Sets all series to be unused.
|
inherited |
Deletes all properties with the specified name.
str | Property name to find a match and then delete. |
|
inherited |
Deletes all properties whose names start with the given string.
str | Beginning a first part of the property name to delete. |
|
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.
name | a property name to be found. |
startFrom | a minimal property index to start search from. |
|
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.
nameBeginning | first part of a property name to be found. |
startFrom | a minimal property index to start search from. |
|
inherited |
Return current default delimiter string used for parsing/storing properties.
|
inherited |
Returns a specific delimiter used for the property.
index | Index for which to get a delimiter |
|
static |
The lowest series number that can be used.
|
static |
The lowest series number that can be used.
|
static |
The highest series number that can be used.
|
static |
The highest series number that can be used.
double getMaxInternalMass | ( | ) | const |
Returns the maximum mass to be considered for internal fragments.
Introduced in Mascot 2.2, the values for minimum and maximum internal masses are specified in the fragmentation_rules
file as
minInternalMass 0.0 maxInternalMass 700.0
These are the masses used for the FRAG_INTERNAL_YB and FRAG_INTERNAL_YA series.
double getMinInternalMass | ( | ) | const |
Returns the minimum mass to be considered for internal fragments.
Introduced in Mascot 2.2, the values for minimum and maximum internal masses are specified in the fragmentation_rules
file as
minInternalMass 0.0 maxInternalMass 700.0
These are the masses used for the FRAG_INTERNAL_YB and FRAG_INTERNAL_YA series.
|
inherited |
Returns a total number of property/comment entries.
|
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
|
inherited |
Returns a property name for a given index.
index | property number from 0 to (getNumberOfProperties()-1). |
|
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.
name | Name for which to get a property value |
|
inherited |
Retrieves property raw text values by number.
index | Index for which to get a property value |
|
static |
Returns a description string for a given series.
series | must be a number between getFirstSeries() and getLastSeries() inclusive. |
|
static |
Returns a short series name.
series | must be a number between getFirstSeries() and getLastSeries() inclusive. |
std::string getTitle | ( | ) | const |
Returns the title of the instrument.
This is obtained from the
title:
line in the fragmentation_rules
file.
|
static |
Returns the length of the series string output in a Mascot results file.
|
static |
Returns true if the series is a 'backbone' fragment.
series | must be a number between getFirstSeries() and getLastSeries() inclusive. |
bool isCharged2Plus | ( | ) | const |
Returns true if the 'doubly charged 2+' fragmentation rule is specified.
bool isCharged3Plus | ( | ) | const |
Returns true if the 'doubly charged 3+' fragmentation rule is specified.
|
static |
Returns true if the series is a 'neutral loss' series.
series | must be a number between getFirstSeries() and getLastSeries() inclusive. |
bool isSeriesUsed | ( | const int | series | ) | const |
Returns true if a given series is specified for the instrument.
Currently supported series are (FRAG_SERIES_TYPE):
In addition, two more rules may be specified:
series | must be a number between getFirstSeries() and getLastSeries() inclusive. |
bool isSinglyCharged | ( | ) | const |
Returns true if the 'singly charged' fragmentation rule is specified.
bool isValid | ( | ) | const |
Use this method to do a basic check on a newly created object.
The verifyRule() function will generally be more useful.
ms_fragmentationrules & operator= | ( | const ms_fragmentationrules & | right | ) |
Assignment operator.
right | is the fragmentation rules to copy from. |
void setCharged2Plus | ( | const bool | value | ) |
Change the availability the of 'doubly charged 2+' fragmentation rule.
value | should be set to true if rule 2, doubly charged if precursor 2+ or higher is to be specified and therefore 2+ ions, for the specified series (not internal or immonium) are to be considered. |
void setCharged3Plus | ( | const bool | value | ) |
Change the availability the of 'doubly charged 3+' fragmentation rule.
value | should be set to true if rule 3, doubly charged if precursor 3+ or higher is to be specified and therefore 2+ ions, for the specified series (not internal or immonium) are to be considered. |
|
inherited |
Allows to set a specific delimiter string to be used when no property-specific delimiter is supplied.
delim | String to set the default delimiter |
void setMaxInternalMass | ( | const double | mass | ) |
Sets the maximum mass to be considered for internal fragments.
Introduced in Mascot 2.2, the values for minimum and maximum internal masses are specified in the fragmentation_rules
file as
minInternalMass 0.0 maxInternalMass 700.0
These are the masses used for the FRAG_INTERNAL_YB and FRAG_INTERNAL_YA series.
mass | The new maximum internal mass to be considered for this instrument. |
void setMinInternalMass | ( | const double | mass | ) |
Set the minimum mass to be considered for internal fragments.
Introduced in Mascot 2.2, the values for minimum and maximum internal masses are specified in the fragmentation_rules
file as
minInternalMass 0.0 maxInternalMass 700.0
These are the masses used for the FRAG_INTERNAL_YB and FRAG_INTERNAL_YA series.
mass | The new minimum internal mass to be considered for this instrument. |
|
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
comments | any comments preceeding the section |
|
inherited |
Changes name of the property with the given index.
index | property number from 0 to (getNumberOfProperties()-1). |
name | new name to be given to the property. |
|
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.
name | a name of the property to find or add. |
value | a new boolean value for the property. |
bFirstPlace | if not found a new property can be put on top of the list. |
|
inherited |
Changes a single character value of the first entry with the given name or creates a new property if it is not found.
name | a name of the property to find or add. |
value | a new single character value for the property. |
bFirstPlace | if not found a new property can be put on top of the list. |
|
inherited |
Changes an floating point value of the first entry with the given name or creates a new property if it is not found.
name | a name of the property to find or add. |
value | a new floating point value for the property. |
bFirstPlace | if not found a new property can be put on top of the list. |
|
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.
name | a name of the property to find or add. |
value | a new long 64-bit integer value for the property. |
bFirstPlace | if not found a new property can be put on top of the list. |
|
inherited |
Changes an integer value of the first entry with the given name or creates a new property if it is not found.
name | a name of the property to find or add. |
value | a new integer value for the property. |
bFirstPlace | if not found a new property can be put on top of the list. |
|
inherited |
Changes a string value of the first entry with the given name or creates a new property if it is not found.
name | a name of the property to find or add. |
value | a new string value for the property. |
bFirstPlace | if not found a new property can be put on top of the list. |
|
inherited |
Changes an string value of an existing property with the given index.
index | an index of an existing property. |
str | String value for the property. |
void setSeriesUsed | ( | const int | series, |
const bool | val | ||
) |
Sets availability on a given series.
See isSeriesUsed() for a list of available series.
series | must be a number between getFirstSeries() and getLastSeries() inclusive. |
val | is a boolean value to specify whether the series should be considered. |
void setSinglyCharged | ( | const bool | value | ) |
Change the availability of the 'singly charged' fragmentation rule.
value | should be set to true if rule 1 (singly charged ions) are to be considered. |
void setTitle | ( | const char * | title | ) |
Assigns a new title to the rule.
title | is the new title. |
|
inherited |
Uncomments a line in the configuration file.
Removes a # and any white space. Finds the delimeter and extracts the property name and value.
index | must be a value between 0 and getNumberOfProperties(). |
delimeter | will often be a space. If not supplied, the default delimeter will be used. |
bool verifyRule | ( | ms_errs * | errObj, |
const bool | tryToFix | ||
) |
Tries to detect any inconsistencies in the instrument definition.
This method tries to detect any inconsistencies and to fix some of them.
When tryToFix is set to true will force the method to try and fix the instrument definition and return a success code. In this case, error descriptions for the problems detected (and fixed) will be accumulated in errObj.
For example, if the FRAG_A_MINUS_NH3 series is specified, and FRAG_A_SERIES isn't specified, then, if tryToFix is specified, FRAG_A_SERIES will be added, and the ms_errs::ERR_MSP_FRAGMENTATION_RULES error will be added to the errObj list.
errObj | error-object to store error messages. |
tryToFix | if true, try to fix any problems encountered. |