Parser and writer for mzPAF (Peak Annotation Format) notation.
More...
#include <OpenMS/CHEMISTRY/MzPAF.h>
Parser and writer for mzPAF (Peak Annotation Format) notation.
mzPAF is the HUPO-PSI standard string notation for fragment ion peak annotations, used in mzSpecLib and other spectral library formats.
This class provides static methods for:
Usage example:
static MzPAFPeakAnnotations parseMultiple(const String &input)
Parse an mzPAF string with potentially multiple annotations.
static MzPAFAnnotation parse(const String &input)
Parse an mzPAF string into a single annotation.
static bool isMzPAFFormat(const String &annotation)
Check if a string appears to be in mzPAF format.
static String toString(const MzPAFAnnotation &ann)
Convert an annotation to mzPAF string.
A more convenient string class.
Definition String.h:34
A single mzPAF peak annotation.
Definition MzPAF.h:121
Multiple mzPAF annotations for a single peak.
Definition MzPAF.h:158
- See also
- MzPAFAnnotation, MzPAFPeakAnnotations
◆ MzPAF()
◆ calculateTheoreticalMZ()
Calculate theoretical m/z for an annotation.
Calculates the theoretical m/z value for the annotated ion based on the sequence.
- Parameters
-
| [in] | ann | The annotation |
| [in] | sequence | The peptide sequence |
- Returns
- Theoretical m/z, or std::nullopt if calculation not possible
◆ charToIonSeries()
Parse ion series from character.
- Parameters
-
| [in] | c | The character to parse |
| [out] | series | Output ion series if successful |
- Returns
- True if parsing successful
◆ fromPeakAnnotation()
Parse mzPAF annotations from a PeptideHit::PeakAnnotation.
Attempts to parse the annotation string from a PeakAnnotation as mzPAF.
- Parameters
-
| [in] | peak_annotation | The PeakAnnotation to parse |
- Returns
- Parsed mzPAF annotations, or empty if not valid mzPAF
◆ ionSeriesToChar()
Get the ion series character for an annotation.
- Parameters
-
| [in] | series | The ion series enum |
- Returns
- The character representation (a, b, c, x, y, z, p, I, m, r, f, _)
◆ isMzPAFFormat()
| static bool isMzPAFFormat |
( |
const String & |
annotation | ) |
|
|
static |
Check if a string appears to be in mzPAF format.
Performs a quick heuristic check to determine if a string looks like mzPAF notation.
- Parameters
-
| [in] | annotation | The string to check |
- Returns
- True if the string appears to be mzPAF format
◆ isStandardFragmentIon()
Check if ion series is a standard fragment ion (a, b, c, x, y, z)
- Parameters
-
| [in] | series | The ion series to check |
- Returns
- True if it's a standard fragment ion type
◆ parse()
Parse an mzPAF string into a single annotation.
- Parameters
-
| [in] | input | The mzPAF string to parse |
- Returns
- The parsed annotation
- Exceptions
-
- Note
- If the input contains multiple comma-separated annotations, only the first is returned. Use parseMultiple() for multi-annotation strings.
◆ parseMultiple()
Parse an mzPAF string with potentially multiple annotations.
- Parameters
-
| [in] | input | The mzPAF string to parse (may contain comma-separated annotations) |
- Returns
- All parsed annotations
- Exceptions
-
◆ toPeakAnnotation()
◆ toString() [1/2]
Convert an annotation to mzPAF string.
- Parameters
-
| [in] | ann | The annotation to convert |
- Returns
- The mzPAF string representation
◆ toString() [2/2]
Convert multiple annotations to mzPAF string.
- Parameters
-
| [in] | anns | The annotations to convert |
- Returns
- The mzPAF string representation (comma-separated)
◆ tryParse()
Try to parse an mzPAF string (non-throwing)
- Parameters
-
| [in] | input | The mzPAF string to parse |
- Returns
- The parsed annotation, or std::nullopt on failure
◆ tryParseMultiple()
Try to parse multiple annotations (non-throwing)
- Parameters
-
| [in] | input | The mzPAF string to parse |
- Returns
- The parsed annotations, or empty on failure