libXpertMass Developer Documentation
  • libXpertMass
  • IsotopicDataManualConfigHandler
  • IsotopicDataManualConfigHandler Class

    class MsXpS::libXpertMass::IsotopicDataManualConfigHandler

    The IsotopicDataManualConfigHandler class handles a peculiar kind of IsotopicData that cannot be handled with the other handlers. More...

    Header: #include <IsotopicDataManualConfigHandler.hpp>
    Inherits: MsXpS::libXpertMass::IsotopicDataBaseHandler

    Public Functions

    IsotopicDataManualConfigHandler(const QString &file_name = QString())
    IsotopicDataManualConfigHandler(IsotopicDataSPtr isotopic_data_sp, const QString &file_name = QString())
    virtual ~IsotopicDataManualConfigHandler()
    QString craftFormula() const
    virtual const SymbolCountMap &getSymbolCountMap() const
    bool newChemicalSet(const QString &symbol, int element_count, const std::vector<IsotopeSPtr> &isotopes, bool update_maps = true)
    virtual void setSymbolCountMap(const SymbolCountMap &map)

    Reimplemented Public Functions

    virtual std::size_t loadData(const QString &file_name) override
    virtual std::size_t writeData(const QString &file_name = QString()) override

    Reimplemented Protected Functions

    virtual std::size_t checkConsistency() override

    Protected Variables

    SymbolCountMap m_symbolCountMap

    Detailed Description

    This kind of IsotopicData handler is typically used when definition of brand new chemical element isotopes are to be performed. For example, if one works with radioactive carbon C14, then that isotope is not available in the IsoSpec's library and cannot be inserted in these data using the IsotopicDataUserConfigHandler.

    One interesting feature of this kind of IsotopicData formalism is that these data collectively describe a chemical elemental composition formula, like, for glucose: C6H12O6. Each chemical element is decribed using isotopes with mass/abundance pairs. There is thus virtually no limitation on the complexity of the isotopic distribution to be defined. The format of these data stored on file is nothing like the format used to store Library- or User-Config- isotopic data (IsotopicDataLibraryHandler, IsotopicDataUserConfigHandler).

    In the example below we are defining the isotopic composition of radiolabelled glucose (C6H12O6) where only two of the the six C atoms are 14[C] atoms with a radiolabelling efficiency of 95%:

    [Element]
    symbol C count 4
    # The four atoms that are not labelled appear with natural
    # abundances for both stable isotopes
      [Isotopes] 2
        mass 12.0 prob 0.989
      mass 13.003354 prob 0.010788
    [Element]
    # The two atoms that are 95% labelled with 14[C] need to use
    # a new artificial symbol
    symbol Cx count 2
      [Isotopes] 3
        # 5% of non labelled atoms are of natural 12[C] abundance
        mass 12.000 prob 0.05*0.989211941850466
        # 5% of non labelled atoms are of natural 13[C] abundance
        mass 13.0033548352 prob 0.05*0.010788058149533084
        # The remaining 95% of the atoms are 14[C] atoms with abundance 100%
        mass 14.003241989 prob 0.95*1.00
    [Element]
    symbol H count 12
      [Isotopes] 2
        mass 1.0078250 prob 0.99988
        mass 2.01410177 prob 0.00011570
    [Element]
    symbol O count 6
      [Isotopes] 3
        mass 15.9949 prob 0.99756
        mass 16.999 prob 0.000380
        mass 17.999 prob 0.002051

    Comments are allowed and are on lines that have as their first non-space character the '#' character. These lines are ignored when loading data.

    The data can be loaded from and written to file.

    See also IsotopicDataLibraryHandler and IsotopicDataUserConfigHandler.

    Member Function Documentation

    IsotopicDataManualConfigHandler::IsotopicDataManualConfigHandler(const QString &file_name = QString())

    Constructs the IsotopicDataManualConfigHandler with file_name.

    IsotopicDataManualConfigHandler::IsotopicDataManualConfigHandler(IsotopicDataSPtr isotopic_data_sp, const QString &file_name = QString())

    Constructs the IsotopicDataManualConfigHandler.

    isotopic_data_sp Isotopic data

    file_name File name

    [virtual noexcept] IsotopicDataManualConfigHandler::~IsotopicDataManualConfigHandler()

    Destructs the IsotopicDataManualConfigHandler.

    [override virtual protected] std::size_t IsotopicDataManualConfigHandler::checkConsistency()

    Returns the count of Isotopes in this collection.

    QString IsotopicDataManualConfigHandler::craftFormula() const

    Returns a string containing a formula corresponding to the IsotopicData.

    The formula is actually computed using the symbol/count pairs stored in m_symbolCountMap.

    [virtual] const SymbolCountMap &IsotopicDataManualConfigHandler::getSymbolCountMap() const

    Returns a reference to m_symbolCountMap.

    [override virtual] std::size_t IsotopicDataManualConfigHandler::loadData(const QString &file_name)

    Loads isotopic data from file_name.

    Returns the count of Isotopes that were allocated and stored in the msp_isotopicData member.

    bool IsotopicDataManualConfigHandler::newChemicalSet(const QString &symbol, int element_count, const std::vector<IsotopeSPtr> &isotopes, bool update_maps = true)

    Add a set of Isotopes belonging to chemical element symbol.

    The count of atoms of symbol is defined with element_count. The isotopes to be added are provided in isotopes.

    If the new chemical data pertain to a symbol that was already added to the IsotopicData, then that is an error.

    If update_maps is true, the IsotopicData maps need to be updated.

    Returns false if the new chemical data pertain to a symbol that was already added to the IsotopicData.

    See also IsotopicData::updateMonoMassMap() and IsotopicData::updateAvgMassMap().

    [virtual] void IsotopicDataManualConfigHandler::setSymbolCountMap(const SymbolCountMap &map)

    Assigns map to m_symbolCountMap.

    [override virtual] std::size_t IsotopicDataManualConfigHandler::writeData(const QString &file_name = QString())

    Write all the IsotopicData to file_name.

    If file_name is empty, m_fileName is tried. If both are empty, the function returns 0. If any one of the file names are correct (file_name takes precedence over m_fileName), then m_fileName is set to that file name.

    The format of the file consists in a single line of data per Isotope as created using the Isotope::toString() function. Each isotope is output to its own line.

    Returns the count of Isotopes written to file or 0 if the file does not exist or is not readable.

    See also Isotope::Isotope(const QString &text).

    Member Variable Documentation

    SymbolCountMap IsotopicDataManualConfigHandler::m_symbolCountMap

    Holds symbol/count pairs to document the count of any symbol in the isotopic data. This symbol count is stored in the file using the following format:

    [Element]
    symbol C count 6

    The number of carbon atoms in the formula being defined is 6, as in glucose: C6H1206.