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

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>

Public Member Functions

 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.
 
 ms_spectral_lib_peak (const std::string &text, ms_spectral_lib::FILE_FORMAT format, matrix_science::ms_errs &errs)
 Preferred constructor.
 
std::string asText (ms_spectral_lib::FILE_FORMAT format) const
 Returns a 'line' with the peak m/z, intensity and annotation as text.
 
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.
 
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.
 
double getIntensity () const
 Return the intensity for the peak.
 
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
 Return true if the peak contains valid data.
 
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() [1/3]

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

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.
errsis used to add any error found if the text is not of the correct format

◆ ms_spectral_lib_peak() [2/3]

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.

◆ ms_spectral_lib_peak() [3/3]

Copying constructor.

Parameters
srcis the source to initialise from

Member Function Documentation

◆ asText()

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

◆ clearAnnotation()

void clearAnnotation ( )

Clear any annotation for the peak.

Does not change the file format associated with the peak

◆ copyFrom()

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

◆ getAnnotation()

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

◆ getDelta()

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

◆ getIntensity()

double getIntensity ( ) const

Return the intensity for the peak.

Returns
the intensity of the the peak

◆ getMz()

double getMz ( ) const

Return the mass over charge value for the peak.

Returns
the mass over charge value for the peak

◆ getUnmatchedAnnotationStr()

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

◆ isMatchedToCalculatedPeak()

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.

◆ isSuspectAssignment()

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

◆ isValid()

bool isValid ( ) const

Return true if the peak contains valid data.

Returns
false if the constructor taking a text string contains a string that cannot be parsed. Otherwise, it will return true;

◆ operator=()

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

◆ setAnnotation()

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: