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_peak & | operator= (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. | |
This class is used to encapsulate a single fragment ion in a NIST .msp or a SpectraST .sptxt file.
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:
Tabs or spaces are suitable separators.
If the m/z and intensity cannot be read, then isValid() will return false.
text | is the input line in the above format |
format | is one of the ms_spectral_lib::FILE_FORMAT values. |
errs | is used to add any error found if the text is not of the correct format |
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()
mz | is the fragment m/z value |
intensity | is the fragment intensity |
annotation | is the fragment annotation. See getAnnotation() for details. |
format | is 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 | ( | const ms_spectral_lib_peak & | src | ) |
Copying constructor.
src | is the source to initialise from |
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.
format | is one of the ms_spectral_lib::FILE_FORMAT formats |
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.
right | is 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:
Following the first character, and before the '/' there are additional options:
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.
format | is one of the ms_spectral_lib::FILE_FORMAT formats |
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:
and -999 is also returned in this case.
double getIntensity | ( | ) | const |
Return the intensity for the peak.
double getMz | ( | ) | const |
Return the mass over charge value for the peak.
|
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)
format | is one of the ms_spectral_lib::FILE_FORMAT values. |
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.
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 '*'
bool isValid | ( | ) | const |
Return true if the peak contains valid data.
ms_spectral_lib_peak & operator= | ( | const ms_spectral_lib_peak & | right | ) |
C++ style assignment operator.
right | is the source to initialise from |
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
annotation | annotation to set |
format | is the ms_spectral_lib::FILE_FORMAT |