| | |
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::libXpertMassCore::IsotopicDataBaseHandler |
| IsotopicDataLibraryHandler() | |
| IsotopicDataLibraryHandler(MsXpS::libXpertMassCore::IsotopicDataSPtr isotopic_data_sp) | |
| virtual | ~IsotopicDataLibraryHandler() |
| virtual qsizetype | loadData(qsizetype &count_non_isotope_skipped_items) |
| virtual qsizetype | writeData(const QString &file_name = QString()) override |
| virtual qsizetype | checkConsistency() override |
The IsoSpec element data tables that are used in libXpertMassCore 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.
Constructs the IsotopicDataLibraryHandler.
The instance will have empty member data.
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] qsizetype 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] qsizetype IsotopicDataLibraryHandler::loadData(qsizetype &count_non_isotope_skipped_items)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:
IsotopeQSPtr isotope_qsp = std::make_shared<Isotope>(QString(IsoSpec::elem_table_element[iter]), QString(IsoSpec::elem_table_symbol[iter]), IsoSpec::elem_table_mass[iter], IsoSpec::elem_table_probability[iter]);
Note that some rows in the table are populated with non-isotope data, like electron, missing_electron or protonation (twice). When these rows are encountered, the count_non_isotope_skipped_items is incremented.
Returns the count of Isotopes that were allocated and stored in the msp_isotopicData member.
[override virtual] qsizetype 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 and
Isotope::Isotope(const QString &text, QObject *parent). Each isotope is output to its own line.
Returns the count of Isotope::Isotopes written to file or 0 if the file does not exist or is not readable.
See also Isotope::Isotope and overloads.