libXpertMassCore and libXpertMassGui Developer Documentation
  • libXpertMassCore
  • Averagine
  • MsXpS::libXpertMassCore::Averagine Class

    class MsXpS::libXpertMassCore::Averagine

    The Averagine class provides features to use the Averagine concept. More...

    Header: #include <MsXpS/libXpertMassCore/Averagine.hpp>
    Inherits: QObject

    Properties

    Public Functions

    Averagine(QObject *parent = nullptr)
    Averagine(MsXpS::libXpertMassCore::IsotopicDataCstSPtr isotopic_data_csp, QObject *parent = nullptr)
    Averagine(const MsXpS::libXpertMassCore::Formula &formula, QObject *parent = nullptr)
    Averagine(const MsXpS::libXpertMassCore::Formula &formula, MsXpS::libXpertMassCore::IsotopicDataCstSPtr isotopic_data_csp, QObject *parent = nullptr)
    Averagine(const MsXpS::libXpertMassCore::Averagine &other, QObject *parent = nullptr)
    virtual ~Averagine()
    double averagineEquivalents(MsXpS::libXpertMassCore::Enums::MassType mass_type, double mass, bool &ok) const
    MsXpS::libXpertMassCore::Averagine *clone(QObject *parent = nullptr)
    QString elementalComposition(MsXpS::libXpertMassCore::Enums::MassType mass_type, double mass, bool as_integer_indices, bool &ok) const
    double getAvgMass() const
    const MsXpS::libXpertMassCore::Formula &getFormula() const
    const MsXpS::libXpertMassCore::Formula &getFormulaCstRef() const
    MsXpS::libXpertMassCore::Formula &getFormulaRef()
    const MsXpS::libXpertMassCore::IsotopicDataCstSPtr getIsotopicData() const
    double getMonoMass() const
    MsXpS::libXpertMassCore::Averagine &initialize(const MsXpS::libXpertMassCore::Averagine &other, QObject *parent = nullptr)
    bool isValid() const
    double modelMonoMass(double mass, bool &ok) const
    void setFormula(const MsXpS::libXpertMassCore::Formula &formula)
    void setFormula(const QString &formula)
    void setIsotopicData(const MsXpS::libXpertMassCore::IsotopicDataCstSPtr isotopic_data_csp)
    QString toString() const
    bool validate(MsXpS::libXpertMassCore::ErrorList *error_list_p)
    bool operator!=(const MsXpS::libXpertMassCore::Averagine &other) const
    bool operator==(const MsXpS::libXpertMassCore::Averagine &other) const

    Signals

    void formulaChanged()
    void isotopicDataChanged()

    Static Public Members

    MsXpS::libXpertMassCore::Averagine *clone(const MsXpS::libXpertMassCore::Averagine &other, QObject *parent = nullptr)

    Protected Variables

    double m_avg
    MsXpS::libXpertMassCore::Formula m_formula
    bool m_isValid
    double m_mono
    MsXpS::libXpertMassCore::IsotopicDataCstSPtr mcsp_isotopicData

    Detailed Description

    Once the Averagine formula has been set and the isotopic data have been set, it is possible to compute an elemental composition corresponding to any arbitrary mass along this path:

    Property Documentation

    formula : Formula

    Formula of the Averagine. Note that the formula holds decimal element symbol count indices.

    Access functions:

    const MsXpS::libXpertMassCore::Formula &getFormula() const[see note below]
    void setFormula(const QString &formula)[see note below]
    void setFormula(const MsXpS::libXpertMassCore::Formula &formula)[see note below]

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    Notifier signal:

    void formulaChanged()

    isotopicData : IsotopicDataCstSPtr

    This property holds the isotopic data to be used for the computations.

    Access functions:

    const MsXpS::libXpertMassCore::IsotopicDataCstSPtr getIsotopicData() const[see note below]
    void setIsotopicData(const MsXpS::libXpertMassCore::IsotopicDataCstSPtr isotopic_data_csp)[see note below]

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    Notifier signal:

    void isotopicDataChanged()

    Member Function Documentation

    [explicit invokable] Averagine::Averagine(QObject *parent = nullptr)

    Constructs a uninitialized Averagine instance.

    m_isValid is inherently false.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    [explicit invokable] Averagine::Averagine(MsXpS::libXpertMassCore::IsotopicDataCstSPtr isotopic_data_csp, QObject *parent = nullptr)

    Constructs a Averagine instance setting the isotopic data to isotopic_data_csp and parentship to parent.

    m_isValid is inherently false because the m_mono and m_avg masses cannot be computed without the formula.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    [explicit invokable] Averagine::Averagine(const MsXpS::libXpertMassCore::Formula &formula, QObject *parent = nullptr)

    Constructs a Averagine instance setting the formula to formula and parentship to parent.

    m_isValid is inherently false because the m_mono and m_avg masses cannot be computed without the isotopic data.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    [explicit invokable] Averagine::Averagine(const MsXpS::libXpertMassCore::Formula &formula, MsXpS::libXpertMassCore::IsotopicDataCstSPtr isotopic_data_csp, QObject *parent = nullptr)

    Constructs an Averagine instance setting the formula to formula and the isotopic data to isotopic_data_csp. Parentship is established using parent.

    m_isValid is set to the value returned by validate().

    The m_mono and m_avg masses are updated by the call to validate().

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    See also validate().

    [explicit invokable] Averagine::Averagine(const MsXpS::libXpertMassCore::Averagine &other, QObject *parent = nullptr)

    Constructs a Averagine instance as a copy of other. Parentship is established with parent.

    After the deep copy, validate() is not called.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    [virtual noexcept] Averagine::~Averagine()

    Destructs this Averagine object.

    [invokable] double Averagine::averagineEquivalents(MsXpS::libXpertMassCore::Enums::MassType mass_type, double mass, bool &ok) const

    Computes the averagine equivalents for mass_type mass and returns the result.

    In a normal setting, mass_type is Enums::MassType::AVG because the idea is to model a monoisotopic mass on the basis of an average mass.

    If an error occurs, ok is set to false.

    For this function to work, the member m_mono mand m_avg cannot be naught (qFatal() is triggered).

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    [invokable] MsXpS::libXpertMassCore::Averagine *Averagine::clone(QObject *parent = nullptr)

    Allocates a new Averagine instance with parent set to parent, assigns to it this instance and returns the allocated instance.

    The new instance is initialized using this instance.

    After the deep copy, validate() is not called.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    See also initialize().

    [static invokable] MsXpS::libXpertMassCore::Averagine *Averagine::clone(const MsXpS::libXpertMassCore::Averagine &other, QObject *parent = nullptr)

    b*rief Returns a newly allocated Averagine instance initialized with other and with parent set to parent.

    The copying is deep, that is, all the members of other are copied and validate() is not called.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    See also Averagine::Averagine().

    [invokable] QString Averagine::elementalComposition(MsXpS::libXpertMassCore::Enums::MassType mass_type, double mass, bool as_integer_indices, bool &ok) const

    Computes the averagine equivalents for mass_type mass and determines the corresponding elemental composition formula that it returns.

    If as_integer_indices is true, the returned elemental composition formula has integer atom indices.

    In a normal setting, mass_type is Enums::MassType::AVG because the idea is to model a monoisotopic mass on the basis of an average mass.

    If an error occurs, ok is set to false.

    Calls averagineEquivalents().

    For this function to work, the member m_mono mand m_avg cannot be naught.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    See also averagineEquivalents().

    [invokable] double Averagine::getAvgMass() const

    Returns the average mass.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    [invokable] const MsXpS::libXpertMassCore::Formula &Averagine::getFormula() const

    Returns a const reference to the member formula.

    This function alias is the getter for the Q_PROPERTY system.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    Note: Getter function for property formula.

    [invokable] const MsXpS::libXpertMassCore::Formula &Averagine::getFormulaCstRef() const

    Returns a const reference to the member formula.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    [invokable] MsXpS::libXpertMassCore::Formula &Averagine::getFormulaRef()

    Returns a reference to the member formula.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    [invokable] const MsXpS::libXpertMassCore::IsotopicDataCstSPtr Averagine::getIsotopicData() const

    Returns the isotopic data.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    Note: Getter function for property isotopicData.

    [invokable] double Averagine::getMonoMass() const

    Returns the monoisotopic mass.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    [invokable] MsXpS::libXpertMassCore::Averagine &Averagine::initialize(const MsXpS::libXpertMassCore::Averagine &other, QObject *parent = nullptr)

    Assigns other to this instance, re-establishes parentship to parent and returns a reference to this instance.

    After the deep copy, validate() is not called.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    See also validate().

    [invokable] bool Averagine::isValid() const

    Returns m_isValid: true if this Averagine instance is valid, false otherwise.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    [invokable] double Averagine::modelMonoMass(double mass, bool &ok) const

    Computes the averagine equivalents for average mass mass and determines the corresponding elemental composition formula and finally returns the corresponding monoisotopic mass.

    If an error occurs, ok is set to false.

    Calls elementalComposition().

    For this function to work, the member m_mono and m_avg cannot be naught.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    See also elementalComposition().

    [invokable] void Averagine::setFormula(const MsXpS::libXpertMassCore::Formula &formula)

    Sets the member Formula to formula.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    Note: Setter function for property formula.

    [invokable] void Averagine::setFormula(const QString &formula)

    Sets the member Formula to formula.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    Note: Setter function for property formula.

    [invokable] void Averagine::setIsotopicData(const MsXpS::libXpertMassCore::IsotopicDataCstSPtr isotopic_data_csp)

    Sets the isotopic data to isotopic_data_csp.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    Note: Setter function for property isotopicData.

    [invokable] QString Averagine::toString() const

    Crafts a string documenting this instance and returns it.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    [invokable] bool Averagine::validate(MsXpS::libXpertMassCore::ErrorList *error_list_p)

    Validates this instance and returns true if validation was successful, false otherwise.

    Validation steps include checking that the isotopic data are correctly set, that the formula can validate against them and that the masses (mono and avg) of the averagine can be computed.

    Note: The m_mono and m_avg values are updated upon validation of the formula.

    The errors, if any, are appended to error_list_p, that cannot be nullptr (qFatal()).

    m_isValid is set to the result of the validation and is returned.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    [invokable] bool Averagine::operator!=(const MsXpS::libXpertMassCore::Averagine &other) const

    Returns true if this Averagine instance is different than other, false otherwise.

    The comparison only accounts for the formula and the isotopic data.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    [invokable] bool Averagine::operator==(const MsXpS::libXpertMassCore::Averagine &other) const

    Returns true if this instance is identical to other, false otherwise.

    The comparison only accounts for the formula and the isotopic data.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    Member Variable Documentation

    double Averagine::m_avg

    This variable holds the average mass of this Averagine instance.

    MsXpS::libXpertMassCore::Formula Averagine::m_formula

    Formula of the Averagine. Note that the formula holds decimal element symbol count indices.

    bool Averagine::m_isValid

    Tells if this Averagine instance is valid.

    double Averagine::m_mono

    This variable holds the monoisotopic mass of this Averagine instance.

    MsXpS::libXpertMassCore::IsotopicDataCstSPtr Averagine::mcsp_isotopicData

    This variable holds the isotopic data to be used for the computations.