16#include <OpenMS/OpenMSConfig.h>
171 bool empty()
const {
return annotations.empty(); }
174 size_t size()
const {
return annotations.size(); }
224 const char* function,
226 size_t error_position,
227 const std::string& input,
228 const std::string& message
313 static std::optional<MzPAFAnnotation>
tryParse(
const std::string& input);
Definition AASequence.h:96
Parse Error exception.
Definition Exception.h:596
Parse error for mzPAF notation.
Definition MzPAF.h:219
std::string context_before_
Definition MzPAF.h:238
MzPAFErrorCode getErrorCode() const noexcept
Definition MzPAF.h:231
size_t position_
Definition MzPAF.h:237
size_t getPosition() const noexcept
Definition MzPAF.h:232
void extractContext_(const std::string &input, size_t pos)
std::string getFormattedMessage() const
std::string context_after_
Definition MzPAF.h:239
MzPAFErrorCode code_
Definition MzPAF.h:236
MzPAFParseError(const char *file, int line, const char *function, MzPAFErrorCode error_code, size_t error_position, const std::string &input, const std::string &message) noexcept
Parser and writer for mzPAF (Peak Annotation Format) notation.
Definition MzPAF.h:280
static std::optional< MzPAFAnnotation > tryParse(const std::string &input)
Try to parse an mzPAF string (non-throwing)
static std::string toString(const MzPAFPeakAnnotations &anns)
Convert multiple annotations to mzPAF string.
static bool charToIonSeries(char c, MzPAFIonSeries &series)
Parse ion series from character.
static MzPAFAnnotation parse(const std::string &input)
Parse an mzPAF string into a single annotation.
static PeptideHit::PeakAnnotation toPeakAnnotation(const MzPAFAnnotation &mzpaf, double mz, double intensity)
Create a PeptideHit::PeakAnnotation from mzPAF data.
static std::optional< double > calculateTheoreticalMZ(const MzPAFAnnotation &ann, const AASequence &sequence)
Calculate theoretical m/z for an annotation.
static MzPAFPeakAnnotations parseMultiple(const std::string &input)
Parse an mzPAF string with potentially multiple annotations.
static MzPAFPeakAnnotations fromPeakAnnotation(const PeptideHit::PeakAnnotation &peak_annotation)
Parse mzPAF annotations from a PeptideHit::PeakAnnotation.
static std::optional< MzPAFPeakAnnotations > tryParseMultiple(const std::string &input)
Try to parse multiple annotations (non-throwing)
static bool isMzPAFFormat(const std::string &annotation)
Check if a string appears to be in mzPAF format.
static bool isPeptideFragmentIon(MzPAFIonSeries series)
Check if ion series is a peptide fragment ion (a, b, c, d, v, w, x, y, z)
static char ionSeriesToChar(MzPAFIonSeries series)
Get the ion series character for an annotation.
static std::string toString(const MzPAFAnnotation &ann)
Convert an annotation to mzPAF string.
MzPAFIonSeries
Ion series types for mzPAF peak annotations.
Definition MzPAF.h:38
MzPAFErrorCode
Error codes for mzPAF parsing errors.
Definition MzPAF.h:191
MzPAFDeltaUnit
Unit for mass delta values in mzPAF annotations.
Definition MzPAF.h:66
@ C
c-ion (N-terminal, ETD)
@ INTERNAL
Internal fragment (m)
@ Z
z-ion (C-terminal, ETD)
@ V
v-ion (C-terminal satellite ion, complete side-chain loss)
@ W
w-ion (C-terminal satellite ion, partial side-chain loss)
@ UNKNOWN
Unknown or unrecognized ion type.
@ NAMED
Named compound (_)
@ A
a-ion (N-terminal, loses CO)
@ REPORTER
Reporter ion (r)
@ IMMONIUM
Immonium ion (I)
@ FORMULA
Chemical formula ion (f)
@ PRECURSOR
Precursor ion (p)
@ D
d-ion (N-terminal satellite ion, partial side-chain loss)
@ INVALID_NUMBER
Invalid numeric value.
@ UNEXPECTED_CHARACTER
Unexpected character encountered.
@ EMPTY_INPUT
Empty input string.
@ INVALID_ION_SERIES
Invalid ion series character.
@ INVALID_CONFIDENCE
Invalid confidence score.
@ UNEXPECTED_END_OF_INPUT
Unexpected end of input.
@ INVALID_DELTA
Invalid mass delta specification.
@ UNCLOSED_BRACKET
Opening bracket without matching close.
@ INTERNAL_ERROR
Internal parser error.
@ INVALID_CHARGE
Invalid charge specification.
@ INVALID_FORMULA
Invalid chemical formula.
@ DALTON
Mass delta in Daltons (Da)
@ PPM
Mass delta in parts per million.
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)
const char * mzPAFErrorCodeToString(MzPAFErrorCode code)
Convert error code to human-readable string.
A single mzPAF peak annotation.
Definition MzPAF.h:129
std::optional< std::string > named_compound
Name for named compound ions (_[name])
Definition MzPAF.h:137
std::optional< std::string > reporter_name
Name for reporter ions (r[TMT127N])
Definition MzPAF.h:135
std::optional< char > immonium_residue
Residue for immonium ions (Y in IY)
Definition MzPAF.h:133
bool isValid() const
Check if this annotation has minimal valid data.
std::vector< MzPAFNeutralLoss > neutral_losses
Neutral losses (-H2O, -NH3, etc.)
Definition MzPAF.h:138
std::optional< int > charge
Charge state (^2, ^3)
Definition MzPAF.h:141
std::optional< char > satellite_subtype
Optional 'a' or 'b' subtype, valid only for d- and w-ions.
Definition MzPAF.h:145
std::optional< double > confidence
Confidence score (*0.75)
Definition MzPAF.h:143
std::optional< MzPAFMassDelta > mass_delta
Mass delta (/0.001, /-1.4ppm)
Definition MzPAF.h:142
std::optional< int > ordinal
Position/ordinal (4 in y4)
Definition MzPAF.h:132
bool operator!=(const MzPAFAnnotation &other) const
Definition MzPAF.h:152
std::optional< EmpiricalFormula > formula
Chemical formula for formula ions (f{C16H22O})
Definition MzPAF.h:136
std::optional< int > analyte_index
Analyte index (0@, 1@, etc.) for multi-analyte spectra.
Definition MzPAF.h:130
std::optional< EmpiricalFormula > adduct
Adduct ion (+Na, +K, etc.)
Definition MzPAF.h:140
std::optional< std::string > embedded_sequence
Embedded ProForma sequence string ({LC[Carbamidomethyl]})
Definition MzPAF.h:144
std::optional< std::pair< int, int > > internal_range
Range for internal fragments (m3:6 -> {3,6})
Definition MzPAF.h:134
std::optional< int > isotope_offset
Isotope offset (+1i, +2i for M+1, M+2)
Definition MzPAF.h:139
bool operator==(const MzPAFAnnotation &other) const
Equality comparison.
Mass delta in an mzPAF annotation.
Definition MzPAF.h:95
bool operator!=(const MzPAFMassDelta &other) const
Definition MzPAF.h:100
bool operator==(const MzPAFMassDelta &other) const
Neutral loss in an mzPAF annotation.
Definition MzPAF.h:79
bool operator==(const MzPAFNeutralLoss &other) const
bool operator!=(const MzPAFNeutralLoss &other) const
Definition MzPAF.h:83
EmpiricalFormula formula
Parsed chemical formula of the loss.
Definition MzPAF.h:80
Multiple mzPAF annotations for a single peak.
Definition MzPAF.h:167
size_t size() const
Get number of annotations.
Definition MzPAF.h:174
bool empty() const
Check if there are any annotations.
Definition MzPAF.h:171
std::vector< MzPAFAnnotation > annotations
List of alternative annotations.
Definition MzPAF.h:168
bool operator!=(const MzPAFPeakAnnotations &other) const
Definition MzPAF.h:178
bool operator==(const MzPAFPeakAnnotations &other) const
Equality comparison.
Contains annotations of a peak.
Definition PeptideHit.h:87