Commit 91b137cf authored by Langella Olivier's avatar Langella Olivier
Browse files

catch odsexception added

parent 6a17ffee
......@@ -51,8 +51,17 @@ MonitorComparOdsOutput::MonitorComparOdsOutput(const QString &ods_file)
MonitorComparOdsOutput::~MonitorComparOdsOutput()
{
qDebug() << "MonitorComparOdsOutput::~MonitorComparOdsOutput begin";
_p_writer->close();
try
{
_p_writer->close();
}
catch(OdsException &error)
{
throw mcqError(
QObject::tr(
"Error in MonitorComparOdsOutput::~MonitorComparOdsOutput :\n%1")
.arg(error.qwhat()));
}
}
MonitorComparInterfaceOutput::MonitorComparInterfaceOutput()
......@@ -208,57 +217,70 @@ MonitorComparInterfaceOutput::privWriteMatchedPeak(
const QuantiItemBase *p_quanti_item,
const AlignedXicPeak *peak)
{
if(peak != nullptr)
try
{
// store aligned peak in a table
// rows are quanti items
// columns are MSruns
//_compar_table[p_quanti_item][p_msrun] = peak->getArea();
std::map<const Msrun *, pappso::pappso_double> *p_msrun_value = nullptr;
std::pair<
std::map<const QuantiItemBase *,
std::map<const Msrun *, pappso::pappso_double>>::iterator,
bool>
pair_insert_qitem = _compar_table.insert(
std::pair<const QuantiItemBase *,
std::map<const Msrun *, pappso::pappso_double>>(
p_quanti_item, std::map<const Msrun *, pappso::pappso_double>()));
if(pair_insert_qitem.second == true)
if(peak != nullptr)
{
// new qitem
_qitem_list.push_back(p_quanti_item);
}
else
{
// existing qitem
}
// store aligned peak in a table
// rows are quanti items
// columns are MSruns
//_compar_table[p_quanti_item][p_msrun] = peak->getArea();
std::map<const Msrun *, pappso::pappso_double> *p_msrun_value =
nullptr;
std::pair<
std::map<const QuantiItemBase *,
std::map<const Msrun *, pappso::pappso_double>>::iterator,
bool>
pair_insert_qitem = _compar_table.insert(
std::pair<const QuantiItemBase *,
std::map<const Msrun *, pappso::pappso_double>>(
p_quanti_item,
std::map<const Msrun *, pappso::pappso_double>()));
if(pair_insert_qitem.second == true)
{
// new qitem
_qitem_list.push_back(p_quanti_item);
}
else
{
// existing qitem
}
p_msrun_value = &pair_insert_qitem.first->second;
std::pair<std::map<const Msrun *, pappso::pappso_double>::iterator, bool>
pair_insert_msrun =
p_msrun_value->insert(std::pair<const Msrun *, pappso::pappso_double>(
p_msrun, peak->getArea()));
if(pair_insert_msrun.second == true)
{
// new msrun
if(std::find(_msrun_list.begin(), _msrun_list.end(), p_msrun) ==
_msrun_list.end())
p_msrun_value = &pair_insert_qitem.first->second;
std::pair<std::map<const Msrun *, pappso::pappso_double>::iterator,
bool>
pair_insert_msrun = p_msrun_value->insert(
std::pair<const Msrun *, pappso::pappso_double>(p_msrun,
peak->getArea()));
if(pair_insert_msrun.second == true)
{
_msrun_list.push_back(p_msrun);
// new msrun
if(std::find(_msrun_list.begin(), _msrun_list.end(), p_msrun) ==
_msrun_list.end())
{
_msrun_list.push_back(p_msrun);
}
}
else
{
// existing msrun
// this means that we have more than one area value for a single
// mcq item : potential problem we decide to store only the last
// value
qDebug() << "MonitorComparInterfaceOutput::privWriteMatchedPeak "
"multiple "
"value for qitem:"
<< p_quanti_item->getQuantiItemId()
<< " msrun:" << p_msrun->getMsRunIdCstSPtr()->getXmlId();
pair_insert_msrun.first->second = peak->getArea();
}
}
else
{
// existing msrun
// this means that we have more than one area value for a single mcq
// item : potential problem we decide to store only the last value
qDebug()
<< "MonitorComparInterfaceOutput::privWriteMatchedPeak multiple "
"value for qitem:"
<< p_quanti_item->getQuantiItemId()
<< " msrun:" << p_msrun->getMsRunIdCstSPtr()->getXmlId();
pair_insert_msrun.first->second = peak->getArea();
}
}
catch(OdsException &error)
{
throw mcqError(
QObject::tr(
"Error in MonitorComparInterfaceOutput::privWriteMatchedPeak :\n%1")
.arg(error.qwhat()));
}
}
......@@ -244,23 +244,32 @@ MonitorOdsInterfaceOutput::privWriteMatchedPeak(
const QuantiItemBase *p_quanti_item,
const AlignedXicPeak *peak)
{
if(peak != nullptr)
try
{
_p_writer->writeLine();
_p_writer->writeCell(_current_quantification_id);
_p_writer->writeCell(_current_group_id);
_p_writer->writeCell(p_msrun->getMsRunIdCstSPtr()->getXmlId());
_p_writer->writeCell(
QFileInfo(p_msrun->getMsRunIdCstSPtr()->getFileName()).baseName());
_p_writer->writeCell(p_quanti_item->getMz());
_p_writer->writeCell(peak->getMaxXicElement().x);
_p_writer->writeCell(peak->getMaxXicElement().y);
if(peak != nullptr)
{
_p_writer->writeLine();
_p_writer->writeCell(_current_quantification_id);
_p_writer->writeCell(_current_group_id);
_p_writer->writeCell(p_msrun->getMsRunIdCstSPtr()->getXmlId());
_p_writer->writeCell(
QFileInfo(p_msrun->getMsRunIdCstSPtr()->getFileName()).baseName());
_p_writer->writeCell(p_quanti_item->getMz());
_p_writer->writeCell(peak->getMaxXicElement().x);
_p_writer->writeCell(peak->getMaxXicElement().y);
_p_writer->writeCell(peak->getArea());
_p_writer->writeCell(peak->getLeftBoundary().x);
_p_writer->writeCell(peak->getRightBoundary().x);
_p_writer->writeCell(peak->getArea());
_p_writer->writeCell(peak->getLeftBoundary().x);
_p_writer->writeCell(peak->getRightBoundary().x);
p_quanti_item->writeOdsPeptideLine(*_p_writer);
p_quanti_item->writeOdsPeptideLine(*_p_writer);
}
}
catch(OdsException &error)
{
throw mcqError(
QObject::tr(
"Error in MonitorOdsInterfaceOutput::privWriteMatchedPeak :\n%1")
.arg(error.qwhat()));
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment