Loading...
Searching...
No Matches
projectparameters.h
Go to the documentation of this file.
/**
* \file pappsomspp/processing/project/projectparameters.h
* \date 16/03/2024
* \author Olivier Langella
* \brief simple structure to store project parameters (identification,
* filtering, quantification)
*/
/*******************************************************************************
* Copyright (c) 2022 Olivier Langella
*<Olivier.Langella@universite-paris-saclay.fr>.
*
* This file is part of i2MassChroQ.
*
* i2MassChroQ is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* i2MassChroQ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with i2MassChroQ. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#pragma once
#include <QString>
#include <QVariant>
#include <odsstream/calcwriterinterface.h>
#include <QCborStreamWriter>
#include <QJsonObject>
#include "pappsomspp/export-import-config.h"
namespace pappso
{
/** \def ProjectParamCategory parameter category
*/
enum class ProjectParamCategory : std::int8_t
{
undefined = 0, ///< undefined
general = 1, ///< concerning the whole process
identification = 2, ///< concerning identification
filter = 3, ///< concerning filters (psm, peptide, protein validation)
quantification = 4, ///< quantification
instrument = 5, ///< information about instrument
};
struct PMSPP_LIB_DECL ProjectParam
{
QJsonObject toJsonObject() const;
ProjectParamCategory category;
QString name;
QVariant value;
};
/**
* @todo write docs
*/
class PMSPP_LIB_DECL ProjectParameters
{
public:
/**
* Default constructor
*/
ProjectParameters();
ProjectParameters(const QJsonObject &json_parameters);
/**
* Copy constructor
*
* @param other TODO
*/
ProjectParameters(const ProjectParameters &other);
/**
* Destructor
*/
~ProjectParameters();
ProjectParameters &operator=(const ProjectParameters &other);
void writeParameters(CalcWriterInterface &writer) const;
void writeParameters(QXmlStreamWriter &xml_writer) const;
void writeParameters(QCborStreamWriter &cbor_writer) const;
const QVariant getValue(ProjectParamCategory category, const QString &name) const;
void setProjectParam(const ProjectParam &param);
void merge(const ProjectParameters &parameters);
std::size_t size() const;
std::vector<ProjectParam> getProjectParamListByCategory(ProjectParamCategory category) const;
QJsonObject toJsonObject() const;
private:
void writeCellVariant(CalcWriterInterface &writer, const QVariant &var) const;
void writeXmlParameter(QXmlStreamWriter &writer, const ProjectParam &param) const;
void writeXmlVariant(QXmlStreamWriter &writer, const QVariant &var) const;
private:
std::map<QString, ProjectParam> m_mapGeneralParameters;
std::map<QString, ProjectParam> m_mapIdentificationParameters;
std::map<QString, ProjectParam> m_mapFilterParameters;
std::map<QString, ProjectParam> m_mapQuantificationParameters;
std::map<QString, ProjectParam> m_mapInstrumentParameters;
};
} // namespace pappso
pappso::ProjectParameters::writeCellVariant
void writeCellVariant(CalcWriterInterface &writer, const QVariant &var) const
Definition projectparameters.cpp:90
pappso::ProjectParameters::m_mapQuantificationParameters
std::map< QString, ProjectParam > m_mapQuantificationParameters
Definition projectparameters.h:118
pappso::ProjectParameters::m_mapIdentificationParameters
std::map< QString, ProjectParam > m_mapIdentificationParameters
Definition projectparameters.h:116
pappso::ProjectParameters::operator=
ProjectParameters & operator=(const ProjectParameters &other)
Definition projectparameters.cpp:76
pappso::ProjectParameters::m_mapGeneralParameters
std::map< QString, ProjectParam > m_mapGeneralParameters
Definition projectparameters.h:115
pappso::ProjectParameters::writeXmlVariant
void writeXmlVariant(QXmlStreamWriter &writer, const QVariant &var) const
Definition projectparameters.cpp:167
pappso::ProjectParameters::ProjectParameters
ProjectParameters()
Definition projectparameters.cpp:38
pappso::ProjectParameters::writeXmlParameter
void writeXmlParameter(QXmlStreamWriter &writer, const ProjectParam &param) const
Definition projectparameters.cpp:126
pappso::ProjectParameters::m_mapFilterParameters
std::map< QString, ProjectParam > m_mapFilterParameters
Definition projectparameters.h:117
pappso::ProjectParameters::size
std::size_t size() const
Definition projectparameters.cpp:299
pappso::ProjectParameters::setProjectParam
void setProjectParam(const ProjectParam &param)
Definition projectparameters.cpp:246
pappso::ProjectParameters::m_mapInstrumentParameters
std::map< QString, ProjectParam > m_mapInstrumentParameters
Definition projectparameters.h:119
pappso::ProjectParameters::toJsonObject
QJsonObject toJsonObject() const
Definition projectparameters.cpp:382
pappso::ProjectParameters::getProjectParamListByCategory
std::vector< ProjectParam > getProjectParamListByCategory(ProjectParamCategory category) const
Definition projectparameters.cpp:347
pappso::ProjectParameters::getValue
const QVariant getValue(ProjectParamCategory category, const QString &name) const
Definition projectparameters.cpp:307
pappso::ProjectParameters::merge
void merge(const ProjectParameters &parameters)
Definition projectparameters.cpp:271
pappso::ProjectParameters::writeParameters
void writeParameters(CalcWriterInterface &writer) const
Definition projectparameters.cpp:208
export-import-config.h
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition export-import-config.h:14
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
pappso::ProjectParamCategory
ProjectParamCategory
Definition projectparameters.h:44
pappso::ProjectParamCategory::identification
@ identification
concerning identification
Definition projectparameters.h:47
pappso::ProjectParamCategory::instrument
@ instrument
information about instrument
Definition projectparameters.h:50
pappso::ProjectParamCategory::undefined
@ undefined
undefined
Definition projectparameters.h:45
pappso::ProjectParamCategory::general
@ general
concerning the whole process
Definition projectparameters.h:46
pappso::ProjectParamCategory::quantification
@ quantification
quantification
Definition projectparameters.h:49
pappso::ProjectParamCategory::filter
@ filter
concerning filters (psm, peptide, protein validation)
Definition projectparameters.h:48
pappso::ProjectParam
Definition projectparameters.h:54
pappso::ProjectParam::value
QVariant value
Definition projectparameters.h:59
pappso::ProjectParam::category
ProjectParamCategory category
Definition projectparameters.h:57
pappso::ProjectParam::name
QString name
Definition projectparameters.h:58
pappso::ProjectParam::toJsonObject
QJsonObject toJsonObject() const
Definition projectparameters.cpp:411