Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches

This class facilitates creation of peptides and calculation of MS-fragment masses. More...

#include <ms_aahelper.hpp>

Inheritance diagram for ms_aahelper:
Collaboration diagram for ms_aahelper:

Public Types

enum  FRAG_NL {
  FRAG_NL_PRIMARY = 0x0001 ,
  FRAG_NL_SECONDARY = 0x0010
}
 Flag for controlling iteration over multiple neutral losses. More...
 

Public Member Functions

 ms_aahelper ()
 Default constructor.
 
 ms_aahelper (const ms_aahelper &right)
 Copying constructor.
 
 ms_aahelper (const ms_mascotresfilebase &resfile, const char *enzymeFileName, const char *quantSchemaFilePath="http://www.matrixscience.com/xmlns/schema/quantitation_2 ../html/xmlns/schema/quantitation_2/quantitation_2.xsd http://www.matrixscience.com/xmlns/schema/quantitation_1 ../html/xmlns/schema/quantitation_1/quantitation_1.xsd", const char *unimodSchemaFilePath="http://www.unimod.org/xmlns/schema/unimod_2 ../html/xmlns/schema/unimod_2/unimod_2.xsd")
 Constructor from results file.
 
 ms_aahelper (const ms_mascotresults &summary, const char *enzymeFileName, const char *quantSchemaFilePath="http://www.matrixscience.com/xmlns/schema/quantitation_2 ../html/xmlns/schema/quantitation_2/quantitation_2.xsd http://www.matrixscience.com/xmlns/schema/quantitation_1 ../html/xmlns/schema/quantitation_1/quantitation_1.xsd", const char *unimodSchemaFilePath="http://www.unimod.org/xmlns/schema/unimod_2 ../html/xmlns/schema/unimod_2/unimod_2.xsd")
 Constructor from peptide summary or protein summary.
 
 ~ms_aahelper ()
 Destructor.
 
void appendErrors (const ms_errors &src)
 Copies all errors from another instance and appends them at the end of own list.
 
std::vector< double > calcFragments (const ms_peptide *peptide, const int seriesID, const bool doubleCharged, const double minMass, const double maxMass, const MASS_TYPE massType, ms_fragmentvector *fragments, ms_errs *err, const FRAG_NL fragNlType=FRAG_NL_PRIMARY) const
 Returns a vector of ion masses for the given series and peptide.
 
std::vector< double > calcFragments (const ms_peptide *peptide, const int seriesID, const bool doubleCharged, const double minMass, const double maxMass, const MASS_TYPE massType, std::vector< ms_fragment > *fragments, ms_errs *err, const FRAG_NL fragNlType=FRAG_NL_PRIMARY) const
 Returns a vector of ion masses for the given series and peptide.
 
bool calcFragmentsEx (const ms_peptide *peptide, const int seriesID, const int fragCharge, const double minMass, const double maxMass, const MASS_TYPE massType, ms_fragmentvector *fragments, ms_errs *err, const FRAG_NL fragNlType=FRAG_NL_PRIMARY) const
 Returns a vector of ion masses for the given series and peptide.
 
bool calcFragmentsEx (const ms_peptide *peptide, const int seriesID, const int fragCharge, const double minMass, const double maxMass, const MASS_TYPE massType, std::vector< ms_fragment > *fragments, ms_errs *err, const FRAG_NL fragNlType=FRAG_NL_PRIMARY) const
 Returns a vector of ion masses for the given series and peptide.
 
double calcPeptideMZ (const char *proteinStr, const int proteinLen, const int startPos, const int endPos, const std::vector< int > numThatMustBeModded, const int charge, const MASS_TYPE massType, ms_errs *err) const
 Calculates and returns a peptide m/z (or Mr) value without specifying exact positions of modified residues.
 
void clearAllErrors ()
 Remove all errors from the current list of errors.
 
void copyFrom (const ms_aahelper *right)
 Copies all data from another instance of the class.
 
void copyFrom (const ms_errors *right)
 Use this member to make a copy of another instance.
 
ms_peptide createCrosslinkedPeptide (const ms_peptide &pepAlpha, const ms_peptide &pepBeta, const ms_linker_site_vector &linkedSites, ms_errs *err) const
 Creates and returns a crosslinked peptide object.
 
ms_peptide createPeptide (const char *proteinStr, const int proteinLen, const int startPos, const int endPos, const std::vector< int > varMods, const std::vector< int > varModsWhichNl, const int charge, const MASS_TYPE massType, ms_errs *err) const
 Creates and returns a peptide object.
 
ms_peptide createPeptide (const char *proteinStr, const int proteinLen, const int startPos, const int endPos, const std::vector< int > varMods, const std::vector< int > varModsWhichNl, const std::vector< int > summedMods, const std::vector< int > summedModsWhichNl, const int charge, const MASS_TYPE massType, ms_errs *err) const
 Creates and returns a peptide object.
 
void defaultValues ()
 Initialises the instance.
 
const ms_enzymegetEnzyme () const
 Returns a pointer to the current enzyme.
 
const ms_errsgetErrorHandler () const
 Retrive the error object using this function to get access to all errors and error parameters.
 
ms_modvector getFixedMods () const
 Returns a list of fixed modifications that have been successfully applied i.e. don't have conflicts.
 
int getLastError () const
 Return the error description of the last error that occurred.
 
std::string getLastErrorString () const
 Return the error description of the last error that occurred.
 
const ms_massesgetMasses () const
 Returns a pointer to the internal copy of the masses file.
 
int getMissed () const
 Returns number of missed cleavage sites for the current peptide.
 
bool getNextPeptide ()
 Call to iterate to the next peptide.
 
int getPepEnd () const
 Returns the last position of the current peptide.
 
int getPepStart () const
 Returns the first position of the current peptide.
 
ms_modvector getVarMods () const
 Returns a list of variable modifications that have no conflicts with fixed modifications.
 
bool isValid () const
 Call this function to determine if there have been any errors.
 
ms_aahelperoperator= (const ms_aahelper &right)
 Assignment operator.
 
void setAvailableModifications (const ms_modvector *fixedModVector, const ms_modvector *varModVector)
 Applies fixed modifications to residue masses and stores variable modifications for later use.
 
void setEnzyme (const ms_enzyme *enzyme)
 Sets an enzyme to use.
 
void setMasses (const ms_masses *masses)
 Copies all residue and chemical element masses from the masses file instance.
 
void startIteratePeptides (const char *sequenceProtein, const int sizeProtein, const int pfa)
 Initialises internal members in preparation for generating peptides.
 
void stopIteratePeptides ()
 Stop iterating.
 

Detailed Description

This class facilitates creation of peptides and calculation of MS-fragment masses.

Examples
tools_aahelper.cpp.

Member Enumeration Documentation

◆ FRAG_NL

enum FRAG_NL

Flag for controlling iteration over multiple neutral losses.

If any modification has multiple neutral losses, ms_aahelper::calcFragments() and ms_aahelper::calcFragmentsEx() default to calculating fragments for the primary neutral loss. The primary NL choice is encoded in the peptide's neutral loss string (ms_peptide::getPrimaryNlStr()) – or strings if the peptide has some combination of variable mods, summed mods, ET mods or local mods.

Enumerator
FRAG_NL_PRIMARY 

Calculate fragments for primary neutral loss.

FRAG_NL_SECONDARY 

Calculate fragments for non-primary neutral losses.

Constructor & Destructor Documentation

◆ ms_aahelper() [1/2]

ms_aahelper ( const ms_mascotresfilebase resfile,
const char *  enzymeFileName,
const char *  quantSchemaFilePath = "http://www.matrixscience.com/xmlns/schema/quantitation_2  ../html/xmlns/schema/quantitation_2/quantitation_2.xsd http://www.matrixscience.com/xmlns/schema/quantitation_1 ../html/xmlns/schema/quantitation_1/quantitation_1.xsd",
const char *  unimodSchemaFilePath = "http://www.unimod.org/xmlns/schema/unimod_2 ../html/xmlns/schema/unimod_2/unimod_2.xsd" 
)

Constructor from results file.

This constructor extracts the enzyme information if available from the passed results file object. The masses information is loaded from the file using the matrix_science::ms_mascotresfilebase::getMasses() function. The modifications are read from the results file and added using setAvailableModifications().

Results files prior to Mascot 2.2 did not include specificity information. If the enzyme definition is not in the results file, the function attempts to load the enzymes file and find the correct enzyme defintion. It then calls the setEnzyme() function. Also, the modification information in the results file doesn't record specificities unambiguously, so these are derived when calcFragmentsEx() or similar are called.

The application should call isValid() after creating the object. If isValid() returns false, error messages are available, see Error Handling

Parameters
resfileneeds to be a valid resfile object.
enzymeFileNamewill only be used for Mascot results files from versions prior to Mascot 2.2 which don't have the specificities in the results file.
quantSchemaFilePathis required for when the results file contains a quantitation method that needs to be loaded and validated against a schema. There are three possible values for this function:
  • NULL or 0 - In this case, the schema directory must have been specified using the XMLschemaDirectory parameter in the ms_mascotresfilebase constructor. This is the easiest method to use, and is the preferred parameter for Mascot Parser 2.5 and later.
  • If not specified, the default is suitable for when Parser is being used on a Mascot Server.
  • Explicitly passing a string in the appropriate format. This is passed to ms_quant_configfile::setSchemaFileName before calling ms_mascotresfilebase::getQuantitation(). When using this function on a system where Mascot Server is not installed, it will be necessary to supply the xsd files. The quantitation_1.xsd and quantitation_2.xsd files are supplied with Mascot Parser and will need to be installed with any application that uses this function in Mascot Parser. The format of the string should be the same as the default parameter, just replace the paths for the .xsd files with the path of the installed xsd fils.
unimodSchemaFilePathis required for results files from Mascot 2.2 and later where the modification information is in the results file in XML format and needs a schema for validation. There are three possible values for this function:
  • NULL or 0 - In this case, the schema directory must have been specified using the XMLschemaDirectory parameter in the ms_mascotresfilebase constructor. This is the easiest method to use, and is the preferred parameter for Mascot Parser 2.5 and later.
  • If not specified, the default is suitable for when Parser is being used on a Mascot Server.
  • Explicitly passing a string in the appropriate format. This is passed to ms_umod_configfile::setSchemaFileName before calling: ms_mascotresfilebase::getUnimod(). When using this function on a system where Mascot Server is not installed, it will be necessary to supply the xsd file. The unimod_2.xsd file is supplied with Mascot Parser and will need to be installed with any application that uses this function in Mascot Parser. The format of the string should be the same as the default parameter, just replace the path for the .xsd with the path of the installed unimod_2.xsd file.

◆ ms_aahelper() [2/2]

ms_aahelper ( const ms_mascotresults summary,
const char *  enzymeFileName,
const char *  quantSchemaFilePath = "http://www.matrixscience.com/xmlns/schema/quantitation_2  ../html/xmlns/schema/quantitation_2/quantitation_2.xsd http://www.matrixscience.com/xmlns/schema/quantitation_1 ../html/xmlns/schema/quantitation_1/quantitation_1.xsd",
const char *  unimodSchemaFilePath = "http://www.unimod.org/xmlns/schema/unimod_2 ../html/xmlns/schema/unimod_2/unimod_2.xsd" 
)

Constructor from peptide summary or protein summary.

This constructor is similar to ms_aahelper(const ms_mascotresfilebase&, const char*, const char*, const char*), but additionally allows ms_aahelper::calcFragmentsEx() to look up error tolerant modifications and spectral library modifications from the results file.

The constructor extracts the enzyme information if available from the passed results file object. The masses information is loaded from the file using the matrix_science::ms_mascotresfilebase::getMasses() function. The modifications are read from the results file and added using setAvailableModifications().

Results files prior to Mascot 2.2 did not include specificity information. If the enzyme definition is not in the results file, the function attempts to load the enzymes file and find the correct enzyme defintion. It then calls the setEnzyme() function. Also, the modification information in the results file doesn't record specificities unambiguously, so these are derived when calcFragmentsEx() or similar are called.

The application should call isValid() after creating the object. If isValid() returns false, error messages are available, see Error Handling

Parameters
summaryneeds to be a valid ms_mascotresults object, either ms_peptidesummary or ms_proteinsummary.
enzymeFileNamewill only be used for Mascot results files from versions prior to Mascot 2.2 which don't have the specificities in the results file.
quantSchemaFilePathis required for when the results file contains a quantitation method that needs to be loaded and validated against a schema. There are three possible values for this function:
  • NULL or 0 - In this case, the schema directory must have been specified using the XMLschemaDirectory parameter in the ms_mascotresfilebase constructor. This is the easiest method to use, and is the preferred parameter for Mascot Parser 2.5 and later.
  • If not specified, the default is suitable for when Parser is being used on a Mascot Server.
  • Explicitly passing a string in the appropriate format. This is passed to ms_quant_configfile::setSchemaFileName before calling ms_mascotresfilebase::getQuantitation(). When using this function on a system where Mascot Server is not installed, it will be necessary to supply the xsd files. The quantitation_1.xsd and quantitation_2.xsd files are supplied with Mascot Parser and will need to be installed with any application that uses this function in Mascot Parser. The format of the string should be the same as the default parameter, just replace the paths for the .xsd files with the path of the installed xsd fils.
unimodSchemaFilePathis required for results files from Mascot 2.2 and later where the modification information is in the results file in XML format and needs a schema for validation. There are three possible values for this function:
  • NULL or 0 - In this case, the schema directory must have been specified using the XMLschemaDirectory parameter in the ms_mascotresfilebase constructor. This is the easiest method to use, and is the preferred parameter for Mascot Parser 2.5 and later.
  • If not specified, the default is suitable for when Parser is being used on a Mascot Server.
  • Explicitly passing a string in the appropriate format. This is passed to ms_umod_configfile::setSchemaFileName before calling: ms_mascotresfilebase::getUnimod(). When using this function on a system where Mascot Server is not installed, it will be necessary to supply the xsd file. The unimod_2.xsd file is supplied with Mascot Parser and will need to be installed with any application that uses this function in Mascot Parser. The format of the string should be the same as the default parameter, just replace the path for the .xsd with the path of the installed unimod_2.xsd file.

Member Function Documentation

◆ appendErrors()

void appendErrors ( const ms_errors src)
inherited

Copies all errors from another instance and appends them at the end of own list.

Parameters
srcThe object to copy the errors across from. See Maintaining object references: two rules of thumb.

◆ calcFragments() [1/2]

std::vector< double > calcFragments ( const ms_peptide peptide,
const int  seriesID,
const bool  doubleCharged,
const double  minMass,
const double  maxMass,
const MASS_TYPE  massType,
ms_fragmentvector fragments,
ms_errs err,
const FRAG_NL  fragNlType = FRAG_NL_PRIMARY 
) const

Returns a vector of ion masses for the given series and peptide.

For 'regular' sequence type ions, the final fragment mass (approximately the peptide mass less the terminus) will not be returned.

Note that this method does not take the peptide object's seriesUsedStr into account (see ms_peptide::getSeriesUsedStr()). The rules in Mascot state that fragments for neutral loss series (A_MINUS_NH3, A_MINUS_H2O, and corresponding series for B and Y) should only be generated if the peptide match has a statistically significant number of matches to the corresponding singly charged parent ion series (e.g. A_MINUS_NH3 requires enough matches to singly charged A series fragments). You can take this into account by testing whether seriesUsedStr contains 1 or 2 for the singly charged parent ion series. See ms_peptide::getSeriesUsedStr().

Parameters
peptidepeptide object to generate ion masses for.
seriesIDseries number from ms_fragmentationrules::FRAG_SERIES_TYPE.
doubleChargedsome ion series allow double charged fragment; supply TRUE if you want to get mass over charge values for double charged ions only. Otherwise single charged ions will be generated. If the given series doesn't allow double charged ions then an empty list will be returned and err will reflect the inconsistency.
minMassminimal possible mass value to return.
maxMassmaximal possible mass value to return.
massTypeSpecify matrix_science::MASS_TYPE_MONO or matrix_science::MASS_TYPE_AVE.
fragmentsa vector of items with more detailed information about each peptide fragment. Any existing items in the fragment vector will be overwritten by this function.
errerror object that accumulates messages without affecting the object validity.
fragNlType(optional) Either ms_aahelper::FRAG_NL_PRIMARY or ms_aahelper::FRAG_NL_SECONDARY. Default is FRAG_NL_PRIMARY.
Returns
A vector of ions masses. Use of the return value is deprecated.
Examples
tools_aahelper.cpp.

◆ calcFragments() [2/2]

std::vector< double > calcFragments ( const ms_peptide peptide,
const int  seriesID,
const bool  doubleCharged,
const double  minMass,
const double  maxMass,
const MASS_TYPE  massType,
std::vector< ms_fragment > *  fragments,
ms_errs err,
const FRAG_NL  fragNlType = FRAG_NL_PRIMARY 
) const

Returns a vector of ion masses for the given series and peptide.

Note
This method can only be used in C++. Use the other calcFragments() method from other programming languages.

For 'regular' sequence type ions, the final fragment mass (approximately the peptide mass less the terminus) will not be returned.

Note that this method does not take the peptide object's seriesUsedStr into account (see ms_peptide::getSeriesUsedStr()). The rules in Mascot state that fragments for neutral loss series (A_MINUS_NH3, A_MINUS_H2O, and corresponding series for B and Y) should only be generated if the peptide match has a statistically significant number of matches to the corresponding singly charged parent ion series (e.g. A_MINUS_NH3 requires enough matches to singly charged A series fragments). You can take this into account by testing whether seriesUsedStr contains 1 or 2 for the singly charged parent ion series. See ms_peptide::getSeriesUsedStr().

Parameters
peptidepeptide object to generate ion masses for.
seriesIDseries number from ms_fragmentationrules::FRAG_SERIES_TYPE.
doubleChargedsome ion series allow double charged fragment; supply TRUE if you want to get mass over charge values for double charged ions only. Otherwise single charged ions will be generated. If the given series doesn't allow double charged ions then an empty list will be returned and err will reflect the inconsistency.
minMassminimal possible mass value to return.
maxMassmaximal possible mass value to return.
massTypeSpecify matrix_science::MASS_TYPE_MONO or matrix_science::MASS_TYPE_AVE.
fragmentsa vector of items with more detailed information about each peptide fragment. Any existing items in the fragment vector will be overwritten by this function.
errerror object that accumulates messages without affecting the object validity.
fragNlType(optional) Either ms_aahelper::FRAG_NL_PRIMARY or ms_aahelper::FRAG_NL_SECONDARY. Default is FRAG_NL_PRIMARY.
Returns
A vector of ions masses. Use of the return value is deprecated.

◆ calcFragmentsEx() [1/2]

bool calcFragmentsEx ( const ms_peptide peptide,
const int  seriesID,
const int  fragCharge,
const double  minMass,
const double  maxMass,
const MASS_TYPE  massType,
ms_fragmentvector fragments,
ms_errs err,
const FRAG_NL  fragNlType = FRAG_NL_PRIMARY 
) const

Returns a vector of ion masses for the given series and peptide.

The difference to calcFragments() is that you can specify explicitly what charge state should all the generated fragments be. The charge state of the peptide-object is ignored then completely. When you need to obtain fragment m/z values for several different charge states just call this method several times and merge the results. For 'regular' sequence type ions, the final fragment mass (approximately the peptide mass less the terminus) will not be returned.

Note that this method does not take the peptide object's seriesUsedStr into account (see ms_peptide::getSeriesUsedStr()). The rules in Mascot state that fragments for neutral loss series (A_MINUS_NH3, A_MINUS_H2O, and corresponding series for B and Y) should only be generated if the peptide match has a statistically significant number of matches to the corresponding singly charged parent ion series (e.g. A_MINUS_NH3 requires enough matches to singly charged A series fragments). You can take this into account by testing whether seriesUsedStr contains 1 or 2 for the singly charged parent ion series. See ms_peptide::getSeriesUsedStr().

Parameters
peptidepeptide object to generate ion masses for.
seriesIDseries number from: ms_fragmentationrules::FRAG_SERIES_TYPE.
fragChargeexplicit charge state of the fragments being generated (peptide charge is ignored), zero value for this parameter means "Mr".
minMassminimal possible mass value to return.
maxMassmaximal possible mass value to return.
massTypeSpecify matrix_science::MASS_TYPE_MONO or matrix_science::MASS_TYPE_AVE.
fragmentsa vector of items with more detailed information about each peptide fragment. Any items in the fragment vector are overwritten by this function.
errerror object that accumulates messages without affecting the object validity.
fragNlType(optional) Either ms_aahelper::FRAG_NL_PRIMARY or ms_aahelper::FRAG_NL_SECONDARY. Default is FRAG_NL_PRIMARY.
Returns
TRUE if succeeded, FALSE if there are any errors.
Examples
tools_aahelper.cpp.

◆ calcFragmentsEx() [2/2]

bool calcFragmentsEx ( const ms_peptide peptide,
const int  seriesID,
const int  fragCharge,
const double  minMass,
const double  maxMass,
const MASS_TYPE  massType,
std::vector< ms_fragment > *  fragments,
ms_errs err,
const FRAG_NL  fragNlType = FRAG_NL_PRIMARY 
) const

Returns a vector of ion masses for the given series and peptide.

Note
This method can only be used in C++. Use the other calcFragmentsEx() method from other programming languages.

The difference to calcFragments() is that you can specify explicitly what charge state should all the generated fragments be. The charge state of the peptide-object is ignored then completely. When you need to obtain fragment m/z values for several different charge states just call this method several times and merge the results. For 'regular' sequence type ions, the final fragment mass (approximately the peptide mass less the terminus) will not be returned.

Note that this method does not take the peptide object's seriesUsedStr into account (see ms_peptide::getSeriesUsedStr()). The rules in Mascot state that fragments for neutral loss series (A_MINUS_NH3, A_MINUS_H2O, and corresponding series for B and Y) should only be generated if the peptide match has a statistically significant number of matches to the corresponding singly charged parent ion series (e.g. A_MINUS_NH3 requires enough matches to singly charged A series fragments). You can take this into account by testing whether seriesUsedStr contains 1 or 2 for the singly charged parent ion series. See ms_peptide::getSeriesUsedStr().

Parameters
peptidepeptide object to generate ion masses for.
seriesIDseries number from: ms_fragmentationrules::FRAG_SERIES_TYPE.
fragChargeexplicit charge state of the fragments being generated (peptide charge is ignored), zero value for this parameter means "Mr".
minMassminimal possible mass value to return.
maxMassmaximal possible mass value to return.
massTypeSpecify matrix_science::MASS_TYPE_MONO or matrix_science::MASS_TYPE_AVE.
fragmentsa vector of items with more detailed information about each peptide fragment. Any items in the fragment vector are overwritten by this function.
errerror object that accumulates messages without affecting the object validity.
fragNlType(optional) Either ms_aahelper::FRAG_NL_PRIMARY or ms_aahelper::FRAG_NL_SECONDARY. Default is FRAG_NL_PRIMARY.
Returns
TRUE if succeeded, FALSE if there are any errors.

◆ calcPeptideMZ()

double calcPeptideMZ ( const char *  proteinStr,
const int  proteinLen,
const int  startPos,
const int  endPos,
const std::vector< int >  numThatMustBeModded,
const int  charge,
const MASS_TYPE  massType,
ms_errs err 
) const

Calculates and returns a peptide m/z (or Mr) value without specifying exact positions of modified residues.

This method can be called when only minimal (e.g. PMF search) information is available:

  • Terminus positions.
  • Fixed mods.
  • Number of modified residues , but not modified positions.

Before calling this function, call setAvailableModifications() to set up any modifications.

This function does not currently support Multiple modifications for the same site

numThatMustBeModded is a vector of integers. Each element of the vector corresponds to a variable modification. The first element corresponds to the first variable modification pushed onto the vector. So, pushing three values, 3,0,2 onto the vector would specify that 3 residues are modified by the first variable mod, and 2 residues are modified by the third variable mod. The size of this vector can be less than the number of available variable modifications - missing elements are assumed to be zeros.

The err object should be checked after calling this function to see if there are inconsistencies.

Parameters
proteinStra protein sequence string. C++: it does not need to be null terminated.
proteinLenprotein sequence length.
startPosthe first peptide position. Specify 1 for the peptide to start at the first amino acid.
endPosthe last peptide position. For example, startPos=1 and endPos=3 would give a peptide 3 residues long.
numThatMustBeModdedis a vector of integers. See above, and also Using STL vector classes vectori, vectord and VectorString in Perl, Java, Python and C#.
charge0 for de-charged mass, n for n-charged peptides.
massTypeshould be matrix_science::MASS_TYPE_MONO or matrix_science::MASS_TYPE_AVE.
errerror object that accumulates messages without affecting the object validity
Returns
The peptide m/z. If the charge specified was zero, then the relative mass (Mr) value will be returned.
Examples
tools_aahelper.cpp.

◆ clearAllErrors()

void clearAllErrors ( )
inherited

Remove all errors from the current list of errors.

The list of 'errors' can include fatal errors, warning messages, information messages and different levels of debugging messages.

All messages are accumulated into a list in this object, until clearAllErrors() is called.

See Error Handling.

See also
isValid(), getLastError(), getLastErrorString(), getErrorHandler()
Examples
common_error.cpp, resfile_error.cpp, and resfile_summary.cpp.

◆ copyFrom()

void copyFrom ( const ms_errors right)
inherited

Use this member to make a copy of another instance.

Parameters
rightis the source to initialise from

◆ createCrosslinkedPeptide()

ms_peptide createCrosslinkedPeptide ( const ms_peptide pepAlpha,
const ms_peptide pepBeta,
const ms_linker_site_vector linkedSites,
ms_errs err 
) const

Creates and returns a crosslinked peptide object.

The following conditions are checked. If any one is not satisfied, the method sets a corresponding error and returns an "empty" ms_peptide object.

  • pepAlpha must be a valid linear peptide (not crosslinked).
  • pepBeta must be a valid linear peptide (not crosslinked).
  • pepAlpha must not have a variable modification at the linker site.
  • pepBeta must not have a variable modification at the linker site.
  • linkedSites must contain exactly 1 element.
  • The linker site in alpha must be within the range 0..n, where n is the length of alpha's variable mods string.
  • The linker site in beta must be within the range 0..m, where m is the length of beta's variable mods string.

Standard terminology recommends that alpha should be the longer or heavier molecule than beta, but there is no check for this.

Linker mass can be positive, zero or negative, although typically it is positive.

Parameters
pepAlphais the alpha peptide.
pepBetais the beta peptide.
linkedSitesis the vector of links between alpha and beta.
erris an error object that accumulates messages without affecting the object validity.
Returns
a crosslinked alpha-beta peptide.

◆ createPeptide() [1/2]

ms_peptide createPeptide ( const char *  proteinStr,
const int  proteinLen,
const int  startPos,
const int  endPos,
const std::vector< int >  varMods,
const std::vector< int >  varModsWhichNl,
const int  charge,
const MASS_TYPE  massType,
ms_errs err 
) const

Creates and returns a peptide object.

This method can be called if full peptide information is available. It creates and returns a peptide object instance that can then be passed to the calcFragments() method. Only available modifications will be applied

varMods is a vector of integers. It has the same content as modification strings in result files. The first element specifies how N-terminus of the peptide is modified. The next one corresponds to the first residue in the peptide etc. The last element refers to the C-terminus. Each element contain either '0' for non-modified positions or a variable modification number to apply. The size of this vector can also be less than (peptide length + 2) – missing elements are assumed to be zeros.

varModsWhichNl is also a vector of integers. There is one entry in the vector for each terminus and each residue. For a residue not modified by a modification with neutral loss(es), the value should be zero. For a site modified by a modification with neutral loss(es), a one-based index of neutral loss value to use for this peptide should be supplied. If a value of 0 is specified for a modification with a neutral loss, then the first neutral loss is assumed.

The err object should be checked after calling this function to see if there are inconsistencies.

See also
getVarMods(), setAvailableModifications()
Parameters
proteinStra protein sequence string. C++: it does not need to be null-terminated.
proteinLenprotein sequence length .
startPosthe first peptide position. Specify 1 for the peptide to start at the first amino acid.
endPosthe last peptide position. For example, startPos=1 and endPos=3 would give a peptide 3 residues long.
varModsis a vector of modified positions. See above and also Using STL vector classes vectori, vectord and VectorString in Perl, Java, Python and C#.
varModsWhichNlis a similar vector to varMods. See above and also Using STL vector classes vectori, vectord and VectorString in Perl, Java, Python and C#.
chargecharge state of the peptide.
massTypeshould be matrix_science::MASS_TYPE_MONO or matrix_science::MASS_TYPE_AVE.
errerror object that accumulates messages without affecting the object validity
Returns
An ms_peptide object that can be used with calcFragments().
Examples
tools_aahelper.cpp.

◆ createPeptide() [2/2]

ms_peptide createPeptide ( const char *  proteinStr,
const int  proteinLen,
const int  startPos,
const int  endPos,
const std::vector< int >  varMods,
const std::vector< int >  varModsWhichNl,
const std::vector< int >  summedMods,
const std::vector< int >  summedModsWhichNl,
const int  charge,
const MASS_TYPE  massType,
ms_errs err 
) const

Creates and returns a peptide object.

This method can be called if full peptide information is available. It creates and returns a peptide object instance that can then be passed to the calcFragments() method. Only available modifications will be applied

varMods is a vector of integers. It has the same content as modification strings in result files. The first element specifies how N-terminus of the peptide is modified. The next one corresponds to the first residue in the peptide etc. The last element refers to the C-terminus. Each element contain either '0' for non-modified positions or a variable modification number to apply. The size of this vector can also be less than (peptide length + 2) – missing elements are assumed to be zeros.

varModsWhichNl is also a vector of integers. There is one entry in the vector for each terminus and each residue. For a residue not modified by a modification with neutral loss(es), the value should be zero. For a site modified by a modification with neutral loss(es), a one-based index of neutral loss value to use for this peptide should be supplied. If a value of 0 is specified for a modification with a neutral loss, then the first neutral loss is assumed.

summedMods and summedModsWhichNl are identical to varMods and varModsWhichNl except that they apply to Multiple modifications for the same site

The err object should be checked after calling this function to see if there are inconsistencies.

See also
getVarMods(), setAvailableModifications()
Parameters
proteinStra protein sequence string. C++: it does not need to be null-terminated.
proteinLenprotein sequence length .
startPosthe first peptide position. Specify 1 for the peptide to start at the first amino acid.
endPosthe last peptide position. For example, startPos=1 and endPos=3 would give a peptide 3 residues long.
varModsis a vector of modified positions. See above and also Using STL vector classes vectori, vectord and VectorString in Perl, Java, Python and C#.
varModsWhichNlis a similar vector to varMods. See above and also Using STL vector classes vectori, vectord and VectorString in Perl, Java, Python and C#.
summedModsis a vector of modified positions. See above and also Using STL vector classes vectori, vectord and VectorString in Perl, Java, Python and C#.
summedModsWhichNlis a similar vector to varMods. See above and also Using STL vector classes vectori, vectord and VectorString in Perl, Java, Python and C#.
chargecharge state of the peptide.
massTypeshould be matrix_science::MASS_TYPE_MONO or matrix_science::MASS_TYPE_AVE.
errerror object that accumulates messages without affecting the object validity
Returns
An ms_peptide object that can be used with calcFragments().

◆ getErrorHandler()

const ms_errs * getErrorHandler ( ) const
inherited

Retrive the error object using this function to get access to all errors and error parameters.

See Error Handling.

Returns
Constant pointer to the error handler
See also
isValid(), getLastError(), getLastErrorString(), clearAllErrors(), getErrorHandler()
Examples
common_error.cpp, and http_helper_getstring.cpp.

◆ getFixedMods()

ms_modvector getFixedMods ( ) const

Returns a list of fixed modifications that have been successfully applied i.e. don't have conflicts.

Every member of the vector returned is a non-empty modification object. All conflicting modifications have been rejected.

Returns
Vector of the fixed modifications

◆ getLastError()

int getLastError ( ) const
inherited

Return the error description of the last error that occurred.

All errors are accumulated into a list in this object, until clearAllErrors() is called. This function returns the last error that occurred.

See Error Handling.

See also
isValid(), getLastErrorString(), clearAllErrors(), getErrorHandler()
Returns
the error number of the last error, or 0 if there have been no errors.

◆ getLastErrorString()

std::string getLastErrorString ( ) const
inherited

Return the error description of the last error that occurred.

All errors are accumulated into a list in this object, until clearAllErrors() is called. This function returns the last error that occurred.

Returns
Most recent error, warning, information or debug message

See Error Handling.

See also
isValid(), getLastError(), clearAllErrors(), getErrorHandler()
Examples
common_error.cpp, config_enzymes.cpp, config_fragrules.cpp, config_license.cpp, config_mascotdat.cpp, config_masses.cpp, config_modfile.cpp, config_procs.cpp, config_quantitation.cpp, config_taxonomy.cpp, http_helper_getstring.cpp, and tools_aahelper.cpp.

◆ getMissed()

int getMissed ( ) const

Returns number of missed cleavage sites for the current peptide.

This will return 0 if getNextPeptide() returned false or if stopIteratePeptides() has been called.

Returns
Number of missed cleavages in the current peptide

◆ getNextPeptide()

bool getNextPeptide ( )

Call to iterate to the next peptide.

Finds a new unique peptide. Call getPepStart() and getPepEnd() to get the new peptide start and end positions.

Returns
TRUE if successful and FALSE otherwise (e.g. when no more peptides are available).
Examples
tools_aahelper.cpp.

◆ getPepEnd()

int getPepEnd ( ) const

Returns the last position of the current peptide.

This will return -1 if getNextPeptide() returned false or if stopIteratePeptides() has been called.

Returns
Last position of the current peptide
Examples
tools_aahelper.cpp.

◆ getPepStart()

int getPepStart ( ) const

Returns the first position of the current peptide.

This will return -1 if getNextPeptide() returned false or if stopIteratePeptides() has been called.

Returns
First position of the current peptide
Examples
tools_aahelper.cpp.

◆ getVarMods()

ms_modvector getVarMods ( ) const

Returns a list of variable modifications that have no conflicts with fixed modifications.

The vector returned contains null pointers in place of conflicting modifications. The reason for that is to keep the original order of modifications.

Returns
Vector of the variable modifications

◆ isValid()

bool isValid ( ) const
inherited

◆ setAvailableModifications()

void setAvailableModifications ( const ms_modvector fixedModVector,
const ms_modvector varModVector 
)

Applies fixed modifications to residue masses and stores variable modifications for later use.

The object should be checked for validity after calling this method.

No checking for overlapping modifications is performed.

It is important to remember the order of modifications submitted here as all future calcPeptideMZ(), createPeptide() and calcFragments() method calls will refer to this original order. The modifications are numbered from 1 to n.

There is no need to call this function if an ms_mascotresfilebase object is passed to the relevant ms_aahelper constructor. When that constructor is called, the mapping of the numbers is exactly as in the deltaX lines of the masses section in the results file. To retrieve the relevant names, use ms_searchparams::getVarModsName() with num=X. The numbers in the strings returned from ms_peptide::getVarModsStr() then correspond to the modification numbers supplied to this function.

If a fixed modification and a variable modification are applied to the same residue or terminus, then the fixed modification is substituted with the variable modification.

Parameters
fixedModVectorA valid pointer to a vector of fixed modifications
varModVectorA valid pointer to a vector of variable modifications
See also
getFixedMods(), getVarMods()
Examples
tools_aahelper.cpp.

◆ setMasses()

void setMasses ( const ms_masses masses)

Copies all residue and chemical element masses from the masses file instance.

An ms_umod_configfile object can also be used as a source of masses. In that case call the corresponding method ms_masses::copyFrom() and supply an ms_umod_configfile instance as a parameter.

Parameters
massesA valid pointer to an ms_masses object
Examples
tools_aahelper.cpp.

◆ startIteratePeptides()

void startIteratePeptides ( const char *  sequenceProtein,
const int  sizeProtein,
const int  pfa 
)

Initialises internal members in preparation for generating peptides.

The first peptide ends are not available after calling this method. You have to call getNextPeptide() and check its returned value before calling getPepStart(), getPepEnd(), getMissed().

Parameters
sequenceProteinprotein sequence string (not null-terminated)
sizeProteinlength of the protein string
pfamaximal number of missed cleavages
Examples
tools_aahelper.cpp.

◆ stopIteratePeptides()

void stopIteratePeptides ( )

Stop iterating.

Call this method after you have finished retrieving peptides. All calls to getPepStart(), getPepEnd() will return -1 as invalid peptide ends, and getNextPeptide() will return only FALSE until the iteration mechanism is re-initiated with startIteratePeptides().


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