Matrix Science header
Public Member Functions | Static Public Member Functions

ms_spectral_lib_peak Class Reference
[Mascot utilities and tools module]

This class is used to encapsulate a single fragment ion in a NIST .msp or a SpectraST .sptxt file. More...

#include <ms_spectral_lib_peak.hpp>

Inheritance diagram for ms_spectral_lib_peak:
Inheritance graph
[legend]
Collaboration diagram for ms_spectral_lib_peak:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ms_spectral_lib_peak (const std::string &text, ms_spectral_lib::FILE_FORMAT format)
 Preferred constructor.
 ms_spectral_lib_peak (const double mz, const double intensity, const std::string &annotation, ms_spectral_lib::FILE_FORMAT format)
 Constructor.
 ms_spectral_lib_peak (const ms_spectral_lib_peak &src)
 Copying constructor.
void appendErrors (const ms_errors &src)
 Copies all errors from another instance and appends them at the end of own list.
std::string asText (ms_spectral_lib::FILE_FORMAT format) const
 Returns a 'line' with the peak m/z, intensity and annotation as text.
void clearAllErrors ()
 Remove all errors from the current list of errors.
void clearAnnotation ()
 Clear any annotation for the peak.
void copyFrom (const ms_spectral_lib_peak *right)
 Use this member to make a copy of another instance.
void copyFrom (const ms_errors *right)
 Use this member to make a copy of another instance.
std::string getAnnotation (ms_spectral_lib::FILE_FORMAT format=ms_spectral_lib::FORMAT_NIST_MSP) const
 Return annotations for the peak.
bool getConsensusData (int *numerator, int *denominator, double *medianDeviation) const
 For experamental data taken from a number of spectra, some statistics are available.
double getDelta () const
 Return the difference between the calculated and experimental value for the peak.
const ms_errsgetErrorHandler () const
 Retrive the error object using this function to get access to all errors and error parameters.
double getIntensity () const
 Return the intensity for the peak.
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.
double getMz () const
 Return the mass over charge value for the peak.
bool isMatchedToCalculatedPeak () const
 Some peaks appear in spectra, but are no matching expected fragment is found.
bool isSuspectAssignment () const
 Returns true if the assignment to a calculated peak is not uncertain.
bool isValid () const
 Call this function to determine if there have been any errors.
ms_spectral_lib_peakoperator= (const ms_spectral_lib_peak &right)
 C++ style assignment operator.
void setAnnotation (const std::string &annotation, ms_spectral_lib::FILE_FORMAT format)
 Set annotations for the peak.

Static Public Member Functions

static std::string getUnmatchedAnnotationStr (ms_spectral_lib::FILE_FORMAT format)
 Static function to return the string used to indicate that a peak wasn't matched when the library entry was generated.

Detailed Description

This class is used to encapsulate a single fragment ion in a NIST .msp or a SpectraST .sptxt file.


Constructor & Destructor Documentation

ms_spectral_lib_peak ( const std::string &  text,
ms_spectral_lib::FILE_FORMAT  format 
)

Preferred constructor.

The advantage of using this constructor is that when asText() is called, the returned line will contain m/z and intensity with exactly the same number of decimal places.

Each peak is represented as a line divided into three tab separated fields:

 [m/z][tab][relative abundance][tab]"[peak annotation(s)]" 

Tabs or spaces are suitable separators.

If the m/z and intensity cannot be read, then isValid() will return false.

Parameters:
textis the input line in the above format
formatis one of the ms_spectral_lib::FILE_FORMAT values.
ms_spectral_lib_peak ( const double  mz,
const double  intensity,
const std::string &  annotation,
ms_spectral_lib::FILE_FORMAT  format 
)

Constructor.

An ms_spectral_lib_peak object is normally created by calling ms_spectral_lib_peak_list::getPeak()

Parameters:
mzis the fragment m/z value
intensityis the fragment intensity
annotationis the fragment annotation. See getAnnotation() for details.
formatis one of the ms_spectral_lib::FILE_FORMAT values. It format is ms_spectral_lib::FORMAT_NIST_MSP then annotation should be in quotes.

Copying constructor.

Parameters:
srcis the source to initialise from

Member Function Documentation

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.
std::string asText ( ms_spectral_lib::FILE_FORMAT  format ) const

Returns a 'line' with the peak m/z, intensity and annotation as text.

For ms_spectral_lib::FORMAT_MGF and ms_spectral_lib::FORMAT_XHUNTER there will be no annotation text.

See also:
getAnnotation()
Parameters:
formatis one of the ms_spectral_lib::FILE_FORMAT formats
Returns:
the line of text
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.
void clearAnnotation (  )

Clear any annotation for the peak.

Does not change the file format associated with the peak

void copyFrom ( const ms_spectral_lib_peak right )

Use this member to make a copy of another instance.

Parameters:
rightis the source to initialise from
void copyFrom ( const ms_errors right ) [inherited]

Use this member to make a copy of another instance.

Parameters:
rightis the source to initialise from
std::string getAnnotation ( ms_spectral_lib::FILE_FORMAT  format = ms_spectral_lib::FORMAT_NIST_MSP ) const

Return annotations for the peak.

This function can, in theory, return the annotation data in any available format. However, there is a current limitation that it will only return in the format that it was saved in. Specifically, it cannot convert between ms_spectral_lib::FORMAT_NIST_MSP and ms_spectral_lib::FORMAT_SPECTRAST

The ms_spectral_lib::FORMAT_NIST_MSP format includes double quotes round the returned string

NIST MSP Format

Examples:

  "b2i/1.03 12/21 0.1"
  "b2/0.03,b4-44^2/0.03 21/21 1.3"
  "p-46/-0.12 60/100 4.0"
  "? 31/61 0.4"
  "Int/AC/0.1 11/12 0.2"
 

The first character(s) denote the type, and will be one of the following:

  • y or b or a are the ion types. These are followeded by a number denoting the position in the peptide.
  • p is used to denote the peak is a precursor peak.
  • ? is used to denote that the mass cannot be assigned to a known fragment type.
  • Int is used to denote internal ions. In this case, the sequence is denoted by /SEQ
  • I is used to denote immonium ions. This is followed by XY where 'X' is the parent amino acid and Y are letters A,B,C.. used to distinguish different immonium products of the amino acid X.

Following the first character, and before the '/' there are additional options:

  • A neutral loss is indicated by a '-' followed by the loss. For example: y6-18 specifies loss of water on y ion at residue 6.
  • 13C peaks are denoted with a following i
  • A * is appended if the peak assignment is suspect
  • ^c denotes a charge > 1, where c is the charge

There is then a / followed by the difference between measured m/z and theoretical (exact) m/z. For unknown fragments, there is obviously no delta.

If a second assignment is possible, a second, comma-separated full assignment is given as in an example above.

For consensus spectra, a space follows the assignment(s), after which is given the number of replicate spectra having that peak and the minimum number of spectra required for that peak to have been reported � these numbers are separated by a �/�. A space follows, after which the median deviation of m/z (in 1/100th of an m/z) of the peaks in the original spectra used to create that peak.

SpectraST format

Examples:

 b5/-0.07
 y9-17^2/-0.08,y9-18^2/0.41
 [y26^3/-0.1236]
 

Described here as:

SpectraST's syntax to annotate a fragment follows the scheme proposed by Roepstorff and Fohlman.

An annotation tag starts with the assigned ion type (a,b,c,x,y or z) and is followed by the number of amino acid residues present in the fragment. This number is possibly followed by a signed integer value, indicating a modification. Please note that besides post-translational modifications also loss of water (-18) and loss of ammonia (-17), e.g., are taken into account. The caret symbol '^' followed by an integer value depicts the charge state of the fragment. Its absence indicates a singly charged fragment ion. An additional 'i' at the end of the annotation tag implies that the mass value does not correspond to the expected mass value of the monoisotopic peak, but can be assigned to a different isotopic peak of the fragment. Finally, the annotation pattern contains the average mass deviation (in Da) from the theoretically expected mass. A slash '/' preceds this number.

The list of possible annotations is ordered by ascending charge states, where ties are broken by ascending mass deviations.

Annotation tags can be enclosed by square brackets, indicating that several peaks could be assigned the same particular ion. Usually, SpectraST would resolve such a situation by annotating only one of the ions and leaving the other ones blank. If data is not (sufficiently) centroided, this strategy might lead to a buch of unresolved peaks, which might in turn cause quality filters to fail. To circumvent this problem, if there are additional intense peaks that look to be the same ion, a bracketed annotation will be given to them.

Besides annotations following the Roepstorff/Fohlman notation SpectraST also assigns immonium ions. The corresponding tag consists of 3 capital letters, always starting with an 'I' (for immonium), followed by the amino acid and an additional letter to designate different residue-specific ions from that amino acid.

ms_spectral_lib::FORMAT_MGF and ms_spectral_lib::FORMAT_XHUNTER

This will return an empty string.

Parameters:
formatis one of the ms_spectral_lib::FILE_FORMAT formats
Returns:
annotation
double getDelta (  ) const

Return the difference between the calculated and experimental value for the peak.

If isMatchedToCalculatedPeak() returns false, then the returned value will be -999.0 as there can be no calculated delta. In other cases, no delta is provided in the file, for example:

 1022.3 [tab] 340 [tab] "Int-18/AFTECCQAAD/ 46/53 1.7" 

and -999 is also returned in this case.

Returns:
the delta in m/z
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.
double getIntensity (  ) const

Return the intensity for the peak.

Returns:
the intensity of the the peak
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.

Reimplemented in ms_mascotresfile.

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()

Reimplemented in ms_mascotresfile.

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.
double getMz (  ) const

Return the mass over charge value for the peak.

Returns:
the mass over charge value for the peak
std::string getUnmatchedAnnotationStr ( ms_spectral_lib::FILE_FORMAT  format ) [static]

Static function to return the string used to indicate that a peak wasn't matched when the library entry was generated.

For ms_spectral_lib::FORMAT_NIST_MSP this returns "?" (quotes are included)

Parameters:
formatis one of the ms_spectral_lib::FILE_FORMAT values.
Returns:
"?" for ms_spectral_lib::FORMAT_NIST_MSP and ? for ms_spectral_lib::FORMAT_SPECTRAST
bool isMatchedToCalculatedPeak (  ) const

Some peaks appear in spectra, but are no matching expected fragment is found.

If a peak was matched to a calculated fragment, then this will return true. If the string returned from getAnnotation() is empty or contains a '?' then no match was found, and this function will return false.

Returns:
true if the peak matched to a calculated match.
bool isSuspectAssignment (  ) const

Returns true if the assignment to a calculated peak is not uncertain.

Returns true if the annotation contains a '*' or if there is no annotation. The NIST documentation is not entirely clear on the meaning of this flag, since a ? may or may not be followed by a '*'

Returns:
true if annotation is not empty and contains *, false otherwise
bool isValid (  ) const [inherited]

Call this function to determine if there have been any errors.

This will return true unless there have been any fatal errors.

See Error Handling.

Returns:
True is no fatal error occured
See also:
getLastError(), getLastErrorString(), 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, peptide_list.cpp, resfile_summary.cpp, and tools_aahelper.cpp.
ms_spectral_lib_peak & operator= ( const ms_spectral_lib_peak right )

C++ style assignment operator.

Parameters:
rightis the source to initialise from
Returns:
reference to the current object
void setAnnotation ( const std::string &  annotation,
ms_spectral_lib::FILE_FORMAT  format 
)

Set annotations for the peak.

For ms_spectral_lib::FORMAT_NIST_MSP the annotation string should include the double quotes

Parameters:
annotationannotation to set
formatis the ms_spectral_lib::FILE_FORMAT

The documentation for this class was generated from the following files:
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:54