OpenMS
Loading...
Searching...
No Matches
AccurateMassSearchResult Class Reference

One small-molecule hit produced by AccurateMassSearchEngine. More...

#include <OpenMS/ANALYSIS/ID/AccurateMassSearchEngine.h>

Collaboration diagram for AccurateMassSearchResult:
[legend]

Public Member Functions

 AccurateMassSearchResult ()
 Default constructor; all numeric fields zero, strings and vectors empty.
 
 ~AccurateMassSearchResult ()
 Default destructor.
 
 AccurateMassSearchResult (const AccurateMassSearchResult &other)
 Copy constructor.
 
AccurateMassSearchResultoperator= (const AccurateMassSearchResult &other)
 Copy-assignment operator.
 
double getObservedMZ () const
 Observed m/z of the source feature (Th).
 
void setObservedMZ (const double &mz)
 Set the observed m/z of the source feature.
 
double getCalculatedMZ () const
 Theoretical m/z of the matched compound + adduct (Th).
 
void setCalculatedMZ (const double &mz)
 Set the theoretical m/z of the matched compound + adduct.
 
double getQueryMass () const
 Neutral mass used to query the database (Dalton), back- calculated from getObservedMZ assuming getFoundAdduct and getCharge.
 
void setQueryMass (const double &mass)
 Set the neutral mass used to query the database.
 
double getFoundMass () const
 Neutral mass of the matched database compound (Dalton).
 
void setFoundMass (const double &mass)
 Set the neutral mass of the matched database compound.
 
Int getCharge () const
 Ion charge under which this match was attempted (positive for cations, negative for anions).
 
void setCharge (const Int &ch)
 Set the ion charge under which this match was attempted.
 
double getMZErrorPPM () const
 Signed m/z error in ppm: (observed − theoretical) / theoretical · 1e6.
 
void setMZErrorPPM (const double ppm)
 Set the signed m/z error in ppm.
 
double getObservedRT () const
 Retention time of the source feature (seconds).
 
void setObservedRT (const double &rt)
 Set the retention time of the source feature (seconds).
 
double getObservedIntensity () const
 Intensity of the source feature (consensus-aggregated when the input was a ConsensusMap).
 
void setObservedIntensity (const double &intensity)
 Set the intensity of the source feature.
 
std::vector< double > getIndividualIntensities () const
 Per-sample intensities of the source feature when the input is a ConsensusMap; empty otherwise.
 
void setIndividualIntensities (const std::vector< double > &indiv_ints)
 Set the per-sample intensities of the source feature.
 
Size getMatchingIndex () const
 Index of this hit in the engine's internal candidate list for the source feature. Useful when reconstructing scoring details after export.
 
void setMatchingIndex (const Size &idx)
 Set the candidate-list index.
 
Size getSourceFeatureIndex () const
 Index of the source feature in the input map (back- reference to the raw observation).
 
void setSourceFeatureIndex (const Size &idx)
 Set the source feature index.
 
const std::string & getFoundAdduct () const
 Adduct that produced the match, in AdductInfo notation (e.g. "M+H;1+", "M-H2O+H;1+").
 
void setFoundAdduct (const std::string &add)
 Set the adduct that produced the match.
 
const std::string & getFormulaString () const
 Empirical formula of the matched database compound.
 
void setEmpiricalFormula (const std::string &ep)
 Set the empirical formula of the matched database compound.
 
const std::vector< std::string > & getMatchingHMDBids () const
 All database identifiers (HMDB-style) that share the matched compound's formula and mass; can be empty when no identifier mapping is available.
 
void setMatchingHMDBids (const std::vector< std::string > &ids)
 Set the matched database identifiers.
 
const std::vector< double > & getMasstraceIntensities () const
 Per-isotopologue intensities of the underlying feature's mass traces; used as the empirical isotope pattern when computing getIsotopesSimScore.
 
void setMasstraceIntensities (const std::vector< double > &intensities)
 Set the underlying feature's per-isotopologue intensities.
 
double getIsotopesSimScore () const
 Similarity between the observed isotope pattern (from getMasstraceIntensities) and the theoretical pattern of the matched compound. Higher values indicate a better match.
 
void setIsotopesSimScore (const double &score)
 Set the isotope-pattern similarity score.
 

Private Attributes

double observed_mz_
 Stored information/results of DB query.
 
double theoretical_mz_
 theoretical m/z of matched compound + adduct (Th)
 
double searched_mass_
 neutral mass used to query the database (Da)
 
double db_mass_
 neutral mass of the matched database compound (Da)
 
Int charge_
 charge assumed for this match (positive for cations)
 
double mz_error_ppm_
 signed m/z error (observed − theoretical), ppm
 
double observed_rt_
 RT of source feature (s)
 
double observed_intensity_
 intensity of source feature
 
std::vector< double > individual_intensities_
 per-sample intensities (ConsensusMap input)
 
Size matching_index_
 index in the engine's internal candidate list
 
Size source_feature_index_
 index in the input feature/peak map
 
std::string found_adduct_
 adduct in AdductInfo notation (e.g. "M+H;1+")
 
std::string empirical_formula_
 empirical formula of matched compound
 
std::vector< std::string > matching_hmdb_ids_
 zero or more DB IDs (multiple isobars share a formula)
 
std::vector< double > mass_trace_intensities_
 per-isotopologue intensities from the feature
 
double isotopes_sim_score_
 observed vs. theoretical isotope-pattern similarity
 

Friends

std::ostream & operator<< (std::ostream &os, const AccurateMassSearchResult &amsr)
 Diagnostic stream output of all fields (not a parseable serialization).
 

Detailed Description

One small-molecule hit produced by AccurateMassSearchEngine.

Represents a single (observed feature/peak) — (database compound + adduct) match. AccurateMassSearchEngine emits one of these per accepted (feature, adduct, candidate-compound) combination, so the same input feature can appear in several results if it is consistent with more than one adduct or matches multiple isobaric compounds in the database.

Lifecycle

Each result is built up incrementally by the search engine via the setters and exposed read-only to consumers via the getters. The class holds no logic of its own — it is a plain value object grouping the observable, the database hit, and the diagnostics that explain why the two were matched.

Field semantics

Observed quantities (from the spectrum / feature):

  • observed_mz : observed m/z of the feature.
  • observed_rt : retention time of the feature.
  • observed_intensity: intensity of the feature.
  • individual_intensities : per-FeatureHandle intensities, populated only on the ConsensusMap overload of AccurateMassSearchEngine::run; stays empty when the engine is invoked on a plain FeatureMap.
  • mass_trace_intensities : per-isotopologue intensities of the underlying mass traces (used for the isotope-pattern similarity score).

Match-derived quantities:

  • searched_mass : neutral mass back-calculated from observed_mz under the assumption of found_adduct and charge. Used as the database query.
  • db_mass : neutral mass of the matched database compound (the "ground truth" for this hit).
  • theoretical_mz: m/z that the matched compound + adduct would produce; differs from observed_mz by mz_error_ppm.
  • mz_error_ppm : signed m/z error in ppm, observed vs. theoretical.
  • charge : ion charge under which the match was attempted (positive for cations, negative for anions).

Compound annotation:

  • found_adduct : adduct that produced the match, in the notation used by AdductInfo (e.g. "M+H;1+", "M-H2O+H;1+").
  • empirical_formula : empirical formula of the matched compound.
  • matching_hmdb_ids : zero or more database IDs that share the formula and mass (multiple isobars are common in HMDB-style databases).

Back-references:

  • matching_index : index of the hit within the engine's internal candidate list (useful when reconstructing scoring details after export).
  • source_feature_index: index of the source feature/peak in the input map (lets callers traceback to the raw observation).

Quality score:

  • isotopes_sim_score : isotope-pattern similarity between the feature's observed mass-trace intensities and the theoretical pattern of the candidate compound. Higher = better.
See also
AccurateMassSearchEngine
AdductInfo

Constructor & Destructor Documentation

◆ AccurateMassSearchResult() [1/2]

Default constructor; all numeric fields zero, strings and vectors empty.

◆ ~AccurateMassSearchResult()

Default destructor.

◆ AccurateMassSearchResult() [2/2]

Copy constructor.

Parameters
[in]otherSource result to copy from.

Member Function Documentation

◆ getCalculatedMZ()

double getCalculatedMZ ( ) const

Theoretical m/z of the matched compound + adduct (Th).

◆ getCharge()

Int getCharge ( ) const

Ion charge under which this match was attempted (positive for cations, negative for anions).

◆ getFormulaString()

const std::string & getFormulaString ( ) const

Empirical formula of the matched database compound.

◆ getFoundAdduct()

const std::string & getFoundAdduct ( ) const

Adduct that produced the match, in AdductInfo notation (e.g. "M+H;1+", "M-H2O+H;1+").

◆ getFoundMass()

double getFoundMass ( ) const

Neutral mass of the matched database compound (Dalton).

◆ getIndividualIntensities()

std::vector< double > getIndividualIntensities ( ) const

Per-sample intensities of the source feature when the input is a ConsensusMap; empty otherwise.

◆ getIsotopesSimScore()

double getIsotopesSimScore ( ) const

Similarity between the observed isotope pattern (from getMasstraceIntensities) and the theoretical pattern of the matched compound. Higher values indicate a better match.

◆ getMasstraceIntensities()

const std::vector< double > & getMasstraceIntensities ( ) const

Per-isotopologue intensities of the underlying feature's mass traces; used as the empirical isotope pattern when computing getIsotopesSimScore.

◆ getMatchingHMDBids()

const std::vector< std::string > & getMatchingHMDBids ( ) const

All database identifiers (HMDB-style) that share the matched compound's formula and mass; can be empty when no identifier mapping is available.

◆ getMatchingIndex()

Size getMatchingIndex ( ) const

Index of this hit in the engine's internal candidate list for the source feature. Useful when reconstructing scoring details after export.

◆ getMZErrorPPM()

double getMZErrorPPM ( ) const

Signed m/z error in ppm: (observed − theoretical) / theoretical · 1e6.

◆ getObservedIntensity()

double getObservedIntensity ( ) const

Intensity of the source feature (consensus-aggregated when the input was a ConsensusMap).

◆ getObservedMZ()

double getObservedMZ ( ) const

Observed m/z of the source feature (Th).

◆ getObservedRT()

double getObservedRT ( ) const

Retention time of the source feature (seconds).

◆ getQueryMass()

double getQueryMass ( ) const

Neutral mass used to query the database (Dalton), back- calculated from getObservedMZ assuming getFoundAdduct and getCharge.

◆ getSourceFeatureIndex()

Size getSourceFeatureIndex ( ) const

Index of the source feature in the input map (back- reference to the raw observation).

◆ operator=()

AccurateMassSearchResult & operator= ( const AccurateMassSearchResult other)

Copy-assignment operator.

Parameters
[in]otherSource result to copy from.

◆ setCalculatedMZ()

void setCalculatedMZ ( const double &  mz)

Set the theoretical m/z of the matched compound + adduct.

Parameters
[in]mzTheoretical m/z of compound + adduct (Th).

◆ setCharge()

void setCharge ( const Int ch)

Set the ion charge under which this match was attempted.

Parameters
[in]chSigned ion charge (positive for cations).

◆ setEmpiricalFormula()

void setEmpiricalFormula ( const std::string &  ep)

Set the empirical formula of the matched database compound.

Parameters
[in]epEmpirical formula of the matched compound.

◆ setFoundAdduct()

void setFoundAdduct ( const std::string &  add)

Set the adduct that produced the match.

Parameters
[in]addAdduct in AdductInfo notation (e.g. "M+H;1+").

◆ setFoundMass()

void setFoundMass ( const double &  mass)

Set the neutral mass of the matched database compound.

Parameters
[in]massNeutral mass of the matched compound (Da).

◆ setIndividualIntensities()

void setIndividualIntensities ( const std::vector< double > &  indiv_ints)

Set the per-sample intensities of the source feature.

Parameters
[in]indiv_intsPer-sample intensities (ConsensusMap input).

◆ setIsotopesSimScore()

void setIsotopesSimScore ( const double &  score)

Set the isotope-pattern similarity score.

Parameters
[in]scoreIsotope-pattern similarity score (higher = better.

◆ setMasstraceIntensities()

void setMasstraceIntensities ( const std::vector< double > &  intensities)

Set the underlying feature's per-isotopologue intensities.

Parameters
[in]intensitiesPer-isotopologue intensities from the feature.

◆ setMatchingHMDBids()

void setMatchingHMDBids ( const std::vector< std::string > &  ids)

Set the matched database identifiers.

Parameters
[in]idsDatabase identifiers (HMDB-style).

◆ setMatchingIndex()

void setMatchingIndex ( const Size idx)

Set the candidate-list index.

Parameters
[in]idxIndex in the engine's internal candidate list.

◆ setMZErrorPPM()

void setMZErrorPPM ( const double  ppm)

Set the signed m/z error in ppm.

Parameters
[in]ppmSigned m/z error (observed − theoretical) in ppm.

◆ setObservedIntensity()

void setObservedIntensity ( const double &  intensity)

Set the intensity of the source feature.

Parameters
[in]intensityIntensity of the source feature.

◆ setObservedMZ()

void setObservedMZ ( const double &  mz)

Set the observed m/z of the source feature.

Parameters
[in]mzObserved m/z (Th).

◆ setObservedRT()

void setObservedRT ( const double &  rt)

Set the retention time of the source feature (seconds).

Parameters
[in]rtRetention time of the source feature (s).

◆ setQueryMass()

void setQueryMass ( const double &  mass)

Set the neutral mass used to query the database.

Parameters
[in]massNeutral mass used to query the database (Da).

◆ setSourceFeatureIndex()

void setSourceFeatureIndex ( const Size idx)

Set the source feature index.

Parameters
[in]idxIndex in the input feature/peak map.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const AccurateMassSearchResult amsr 
)
friend

Diagnostic stream output of all fields (not a parseable serialization).

Member Data Documentation

◆ charge_

Int charge_
private

charge assumed for this match (positive for cations)

◆ db_mass_

double db_mass_
private

neutral mass of the matched database compound (Da)

◆ empirical_formula_

std::string empirical_formula_
private

empirical formula of matched compound

◆ found_adduct_

std::string found_adduct_
private

adduct in AdductInfo notation (e.g. "M+H;1+")

◆ individual_intensities_

std::vector<double> individual_intensities_
private

per-sample intensities (ConsensusMap input)

◆ isotopes_sim_score_

double isotopes_sim_score_
private

observed vs. theoretical isotope-pattern similarity

◆ mass_trace_intensities_

std::vector<double> mass_trace_intensities_
private

per-isotopologue intensities from the feature

◆ matching_hmdb_ids_

std::vector<std::string> matching_hmdb_ids_
private

zero or more DB IDs (multiple isobars share a formula)

◆ matching_index_

Size matching_index_
private

index in the engine's internal candidate list

◆ mz_error_ppm_

double mz_error_ppm_
private

signed m/z error (observed − theoretical), ppm

◆ observed_intensity_

double observed_intensity_
private

intensity of source feature

◆ observed_mz_

double observed_mz_
private

Stored information/results of DB query.

observed m/z of source feature (Th)

◆ observed_rt_

double observed_rt_
private

RT of source feature (s)

◆ searched_mass_

double searched_mass_
private

neutral mass used to query the database (Da)

◆ source_feature_index_

Size source_feature_index_
private

index in the input feature/peak map

◆ theoretical_mz_

double theoretical_mz_
private

theoretical m/z of matched compound + adduct (Th)