Skip to content
Snippets Groups Projects
Commit 8271f8f9 authored by Langella Olivier's avatar Langella Olivier
Browse files

wip: accept weak tandem parameter files

parent 69890826
No related branches found
No related tags found
No related merge requests found
......@@ -120,7 +120,7 @@ TandemParameters::setParamLabelValue(const QString &label, const QString &value)
if((label == "spectrum, parent monoisotopic mass error units") ||
(label == "spectrum, fragment monoisotopic mass error units"))
{
if((value != "Daltons") && (value != "ppm"))
if((value != "Da") && (value != "Daltons") && (value != "ppm"))
{
throw pappso::ExceptionNotPossible(
QObject::tr("%1 value must be Daltons or ppm (not %2)")
......@@ -168,7 +168,12 @@ TandemParameters::setParamLabelValue(const QString &label, const QString &value)
(label == "refine, maximum valid expectation value"))
{
bool ok;
value.toDouble(&ok);
QString value_bis = value.simplified();
if(value_bis.isEmpty())
{
value_bis = "0.0";
}
value_bis.toDouble(&ok);
if(!ok)
{ // not an integer
throw pappso::ExceptionNotPossible(
......
......@@ -140,7 +140,8 @@ EditTandemPresetDialog::doSelectDir()
catch(pappso::PappsoException &error)
{
QMessageBox::warning(
this, tr("Error :"),
this,
tr("Error :"),
tr("Error choosing preset directory : %1").arg(error.qwhat()));
}
}
......@@ -187,7 +188,8 @@ EditTandemPresetDialog::doLoad()
else
{
QMessageBox::warning(
this, tr("Error :"),
this,
tr("Error :"),
tr("%1 is not an X!Tandem parameter file")
.arg(p_tandem_preset_file->getAbsoluteFilePath()));
}
......@@ -897,19 +899,44 @@ EditTandemPresetDialog::populate()
//<note type="input" label="spectrum, use neutral loss window">yes</note>
ui->sunlw_yes_radio_button->setChecked(true);
ui->sunlw_no_radio_button->setChecked(false);
if(_tandem_params.getValue("spectrum, use neutral loss window") == "no")
{ // -1 for not found
try
{
if(_tandem_params.getValue("spectrum, use neutral loss window") ==
"no")
{ // -1 for not found
ui->sunlw_yes_radio_button->setChecked(false);
ui->sunlw_no_radio_button->setChecked(true);
}
}
catch(pappso::ExceptionNotFound &error)
{
ui->sunlw_yes_radio_button->setChecked(false);
ui->sunlw_no_radio_button->setChecked(true);
}
//<note type="input" label="spectrum, neutral loss mass">18.01057</note>
ui->snlm_edit->setText(
_tandem_params.getValue("spectrum, neutral loss mass"));
//<note type="input" label="spectrum, neutral loss window">0.02</note>
ui->snlw_edit->setText(
_tandem_params.getValue("spectrum, neutral loss window"));
try
{
//<note type="input" label="spectrum, neutral loss
// mass">18.01057</note>
ui->snlm_edit->setText(
_tandem_params.getValue("spectrum, neutral loss mass"));
}
catch(pappso::ExceptionNotFound &error)
{
ui->snlm_edit->setText("18.01057");
}
try
{
//<note type="input" label="spectrum, neutral loss window">0.02</note>
ui->snlw_edit->setText(
_tandem_params.getValue("spectrum, neutral loss window"));
}
catch(pappso::ExceptionNotFound &error)
{
ui->snlm_edit->setText("0.02");
}
//<note type="input" label="spectrum, use noise suppression">yes</note>
ui->suns_yes_radio_button->setChecked(true);
ui->suns_no_radio_button->setChecked(false);
......@@ -941,13 +968,22 @@ EditTandemPresetDialog::populate()
//<note type="input" label="spectrum, use contrast angle">no</note>
ui->suca_yes_radio_button->setChecked(true);
ui->suca_no_radio_button->setChecked(false);
if(_tandem_params.getValue("spectrum, use contrast angle") == "no")
{ // -1 for not found
try
{
if(_tandem_params.getValue("spectrum, use contrast angle") == "no")
{ // -1 for not found
ui->suca_yes_radio_button->setChecked(false);
ui->suca_no_radio_button->setChecked(true);
}
}
catch(pappso::ExceptionNotFound &error)
{
ui->suca_yes_radio_button->setChecked(false);
ui->suca_no_radio_button->setChecked(true);
}
//<note type="input" label="spectrum, threads">1</note>
ui->st_edit->setText(_tandem_params.getValue("spectrum, threads"));
......@@ -1290,7 +1326,8 @@ EditTandemPresetDialog::done(int r)
if(!_p_tandem_preset_file->exists())
{
QMessageBox::warning(
this, tr("Save parameters"),
this,
tr("Save parameters"),
tr("Parameters file does not exists.\nPlease save it before "
"pressing ok or cancel edition"));
return;
......@@ -1305,7 +1342,8 @@ EditTandemPresetDialog::done(int r)
else
{
QMessageBox::warning(
this, tr("Save parameters"),
this,
tr("Save parameters"),
tr("Parameters modified but not saved.\nPlease save it before "
"pressing ok or cancel edition"));
return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment