| <large>libXpertMassCore and libXpertMassGui Developer Documentation</large>

- libXpertMassCore
- DeconvolutedMassIdMatcher

# MsXpS::libXpertMassCore::Processing::DeconvolutedMassIdMatcher Class

class MsXpS::libXpertMassCore::Processing::DeconvolutedMassIdMatcher

The DeconvolutedMassIdMatcher class provides the mechanics that performs matches between analyte IDs and chemical formulas provided in a dictionary file. More...

Header: | `#include <MsXpS/libXpertMassCore/Processing/DeconvolutedMassIdMatcher.hpp>`
Inherits: | MsXpS::libXpertMassCore::MonitoredTaskInterface

- List of all members, including inherited members
- DeconvolutedMassIdMatcher is part of libXpertMassCore Data processing.

## Public Types

struct | Data
struct | MassIdMatch

## Public Functions

| DeconvolutedMassIdMatcher(MsXpS::libXpertMassCore::Processing::DeconvolutedMassIdMatcherParameters &parameters, QSharedPointer<QList<MsXpS::libXpertMassCore::Processing::DeconvolutedFeature>> deconvoluted_features_qsp, QObject *parent = nullptr)
virtual | ~DeconvolutedMassIdMatcher()
const QList<QSharedPointer<MsXpS::libXpertMassCore::Processing::DeconvolutedMassIdMatcher::MassIdMatch>> & | getMassIdMatches() const
int | loadDictionaryFile(MsXpS::libXpertMassCore::ErrorList *error_list_p)
int | performMatches()
void | removeUnusedMassIdMatches()
void | run()
void | setData(const MsXpS::libXpertMassCore::Processing::DeconvolutedMassIdMatcher::Data &data)

## Reimplemented Public Functions

virtual void | cancelTask() override

## Public Variables

MsXpS::libXpertMassCore::Processing::DeconvolutedMassIdMatcherParameters | m_params

## Detailed Description

The dictionary file is a speadsheet file (CSV with TAB delimiter) that must have, amongs any number of other colums, three columns with the following headers:

"Id" "Structure" "Formula"

Each row of the spreadsheet file is thus formmatted like this:

"Gly" "Gly" "C2H5N1O2"

As shown, all the textual content must be enclosed in '"' (double quote) characters.

The "Id" column contents are going to be used to label the mass peaks in the mass spectrum whenever a deconvoluted feature could be matched to an analyte's mass computed starting from the contents of the "Formula" column.

From the spreadsheet program, make sure to save as CSV file with the following settings:

- {TAB} as the delimiter
- '"' (double quote) as the text quoting symbol

Note: If the file saving to CSV is not performed with these settings, the export might fail silently with missing text parts, especially if the text contains '[' or '{' characters.

The three fundamental compulsory columns in a spreadsheet (CSV-TAB-formatted) file that need to be present are "Id", "Structure", and "Formula".

## Member Function Documentation

### DeconvolutedMassIdMatcher::DeconvolutedMassIdMatcher(MsXpS::libXpertMassCore::Processing::DeconvolutedMassIdMatcherParameters &parameters, QSharedPointer<QList<MsXpS::libXpertMassCore::Processing::DeconvolutedFeature>> deconvoluted_features_qsp, QObject *parent = nullptr)

Constructs an instance using parameters, deconvoluted_features_qsp and parent.

If m_params.processingDetailsLogFilePath contains a valid file path, the logging feature is activated and all processing details will be logged to the corresponding file.

### `[virtual noexcept]` DeconvolutedMassIdMatcher::~DeconvolutedMassIdMatcher()

Destructs this DeconvolutedMassIdMatcher instance.

### `[override virtual]` void DeconvolutedMassIdMatcher::cancelTask()

Cancels the task.

### const QList<QSharedPointer<MsXpS::libXpertMassCore::Processing::DeconvolutedMassIdMatcher::MassIdMatch>> &DeconvolutedMassIdMatcher::getMassIdMatches() const

Returns the container of MassIdMatch instances.

### int DeconvolutedMassIdMatcher::loadDictionaryFile(MsXpS::libXpertMassCore::ErrorList *error_list_p)

Loads and parses the dictionary file and logs any error to error_list_p if non-nullptr.

Returns the number dictionary rows successfully parsed, -1 if a fatal error occurred.

If any row fails to be parsed and if error_list_p is not nullptr, that row is documented in the ErrorList.

### int DeconvolutedMassIdMatcher::performMatches()

Performs the matches and returns the successful match count.

### void DeconvolutedMassIdMatcher::removeUnusedMassIdMatches()

Removes any MassIdMatch item that has not been used for an actual successful match .

### void DeconvolutedMassIdMatcher::run()

Runs the whole process.

The steps are the following:

- Loads the isotopic data file
- Loads the dictionary file
- Performs the matches

See also performMatches().

### void DeconvolutedMassIdMatcher::setData(const MsXpS::libXpertMassCore::Processing::DeconvolutedMassIdMatcher::Data &data)

Set the data to this instance.

## Member Variable Documentation

### MsXpS::libXpertMassCore::Processing::DeconvolutedMassIdMatcherParameters DeconvolutedMassIdMatcher::m_params

This variable holds the parameters used to configure this DeconvolutedMassIdMatcher instance.