ProteoWizard
Functions
pwiz::chemistry::Ion Namespace Reference

Functions

double neutralMass (double mz, int protonDelta, int electronDelta=0, int neutronDelta=0)
 
double ionMass (double neutralMass, int protonDelta, int electronDelta=0, int neutronDelta=0)
 
double mz (double neutralMass, int protonDelta, int electronDelta=0, int neutronDelta=0)
 

Function Documentation

◆ neutralMass()

double pwiz::chemistry::Ion::neutralMass ( double  mz,
int  protonDelta,
int  electronDelta = 0,
int  neutronDelta = 0 
)
inline

Converts the m/z of an ion to a neutral mass.

Parameters
[in]mzThe m/z to convert.
[in]protonDeltaThe number of extra protons attached to the ion.
[in]electronDeltaThe number of extra electrons attached to the ion.
[in]neutronDeltaThe number of extra neutrons attached to the ion.
Precondition
protonDelta != electronDelta

Definition at line 46 of file Ion.hpp.

47  {
48  int charge = protonDelta - electronDelta;
49  return charge == 0 ? throw std::invalid_argument("[Ion::neutralMass()] m/z with protonDelta=electronDelta is impossible")
50  : mz * charge - ((Proton * protonDelta) +
51  (Electron * electronDelta) +
52  (Neutron * neutronDelta));
53  }

References pwiz::chemistry::Electron, mz(), pwiz::chemistry::Neutron, and pwiz::chemistry::Proton.

Referenced by ionMass(), and mz().

◆ ionMass()

double pwiz::chemistry::Ion::ionMass ( double  neutralMass,
int  protonDelta,
int  electronDelta = 0,
int  neutronDelta = 0 
)
inline

Converts a neutral mass to an ionized mass.

Parameters
[in]neutralMassThe neutral mass to ionize.
[in]protonDeltaThe number of extra protons to attach to the ion.
[in]electronDeltaThe number of extra electrons to attach to the ion.
[in]neutronDeltaThe number of extra neutrons to attach to the ion.
Precondition
protonDelta != electronDelta

Definition at line 63 of file Ion.hpp.

64  {
65  return neutralMass + (Proton * protonDelta) +
66  (Electron * electronDelta) +
67  (Neutron * neutronDelta);
68  }

References pwiz::chemistry::Electron, neutralMass(), pwiz::chemistry::Neutron, and pwiz::chemistry::Proton.

Referenced by mz().

◆ mz()

double pwiz::chemistry::Ion::mz ( double  neutralMass,
int  protonDelta,
int  electronDelta = 0,
int  neutronDelta = 0 
)
inline

Converts a neutral mass to an m/z.

Parameters
[in]neutralMassThe neutral mass to ionize.
[in]protonDeltaThe number of extra protons to attach to the ion.
[in]electronDeltaThe number of extra electrons to attach to the ion.
[in]neutronDeltaThe number of extra neutrons to attach to the ion.
Precondition
protonDelta != electronDelta

Definition at line 78 of file Ion.hpp.

79  {
80  int z = protonDelta - electronDelta;
81  double m = ionMass(neutralMass, protonDelta, electronDelta, neutronDelta);
82  return z == 0 ? throw std::invalid_argument("[Ion::mz()] m/z with protonDelta=electronDelta is impossible")
83  : m / z;
84  }

References ionMass(), and neutralMass().

Referenced by SpectrumPeakExtractorTest::ExtractPeaksTest(), pwiz::analysis::MZRTField< T >::find(), pwiz::analysis::IsoWindowHasher::Hash(), neutralMass(), MyPred::operator()(), test(), test2(), testMetadata(), testMultiplePeaks(), testPolysiloxane(), and validateRecalculation().

pwiz::chemistry::Ion::neutralMass
double neutralMass(double mz, int protonDelta, int electronDelta=0, int neutronDelta=0)
Definition: Ion.hpp:46
pwiz::chemistry::Ion::ionMass
double ionMass(double neutralMass, int protonDelta, int electronDelta=0, int neutronDelta=0)
Definition: Ion.hpp:63
pwiz::chemistry::Electron
const double Electron
the mass of an electron in unified atomic mass units
Definition: Chemistry.hpp:47
pwiz::chemistry::Neutron
const double Neutron
the mass of a neutron in unified atomic mass units
Definition: Chemistry.hpp:44
pwiz::chemistry::Ion::mz
double mz(double neutralMass, int protonDelta, int electronDelta=0, int neutronDelta=0)
Definition: Ion.hpp:78
pwiz::chemistry::Proton
const double Proton
the mass of a proton in unified atomic mass units
Definition: Chemistry.hpp:41