Loading...
Searching...
No Matches
pappso::ProjectParameters Class Reference

`#include <projectparameters.h>`

## Public Member Functions

| ProjectParameters ()
| ProjectParameters (const QJsonObject &json_parameters)
| ProjectParameters (const ProjectParameters &other)
| ~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 Member Functions

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 Attributes

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

## Detailed Description

Todo
  write docs

Definition at line 65 of file projectparameters.h.

## Constructor & Destructor Documentation

## ProjectParameters() [1/3]

pappso::ProjectParameters::ProjectParameters | ( |  | ) |

Default constructor

Definition at line 38 of file projectparameters.cpp.

{
}

Referenced by ProjectParameters(), merge(), and operator=().

## ProjectParameters() [2/3]

pappso::ProjectParameters::ProjectParameters | ( | const QJsonObject & | json_parameters | ) |

Definition at line 42 of file projectparameters.cpp.

{
qDebug() << json_parameters.keys();
pappso::ProjectParam project_parameter;
auto itparam = json_parameters.begin();
while(itparam != json_parameters.end())
{
qDebug() << itparam.key();
project_parameter.name = itparam.key();
project_parameter.category =
(pappso::ProjectParamCategory)itparam.value().toObject().value("category").toInt();
project_parameter.value = itparam.value().toObject().value("value").toVariant();
setProjectParam(project_parameter);
itparam++;
}
}
pappso::ProjectParameters::setProjectParam
void setProjectParam(const ProjectParam &param)
Definition projectparameters.cpp:246
pappso::ProjectParamCategory
ProjectParamCategory
Definition projectparameters.h:44
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

References pappso::ProjectParam::category, pappso::ProjectParam::name, setProjectParam(), and pappso::ProjectParam::value.

## ProjectParameters() [3/3]

pappso::ProjectParameters::ProjectParameters | ( | const ProjectParameters & | other | ) |

Copy constructor

Parameters

  other | TODO

Definition at line 62 of file projectparameters.cpp.

{
m_mapGeneralParameters = other.m_mapGeneralParameters;
m_mapFilterParameters = other.m_mapFilterParameters;
m_mapIdentificationParameters = other.m_mapIdentificationParameters;
m_mapQuantificationParameters = other.m_mapQuantificationParameters;
m_mapInstrumentParameters = other.m_mapInstrumentParameters;
}
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::m_mapGeneralParameters
std::map< QString, ProjectParam > m_mapGeneralParameters
Definition projectparameters.h:115
pappso::ProjectParameters::m_mapFilterParameters
std::map< QString, ProjectParam > m_mapFilterParameters
Definition projectparameters.h:117
pappso::ProjectParameters::m_mapInstrumentParameters
std::map< QString, ProjectParam > m_mapInstrumentParameters
Definition projectparameters.h:119

References ProjectParameters(), m_mapFilterParameters, m_mapGeneralParameters, m_mapIdentificationParameters, m_mapInstrumentParameters, and m_mapQuantificationParameters.

## ~ProjectParameters()

pappso::ProjectParameters::~ProjectParameters | ( |  | ) |

Destructor

Definition at line 71 of file projectparameters.cpp.

{
}

## Member Function Documentation

## getProjectParamListByCategory()

std::vector< pappso::ProjectParam > pappso::ProjectParameters::getProjectParamListByCategory | ( | ProjectParamCategory | category | ) | const

Definition at line 347 of file projectparameters.cpp.

{
std::vector<ProjectParam> param_list;
const std::map<QString, ProjectParam> *map_pointer = nullptr;
switch(category)
{
case ProjectParamCategory::general:
map_pointer = &m_mapGeneralParameters;
break;
case ProjectParamCategory::instrument:
map_pointer = &m_mapInstrumentParameters;
break;
case ProjectParamCategory::filter:
map_pointer = &m_mapFilterParameters;
break;
case ProjectParamCategory::identification:
map_pointer = &m_mapIdentificationParameters;
break;
case ProjectParamCategory::quantification:
map_pointer = &m_mapQuantificationParameters;
break;
default:
map_pointer = &m_mapGeneralParameters;
break;
}
for(auto pair_item : *map_pointer)
{
param_list.push_back(pair_item.second);
}
return param_list;
}
pappso::ProjectParamCategory::identification
@ identification
concerning identification
Definition projectparameters.h:47
pappso::ProjectParamCategory::instrument
@ instrument
information about instrument
Definition projectparameters.h:50
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

References pappso::filter, pappso::general, pappso::identification, pappso::instrument, m_mapFilterParameters, m_mapGeneralParameters, m_mapIdentificationParameters, m_mapInstrumentParameters, m_mapQuantificationParameters, and pappso::quantification.

## getValue()

const QVariant pappso::ProjectParameters::getValue | ( | ProjectParamCategory | category,
|  | const QString & | name ) const

Definition at line 307 of file projectparameters.cpp.

{
const std::map<QString, ProjectParam> *map_pointer = nullptr;
switch(category)
{
case ProjectParamCategory::general:
map_pointer = &m_mapGeneralParameters;
break;
case ProjectParamCategory::instrument:
map_pointer = &m_mapInstrumentParameters;
break;
case ProjectParamCategory::filter:
map_pointer = &m_mapFilterParameters;
break;
case ProjectParamCategory::identification:
map_pointer = &m_mapIdentificationParameters;
break;
case ProjectParamCategory::quantification:
map_pointer = &m_mapQuantificationParameters;
break;
default:
map_pointer = &m_mapGeneralParameters;
break;
}
auto it = map_pointer->find(name);
if(it != map_pointer->end())
{
return (it->second.value);
}
else
{
qDebug() << QObject::tr("project parameter named %1 in category %2 not found")
.arg(name)
.arg((std::int8_t)category);
}
return (QVariant());
}

References pappso::filter, pappso::general, pappso::identification, pappso::instrument, m_mapFilterParameters, m_mapGeneralParameters, m_mapIdentificationParameters, m_mapInstrumentParameters, m_mapQuantificationParameters, and pappso::quantification.

## merge()

void pappso::ProjectParameters::merge | ( | const ProjectParameters & | parameters | ) |

Definition at line 271 of file projectparameters.cpp.

{
for(auto key_value : parameters.m_mapGeneralParameters)
{
m_mapGeneralParameters[key_value.first] = key_value.second;
}
for(auto key_value : parameters.m_mapInstrumentParameters)
{
m_mapInstrumentParameters[key_value.first] = key_value.second;
}
for(auto key_value : parameters.m_mapFilterParameters)
{
m_mapFilterParameters[key_value.first] = key_value.second;
}
for(auto key_value : parameters.m_mapIdentificationParameters)
{
m_mapIdentificationParameters[key_value.first] = key_value.second;
}
for(auto key_value : parameters.m_mapQuantificationParameters)
{
m_mapQuantificationParameters[key_value.first] = key_value.second;
}
}

References ProjectParameters(), m_mapFilterParameters, m_mapGeneralParameters, m_mapIdentificationParameters, m_mapInstrumentParameters, and m_mapQuantificationParameters.

## operator=()

pappso::ProjectParameters & pappso::ProjectParameters::operator= | ( | const ProjectParameters & | other | ) |

Definition at line 76 of file projectparameters.cpp.

{
m_mapGeneralParameters = other.m_mapGeneralParameters;
m_mapFilterParameters = other.m_mapFilterParameters;
m_mapIdentificationParameters = other.m_mapIdentificationParameters;
m_mapQuantificationParameters = other.m_mapQuantificationParameters;
m_mapInstrumentParameters = other.m_mapInstrumentParameters;
return *this;
}

References ProjectParameters(), m_mapFilterParameters, m_mapGeneralParameters, m_mapIdentificationParameters, m_mapInstrumentParameters, and m_mapQuantificationParameters.

## setProjectParam()

void pappso::ProjectParameters::setProjectParam | ( | const ProjectParam & | param | ) |

Definition at line 246 of file projectparameters.cpp.

{
switch(param.category)
{
case ProjectParamCategory::general:
m_mapGeneralParameters[param.name] = param;
break;
case ProjectParamCategory::instrument:
m_mapInstrumentParameters[param.name] = param;
break;
case ProjectParamCategory::filter:
m_mapFilterParameters[param.name] = param;
break;
case ProjectParamCategory::identification:
m_mapIdentificationParameters[param.name] = param;
break;
case ProjectParamCategory::quantification:
m_mapQuantificationParameters[param.name] = param;
break;
default:
break;
}
}

References pappso::ProjectParam::category, pappso::filter, pappso::general, pappso::identification, pappso::instrument, m_mapFilterParameters, m_mapGeneralParameters, m_mapIdentificationParameters, m_mapInstrumentParameters, m_mapQuantificationParameters, pappso::ProjectParam::name, and pappso::quantification.

Referenced by ProjectParameters(), pappso::masschroq::AlignmentMethod::getProjectParameters(), and pappso::masschroq::QuantificationMethod::getProjectParameters().

## size()

std::size_t pappso::ProjectParameters::size | ( |  | ) | const

Definition at line 299 of file projectparameters.cpp.

{
return (m_mapGeneralParameters.size() + m_mapInstrumentParameters.size() +
m_mapFilterParameters.size() + m_mapIdentificationParameters.size() +
m_mapQuantificationParameters.size());
}

References m_mapFilterParameters, m_mapGeneralParameters, m_mapIdentificationParameters, m_mapInstrumentParameters, and m_mapQuantificationParameters.

## toJsonObject()

QJsonObject pappso::ProjectParameters::toJsonObject | ( |  | ) | const

Definition at line 382 of file projectparameters.cpp.

{
QJsonObject parameters;
for(auto param_entry : m_mapGeneralParameters)
{
parameters.insert(param_entry.first, param_entry.second.toJsonObject());
}
for(auto param_entry : m_mapInstrumentParameters)
{
parameters.insert(param_entry.first, param_entry.second.toJsonObject());
}
for(auto param_entry : m_mapIdentificationParameters)
{
parameters.insert(param_entry.first, param_entry.second.toJsonObject());
}
for(auto param_entry : m_mapFilterParameters)
{
parameters.insert(param_entry.first, param_entry.second.toJsonObject());
}
for(auto param_entry : m_mapQuantificationParameters)
{
parameters.insert(param_entry.first, param_entry.second.toJsonObject());
}
return parameters;
}

References m_mapFilterParameters, m_mapGeneralParameters, m_mapIdentificationParameters, m_mapInstrumentParameters, and m_mapQuantificationParameters.

Referenced by writeParameters().

## writeCellVariant()

void pappso::ProjectParameters::writeCellVariant | ( | CalcWriterInterface & | writer,
|  | const QVariant & | var ) const

private

Definition at line 90 of file projectparameters.cpp.

{
int type = var.metaType().id();
switch(type)
{
case QMetaType::Void:
writer.writeEmptyCell();
break;
case QMetaType::Bool:
writer.writeCell(var.toBool());
break;
case QMetaType::Double:
case QMetaType::Float:
writer.writeCell(var.toDouble());
break;
case QMetaType::Int:
writer.writeCell(var.toInt());
break;
case QMetaType::QDate:
writer.writeCell(var.toDate());
break;
case QMetaType::QDateTime:
writer.writeCell(var.toDateTime());
break;
case QMetaType::QString:
writer.writeCell(var.toString());
break;
case QMetaType::QUrl:
writer.writeCell(var.toUrl(), var.toUrl().toString());
break;
default:
writer.writeCell(var.toString());
}
}

Referenced by writeParameters().

## writeParameters() [1/3]

void pappso::ProjectParameters::writeParameters | ( | CalcWriterInterface & | writer | ) | const

Definition at line 208 of file projectparameters.cpp.

{
writer.writeSheet("Project parameters");
for(auto param_entry : m_mapGeneralParameters)
{
writer.writeCell(param_entry.second.name);
writeCellVariant(writer, param_entry.second.value);
writer.writeLine();
}
for(auto param_entry : m_mapInstrumentParameters)
{
writer.writeCell(param_entry.second.name);
writeCellVariant(writer, param_entry.second.value);
writer.writeLine();
}
for(auto param_entry : m_mapIdentificationParameters)
{
writer.writeCell(param_entry.second.name);
writeCellVariant(writer, param_entry.second.value);
writer.writeLine();
}
for(auto param_entry : m_mapFilterParameters)
{
writer.writeCell(param_entry.second.name);
writeCellVariant(writer, param_entry.second.value);
writer.writeLine();
}
for(auto param_entry : m_mapQuantificationParameters)
{
writer.writeCell(param_entry.second.name);
writeCellVariant(writer, param_entry.second.value);
writer.writeLine();
}
}
pappso::ProjectParameters::writeCellVariant
void writeCellVariant(CalcWriterInterface &writer, const QVariant &var) const
Definition projectparameters.cpp:90

References m_mapFilterParameters, m_mapGeneralParameters, m_mapIdentificationParameters, m_mapInstrumentParameters, m_mapQuantificationParameters, and writeCellVariant().

Referenced by pappso::masschroq::CborOutputStream::writeProjectParameters().

## writeParameters() [2/3]

void pappso::ProjectParameters::writeParameters | ( | QCborStreamWriter & | cbor_writer | ) | const

Definition at line 455 of file projectparameters.cpp.

{
cbor_writer.append("project_parameters");
QCborValue::fromJsonValue(toJsonObject()).toCbor(cbor_writer);
}
pappso::ProjectParameters::toJsonObject
QJsonObject toJsonObject() const
Definition projectparameters.cpp:382

References toJsonObject().

## writeParameters() [3/3]

void pappso::ProjectParameters::writeParameters | ( | QXmlStreamWriter & | xml_writer | ) | const

Definition at line 139 of file projectparameters.cpp.

{
for(auto param_entry : m_mapGeneralParameters)
{
writeXmlParameter(xml_writer, param_entry.second);
}
for(auto param_entry : m_mapInstrumentParameters)
{
writeXmlParameter(xml_writer, param_entry.second);
}
for(auto param_entry : m_mapIdentificationParameters)
{
writeXmlParameter(xml_writer, param_entry.second);
}
for(auto param_entry : m_mapFilterParameters)
{
writeXmlParameter(xml_writer, param_entry.second);
}
for(auto param_entry : m_mapQuantificationParameters)
{
writeXmlParameter(xml_writer, param_entry.second);
}
}
pappso::ProjectParameters::writeXmlParameter
void writeXmlParameter(QXmlStreamWriter &writer, const ProjectParam &param) const
Definition projectparameters.cpp:126

References m_mapFilterParameters, m_mapGeneralParameters, m_mapIdentificationParameters, m_mapInstrumentParameters, m_mapQuantificationParameters, and writeXmlParameter().

## writeXmlParameter()

void pappso::ProjectParameters::writeXmlParameter | ( | QXmlStreamWriter & | writer,
|  | const ProjectParam & | param ) const

private

Definition at line 126 of file projectparameters.cpp.

{
writer.writeStartElement("project_param");
writer.writeAttribute("category", QString("%1").arg((std::uint8_t)param.category));
writer.writeAttribute("name", param.name);
writeXmlVariant(writer, param.value);
writer.writeEndElement();
}
pappso::ProjectParameters::writeXmlVariant
void writeXmlVariant(QXmlStreamWriter &writer, const QVariant &var) const
Definition projectparameters.cpp:167

References pappso::ProjectParam::category, pappso::ProjectParam::name, pappso::ProjectParam::value, and writeXmlVariant().

Referenced by writeParameters().

## writeXmlVariant()

void pappso::ProjectParameters::writeXmlVariant | ( | QXmlStreamWriter & | writer,
|  | const QVariant & | var ) const

private

Definition at line 167 of file projectparameters.cpp.

{
int type = var.metaType().id();
QString value;
switch(type)
{
case QMetaType::Void:
value = "";
break;
case QMetaType::Bool:
value = "false";
if(var.toBool())
value = "true";
break;
case QMetaType::Double:
case QMetaType::Float:
value = QString::number(var.toDouble(), 'g', 10);
break;
case QMetaType::Int:
value = QString::number(var.toInt());
break;
case QMetaType::QDate:
value = var.toDate().toString(Qt::ISODate);
break;
case QMetaType::QDateTime:
value = var.toDateTime().toString(Qt::ISODate);
break;
case QMetaType::QString:
value = var.toString();
break;
case QMetaType::QUrl:
value = var.toUrl().toString();
break;
default:
value = var.toString();
}
writer.writeAttribute("value", value);
}

Referenced by writeXmlParameter().

## Member Data Documentation

## m_mapFilterParameters

std::map<QString, ProjectParam> pappso::ProjectParameters::m_mapFilterParameters

private

Definition at line 117 of file projectparameters.h.

Referenced by ProjectParameters(), getProjectParamListByCategory(), getValue(), merge(), operator=(), setProjectParam(), size(), toJsonObject(), writeParameters(), and writeParameters().

## m_mapGeneralParameters

std::map<QString, ProjectParam> pappso::ProjectParameters::m_mapGeneralParameters

private

Definition at line 115 of file projectparameters.h.

Referenced by ProjectParameters(), getProjectParamListByCategory(), getValue(), merge(), operator=(), setProjectParam(), size(), toJsonObject(), writeParameters(), and writeParameters().

## m_mapIdentificationParameters

std::map<QString, ProjectParam> pappso::ProjectParameters::m_mapIdentificationParameters

private

Definition at line 116 of file projectparameters.h.

Referenced by ProjectParameters(), getProjectParamListByCategory(), getValue(), merge(), operator=(), setProjectParam(), size(), toJsonObject(), writeParameters(), and writeParameters().

## m_mapInstrumentParameters

std::map<QString, ProjectParam> pappso::ProjectParameters::m_mapInstrumentParameters

private

Definition at line 119 of file projectparameters.h.

Referenced by ProjectParameters(), getProjectParamListByCategory(), getValue(), merge(), operator=(), setProjectParam(), size(), toJsonObject(), writeParameters(), and writeParameters().

## m_mapQuantificationParameters

std::map<QString, ProjectParam> pappso::ProjectParameters::m_mapQuantificationParameters

private

Definition at line 118 of file projectparameters.h.

Referenced by ProjectParameters(), getProjectParamListByCategory(), getValue(), merge(), operator=(), setProjectParam(), size(), toJsonObject(), writeParameters(), and writeParameters().

The documentation for this class was generated from the following files:

- pappsomspp/core/processing/project/projectparameters.h
- pappsomspp/core/processing/project/projectparameters.cpp