libXpertMass Developer Documentation
  • libXpertMass
  • IsotopicDataLibraryHandler
  • IsotopicDataLibraryHandler Class

    class MsXpS::libXpertMass::IsotopicDataLibraryHandler

    The IsotopicDataLibraryHandler class handles IsotopicData from the IsoSpec element data tables directly from the library's data. These are the reference, pristine, unmodified, isotopic data. More...

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

    Public Functions

    IsotopicDataLibraryHandler()
    IsotopicDataLibraryHandler(IsotopicDataSPtr isotopic_data_sp)
    virtual ~IsotopicDataLibraryHandler()
    virtual std::size_t loadData()

    Reimplemented Public Functions

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

    Reimplemented Protected Functions

    virtual std::size_t checkConsistency() override

    Detailed Description

    The IsoSpec element data tables are the following:

    The data tables are all of the same length and the data in each row of a given table matches the contents of that same row in all the other tables. For example, the first two rows of table elem_table_ID are:

    1

    1

    These two rows match the same rows in elem_table_mass:

    1.00782503227

    2.01410177819

    and the the same rows in elem_table_element:

    "hydrogen"

    "hydrogen"

    By reading, row-by-row, the data from the same row number in each one of the tables, one constructs a fully qualified Isotope.

    See also IsotopicDataUserConfigHandler and IsotopicDataManualConfigHandler.

    Member Function Documentation

    IsotopicDataLibraryHandler::IsotopicDataLibraryHandler()

    Constructs the IsotopicDataLibraryHandler.

    The instance will have empty member data.

    IsotopicDataLibraryHandler::IsotopicDataLibraryHandler(IsotopicDataSPtr isotopic_data_sp)

    Constructs the IsotopicDataLibraryHandler.

    The instance will have its isotopic data member pointing to isotopic_data_sp.

    [virtual noexcept] IsotopicDataLibraryHandler::~IsotopicDataLibraryHandler()

    Destructs the IsotopicDataLibraryHandler.

    Nothing is explicitely deleted in the destructor.

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

    Checks the consistency in all the IsoSpec library's different isotopic data tables.

    This function essentially verifies that each table has the same row count as all the other ones.

    Returns the count of isotopes in the isotopic data.

    [virtual] std::size_t IsotopicDataLibraryHandler::loadData()

    Loads isotopic data directly from IsoSpec library' element data tables.

    The member isotopic data are cleared before setting new data read from the library's element data tables.

    The code iterates, row-by-row, in the all the tables and extracts the data to fill in the Isotope data:

    IsotopeSPtr isotope_sp =
          std::make_shared<Isotope>(IsoSpec::elem_table_ID[iter],
                                    QString(IsoSpec::elem_table_element[iter]),
                                    QString(IsoSpec::elem_table_symbol[iter]),
                                    IsoSpec::elem_table_atomicNo[iter],
                                    IsoSpec::elem_table_mass[iter],
                                    IsoSpec::elem_table_massNo[iter],
                                    IsoSpec::elem_table_extraNeutrons[iter],
                                    IsoSpec::elem_table_probability[iter],
                                    IsoSpec::elem_table_log_probability[iter],
                                    IsoSpec::elem_table_Radioactive[iter]);

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

    [override virtual] std::size_t IsotopicDataLibraryHandler::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).