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

wip: tandem preset edition

parent a90fa3d4
No related branches found
No related tags found
No related merge requests found
......@@ -50,6 +50,25 @@ TandemParameters::TandemParameters(const TandemParameters & other) {
}
qDebug() << "TandemParameters::TandemParameters copy end";
}
bool TandemParameters::equals(const TandemParameters & other) const {
if (_method_name != other._method_name) {
return false;
}
if (_map_label_value.size() != other._map_label_value.size()) {
return false;
}
QMap<QString, QString>::const_iterator i = _map_label_value.constBegin();
while (i != _map_label_value.constEnd()) {
if(i.value() != other.getValue(i.key())) {
return false;
}
i++; // added
}
return true;
}
const QString TandemParameters::getLabelCategory(const QString & value) const {
return value.split(", ").at(0);
}
......@@ -71,7 +90,7 @@ void TandemParameters::setParamLabelValue(const QString & label, const QString &
return;
}
if (label == "spectrum, parent monoisotopic mass error units") {
if ((label == "spectrum, parent monoisotopic mass error units") || (label == "spectrum, fragment monoisotopic mass error units")) {
if ((value != "Daltons") && (value != "ppm")) {
throw pappso::ExceptionNotPossible(QObject::tr("%1 value must be Daltons or ppm (not %2)").arg(label).arg(value));
}
......@@ -88,6 +107,20 @@ void TandemParameters::setParamLabelValue(const QString & label, const QString &
throw pappso::ExceptionNotPossible(QObject::tr("%1 value must be a number (not %2)").arg(label).arg(value));
}
}
if ((label == "spectrum, maximum parent charge")) {
bool ok;
value.toInt(&ok);
if (!ok) {// not an integer
throw pappso::ExceptionNotPossible(QObject::tr("%1 value must be an integer (not %2)").arg(label).arg(value));
}
}
if (label == "spectrum, fragment mass type") {
if ((value != "monoisotopic") && (value != "average")) {
throw pappso::ExceptionNotPossible(QObject::tr("%1 value must be monoisotopic or average (not %2)").arg(label).arg(value));
}
}
_map_label_value.insert(label, value);
}
......
......@@ -45,6 +45,7 @@ public:
const QString & getMethodName() const;
void setParamLabelValue(const QString & label, const QString & value);
const QMap<QString, QString> & getMapLabelValue() const;
bool equals(const TandemParameters & other) const;
private:
const QString getLabelCategory(const QString & value) const;
private:
......
......@@ -131,14 +131,45 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>971</width>
<height>198</height>
<y>-94</y>
<width>957</width>
<height>292</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="5" column="1">
<widget class="QComboBox" name="sfmt_combo_box">
<property name="enabled">
<bool>false</bool>
</property>
<item>
<property name="text">
<string>average</string>
</property>
</item>
<item>
<property name="text">
<string>monoisotopic</string>
</property>
</item>
</widget>
</item>
<item row="6" column="2">
<widget class="QPushButton" name="sfmmeu_push_button">
<property name="text">
<string>?</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QPushButton" name="sfmt_push_button">
<property name="text">
<string>?</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="parent_ion_window_unit_combo_box">
<item>
......@@ -177,7 +208,7 @@
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="parent_ion_upper_window_push_button">
<widget class="QPushButton" name="spmmep_push_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -190,7 +221,7 @@
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="parent_ion_lower_window_push_button">
<widget class="QPushButton" name="spmmem_push_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -202,6 +233,20 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="anticipate_carbon_combo_box">
<item>
<property name="text">
<string>yes</string>
</property>
</item>
<item>
<property name="text">
<string>no</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
......@@ -210,7 +255,7 @@
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="anticipate_carbon_push_button">
<widget class="QPushButton" name="spmmie_push_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -222,20 +267,6 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="anticipate_carbon_combo_box">
<item>
<property name="text">
<string>yes</string>
</property>
</item>
<item>
<property name="text">
<string>no</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
......@@ -256,6 +287,68 @@
<item row="2" column="1">
<widget class="QLineEdit" name="parent_ion_upper_window_edit"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Use chemical average or monoisotopic mass for fragment ions</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="smpc_label">
<property name="text">
<string>Set the maximum precursor charge to be scored</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="sfmmeu_combo_box">
<item>
<property name="text">
<string>Daltons</string>
</property>
</item>
<item>
<property name="text">
<string>ppm</string>
</property>
</item>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Units for fragment ion mass tolerance (monoisotopic)</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="smpc_edit"/>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="smpc_push_button">
<property name="text">
<string>?</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QPushButton" name="sfmme_push_button">
<property name="text">
<string>?</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLineEdit" name="sfmme_edit"/>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Fragment ion mass tolerance (monoisotopic)</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
......@@ -292,8 +385,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>72</height>
<width>971</width>
<height>198</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
......@@ -400,8 +493,8 @@
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>1338</x>
<y>654</y>
<x>1343</x>
<y>620</y>
</hint>
<hint type="destinationlabel">
<x>881</x>
......@@ -417,7 +510,7 @@
<hints>
<hint type="sourcelabel">
<x>1429</x>
<y>654</y>
<y>620</y>
</hint>
<hint type="destinationlabel">
<x>879</x>
......@@ -432,8 +525,8 @@
<slot>doHelp()</slot>
<hints>
<hint type="sourcelabel">
<x>1086</x>
<y>307</y>
<x>976</x>
<y>242</y>
</hint>
<hint type="destinationlabel">
<x>1728</x>
......@@ -448,8 +541,8 @@
<slot>doSave()</slot>
<hints>
<hint type="sourcelabel">
<x>1134</x>
<y>175</y>
<x>1011</x>
<y>249</y>
</hint>
<hint type="destinationlabel">
<x>1542</x>
......@@ -458,14 +551,14 @@
</hints>
</connection>
<connection>
<sender>parent_ion_lower_window_push_button</sender>
<sender>spmmem_push_button</sender>
<signal>clicked()</signal>
<receiver>EditTandemPresetView</receiver>
<slot>doHelp()</slot>
<hints>
<hint type="sourcelabel">
<x>1102</x>
<y>368</y>
<x>976</x>
<y>276</y>
</hint>
<hint type="destinationlabel">
<x>720</x>
......@@ -474,14 +567,14 @@
</hints>
</connection>
<connection>
<sender>parent_ion_upper_window_push_button</sender>
<sender>spmmep_push_button</sender>
<signal>clicked()</signal>
<receiver>EditTandemPresetView</receiver>
<slot>doHelp()</slot>
<hints>
<hint type="sourcelabel">
<x>1112</x>
<y>434</y>
<x>976</x>
<y>310</y>
</hint>
<hint type="destinationlabel">
<x>1181</x>
......@@ -490,14 +583,14 @@
</hints>
</connection>
<connection>
<sender>anticipate_carbon_push_button</sender>
<sender>spmmie_push_button</sender>
<signal>clicked()</signal>
<receiver>EditTandemPresetView</receiver>
<slot>doHelp()</slot>
<hints>
<hint type="sourcelabel">
<x>1091</x>
<y>494</y>
<x>976</x>
<y>344</y>
</hint>
<hint type="destinationlabel">
<x>1037</x>
......@@ -512,8 +605,8 @@
<slot>doCopy()</slot>
<hints>
<hint type="sourcelabel">
<x>1017</x>
<y>186</y>
<x>925</x>
<y>249</y>
</hint>
<hint type="destinationlabel">
<x>707</x>
......@@ -528,8 +621,8 @@
<slot>doEdit(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>939</x>
<y>319</y>
<x>890</x>
<y>242</y>
</hint>
<hint type="destinationlabel">
<x>400</x>
......@@ -544,8 +637,8 @@
<slot>doEdit(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>846</x>
<y>363</y>
<x>889</x>
<y>269</y>
</hint>
<hint type="destinationlabel">
<x>464</x>
......@@ -560,8 +653,8 @@
<slot>doEdit(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>932</x>
<y>435</y>
<x>890</x>
<y>310</y>
</hint>
<hint type="destinationlabel">
<x>798</x>
......@@ -576,8 +669,8 @@
<slot>doEdit(QString)</slot>
<hints>
<hint type="sourcelabel">
<x>980</x>
<y>477</y>
<x>890</x>
<y>344</y>
</hint>
<hint type="destinationlabel">
<x>970</x>
......@@ -592,8 +685,8 @@
<slot>doLoad()</slot>
<hints>
<hint type="sourcelabel">
<x>1154</x>
<y>84</y>
<x>1313</x>
<y>136</y>
</hint>
<hint type="destinationlabel">
<x>1737</x>
......@@ -608,8 +701,8 @@
<slot>doSelectDir()</slot>
<hints>
<hint type="sourcelabel">
<x>1273</x>
<y>87</y>
<x>1430</x>
<y>136</y>
</hint>
<hint type="destinationlabel">
<x>1796</x>
......@@ -617,6 +710,70 @@
</hint>
</hints>
</connection>
<connection>
<sender>smpc_push_button</sender>
<signal>clicked()</signal>
<receiver>EditTandemPresetView</receiver>
<slot>doHelp()</slot>
<hints>
<hint type="sourcelabel">
<x>940</x>
<y>366</y>
</hint>
<hint type="destinationlabel">
<x>1209</x>
<y>602</y>
</hint>
</hints>
</connection>
<connection>
<sender>sfmt_push_button</sender>
<signal>clicked()</signal>
<receiver>EditTandemPresetView</receiver>
<slot>doHelp()</slot>
<hints>
<hint type="sourcelabel">
<x>917</x>
<y>400</y>
</hint>
<hint type="destinationlabel">
<x>1247</x>
<y>529</y>
</hint>
</hints>
</connection>
<connection>
<sender>sfmmeu_push_button</sender>
<signal>clicked()</signal>
<receiver>EditTandemPresetView</receiver>
<slot>doHelp()</slot>
<hints>
<hint type="sourcelabel">
<x>909</x>
<y>432</y>
</hint>
<hint type="destinationlabel">
<x>1142</x>
<y>571</y>
</hint>
</hints>
</connection>
<connection>
<sender>sfmme_push_button</sender>
<signal>clicked()</signal>
<receiver>EditTandemPresetView</receiver>
<slot>doHelp()</slot>
<hints>
<hint type="sourcelabel">
<x>944</x>
<y>469</y>
</hint>
<hint type="destinationlabel">
<x>1322</x>
<y>578</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>doCopy()</slot>
......
......@@ -172,20 +172,50 @@ void EditTandemPresetDialog::doHelp() {
QObject *senderObj = sender();
QString senderObjName = senderObj->objectName();
qDebug() << "EditTandemPresetDialog::doHelp begin " << senderObjName;
QFile html_doc;
if(senderObjName == "parent_ion_window_unit_push_button")
{
//spmmeu.html
html_doc.setFileName(":/tandem/resources/html_doc/spmmeu.html");
}
if(senderObjName == "smpc_push_button")
{
//spmmeu.html
html_doc.setFileName(":/tandem/resources/html_doc/smpc.html");
}
if(senderObjName == "spmmem_push_button")
{
html_doc.setFileName(":/tandem/resources/html_doc/spmmem.html");
}
if(senderObjName == "spmmep_push_button")
{
html_doc.setFileName(":/tandem/resources/html_doc/spmmep.html");
}
if(senderObjName == "spmmie_push_button")
{
html_doc.setFileName(":/tandem/resources/html_doc/spmmie.html");
}
if(senderObjName == "sfmt_push_button")
{
html_doc.setFileName(":/tandem/resources/html_doc/sfmt.html");
}
if(senderObjName == "sfmmeu_push_button")
{
html_doc.setFileName(":/tandem/resources/html_doc/sfmmeu.html");
}
if(senderObjName == "sfmme_push_button")
{
html_doc.setFileName(":/tandem/resources/html_doc/sfmme.html");
}
QFile html_doc(":/tandem/resources/html_doc/spmmeu.html");
if (html_doc.open(QFile::ReadOnly | QFile::Text)) {
QTextStream in(&html_doc);
ui->doc_plain_text_edit->setHtml(in.readAll());
qDebug() << "EditTandemPresetDialog::doHelp doc " << in.readAll();
}
else {
qDebug() << "EditTandemPresetDialog::doHelp doc not found";
}
if (html_doc.open(QFile::ReadOnly | QFile::Text)) {
QTextStream in(&html_doc);
ui->doc_plain_text_edit->setHtml(in.readAll());
qDebug() << "EditTandemPresetDialog::doHelp doc " << in.readAll();
}
else {
qDebug() << "EditTandemPresetDialog::doHelp doc not found";
}
qDebug() << "EditTandemPresetDialog::doHelp end " << senderObjName;
}
......@@ -201,6 +231,12 @@ void EditTandemPresetDialog::readUi() {
_tandem_params.setParamLabelValue("spectrum, parent monoisotopic mass isotope error", ui->anticipate_carbon_combo_box->currentText());
_tandem_params.setParamLabelValue("spectrum, maximum parent charge", ui->smpc_edit->text());
_tandem_params.setParamLabelValue("spectrum, fragment mass type", ui->sfmt_combo_box->currentText());
_tandem_params.setParamLabelValue("spectrum, fragment monoisotopic mass error units", ui->sfmmeu_combo_box->currentText());
_tandem_params.setParamLabelValue("spectrum, fragment monoisotopic mass error", ui->sfmme_edit->text());
}
catch (pappso::PappsoException & error) {
QMessageBox::warning(this,tr("Error in parameters :"), error.qwhat());
......@@ -229,5 +265,21 @@ void EditTandemPresetDialog::populate() {
if ( index != -1 ) { // -1 for not found
ui->anticipate_carbon_combo_box->setCurrentIndex(index);
}
//<note type="input" label="spectrum, maximum parent charge">4</note>
ui->smpc_edit->setText(_tandem_params.getValue("spectrum, maximum parent charge"));
//<note type="input" label="spectrum, fragment mass type">monoisotopic</note>
index = ui->sfmt_combo_box->findText("monoisotopic");
if ( index != -1 ) { // -1 for not found
ui->sfmt_combo_box->setCurrentIndex(index);
}
//<note type="input" label="spectrum, fragment monoisotopic mass error units">Daltons</note>
index = ui->sfmmeu_combo_box->findText(_tandem_params.getValue("spectrum, fragment monoisotopic mass error units"));
if ( index != -1 ) { // -1 for not found
ui->sfmmeu_combo_box->setCurrentIndex(index);
}
//<note type="input" label="spectrum, fragment monoisotopic mass error">0.02</note>
ui->sfmme_edit->setText(_tandem_params.getValue("spectrum, fragment monoisotopic mass error"));
qDebug() << "EditTandemPresetDialog::populate end";
}
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