diff --git a/src/gui/edit/edit_alignment_param/masschroq_param_view.ui b/src/gui/edit/edit_alignment_param/masschroq_param_view.ui index f0a7e52ce0792d2777bbb83992fabc1227892a00..9822b3df4b5c50df1281b9062950c3a5cd66c5ce 100644 --- a/src/gui/edit/edit_alignment_param/masschroq_param_view.ui +++ b/src/gui/edit/edit_alignment_param/masschroq_param_view.ui @@ -15,19 +15,378 @@ </property> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> - <widget class="QLabel" name="label"> - <property name="font"> - <font> - <pointsize>20</pointsize> - </font> - </property> - <property name="text"> - <string>Work in Progress</string> + <widget class="QTabWidget" name="tabWidget"> + <property name="currentIndex"> + <number>0</number> </property> + <widget class="QWidget" name="sumary_tab"> + <attribute name="title"> + <string>&Group summary</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_5"> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>MS runs</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_6"> + <item> + <widget class="QListWidget" name="msruns_list"/> + </item> + <item> + <widget class="QGroupBox" name="groupBox_3"> + <property name="title"> + <string>MS run group reference</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QLineEdit" name="reference_line"> + <property name="placeholderText"> + <string>No reference selected</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pushButton"> + <property name="text"> + <string>Find best</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="alignment_tab"> + <property name="contextMenuPolicy"> + <enum>Qt::NoContextMenu</enum> + </property> + <attribute name="title"> + <string>&Alignments</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QGroupBox" name="time_correction_group"> + <property name="title"> + <string>Score time correction in director&y</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QLineEdit" name="time_line"> + <property name="inputMask"> + <string/> + </property> + <property name="text"> + <string/> + </property> + <property name="placeholderText"> + <string>times.d</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="ms2_alignment_group"> + <property name="title"> + <string>MS2 alignment parameters</string> + </property> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>MS2 tendency</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>MS2 smoothing</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>MS1 smoothing</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="ms2_tendency_spin"> + <property name="value"> + <number>10</number> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="ms2_smoothing_spin"> + <property name="value"> + <number>15</number> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QSpinBox" name="ms1_smoothing_spin"/> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>MsRun reference for alignment</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <widget class="QPushButton" name="best_ref_button"> + <property name="text"> + <string>Find best MS run reference for alignment</string> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="msruns_combo"/> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <widget class="QWidget" name="ms_run_tabs"> + <attribute name="title"> + <string>&Ms Runs</string> + </attribute> + </widget> + <widget class="QWidget" name="peak_quantification_tab"> + <attribute name="title"> + <string>&Peak Quantification</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_8"> + <item> + <widget class="QGroupBox" name="groupBox_4"> + <property name="title"> + <string>XIC extraction parameters</string> + </property> + <layout class="QFormLayout" name="formLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>XIC range</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Inside range, take the </string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="inside_range_combo"> + <item> + <property name="text"> + <string>max</string> + </property> + </item> + <item> + <property name="text"> + <string>sum</string> + </property> + </item> + </widget> + </item> + <item row="0" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QDoubleSpinBox" name="xic_range_spin"> + <property name="decimals"> + <number>4</number> + </property> + <property name="value"> + <double>10.000000000000000</double> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="xic_range_combo"> + <property name="currentText"> + <string>dalton</string> + </property> + <item> + <property name="text"> + <string>dalton</string> + </property> + </item> + <item> + <property name="text"> + <string>ppm</string> + </property> + </item> + <item> + <property name="text"> + <string>res</string> + </property> + </item> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_5"> + <property name="title"> + <string>Peak detection parameters</string> + </property> + <layout class="QFormLayout" name="formLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>smoothing</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QSpinBox" name="smoothing_spin"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>minmax half window</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>maxmin half window</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_9"> + <property name="text"> + <string>minmax threshold</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_10"> + <property name="text"> + <string>maxmin threshold</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QSpinBox" name="minmax_win_spin"/> + </item> + <item row="2" column="1"> + <widget class="QSpinBox" name="maxmin_win_spin"/> + </item> + <item row="3" column="1"> + <widget class="QSpinBox" name="minmax_thre_spin"/> + </item> + <item row="4" column="1"> + <widget class="QSpinBox" name="maxmin_thre_spin"/> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> </widget> </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="cancel_button"> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="run_button"> + <property name="text"> + <string>Ok</string> + </property> + </widget> + </item> + </layout> + </item> </layout> </widget> <resources/> - <connections/> + <connections> + <connection> + <sender>cancel_button</sender> + <signal>clicked()</signal> + <receiver>MassChroQParamView</receiver> + <slot>close()</slot> + <hints> + <hint type="sourcelabel"> + <x>386</x> + <y>508</y> + </hint> + <hint type="destinationlabel"> + <x>261</x> + <y>265</y> + </hint> + </hints> + </connection> + </connections> </ui> diff --git a/src/gui/edit/edit_alignment_param/masschroqparam.cpp b/src/gui/edit/edit_alignment_param/masschroqparam.cpp index 71d988069eb05c4c5cfa579a78324aea4c6cb19f..fc75bfbf3be27a5fd23c26c648f196fe2609a344 100644 --- a/src/gui/edit/edit_alignment_param/masschroqparam.cpp +++ b/src/gui/edit/edit_alignment_param/masschroqparam.cpp @@ -29,12 +29,23 @@ #include "../../src/gui/lists/ms_identification_run_list_view/msidentificationlistwindow.h" -MassChroQParamWindow::MassChroQParamWindow(MsIdentificationListWindow *parent) +MassChroQParamWindow::MassChroQParamWindow( + MsIdentificationListWindow *parent, MsRunAlignmentGroupSp alignment_group) : QWidget(), ui(new Ui::MassChroQParamView) { mp_identification_list_window = parent; + msp_alignment_group = alignment_group; ui->setupUi(this); - // msp_alignment_group = alignment_group; + foreach(MsRunSp ms_run, msp_alignment_group->getMsRunsInAlignmentGroup()) + { + QListWidgetItem *new_item = new QListWidgetItem(ms_run->getSampleName()); + ui->msruns_list->insertItem(0, new_item); + } + MsRunSp reference = msp_alignment_group->getMsRunReference(); + if(reference != nullptr) + { + ui->reference_line->setText(reference->getSampleName()); + } } diff --git a/src/gui/edit/edit_alignment_param/masschroqparam.h b/src/gui/edit/edit_alignment_param/masschroqparam.h index f390503f028d8b6b67a88d51fde58bac51f007d7..e349d2307ceb9c176d92f953a824a35379d6baa5 100644 --- a/src/gui/edit/edit_alignment_param/masschroqparam.h +++ b/src/gui/edit/edit_alignment_param/masschroqparam.h @@ -37,7 +37,8 @@ class MassChroQParamWindow : public QWidget Q_OBJECT public: - MassChroQParamWindow(MsIdentificationListWindow *parent); + MassChroQParamWindow(MsIdentificationListWindow *parent, + MsRunAlignmentGroupSp alignment_group); ~MassChroQParamWindow(); void setAlignmentGroup(MsRunAlignmentGroupSp alignment_group); diff --git a/src/gui/lists/ms_identification_run_list_view/msidentificationlistwindow.cpp b/src/gui/lists/ms_identification_run_list_view/msidentificationlistwindow.cpp index f7f2dd6da306ec7822d9b34b5d83bb6f2ea6c79e..3daf72d704ef8bbc75b183422bc436bde5662eaa 100644 --- a/src/gui/lists/ms_identification_run_list_view/msidentificationlistwindow.cpp +++ b/src/gui/lists/ms_identification_run_list_view/msidentificationlistwindow.cpp @@ -399,8 +399,7 @@ MsIdentificationListWindow::openMassChroQParametersView( qDebug(); if(mp_massChroQParamWindow == nullptr) { - mp_massChroQParamWindow = new MassChroQParamWindow(this); + mp_massChroQParamWindow = new MassChroQParamWindow(this, alignment_group); } - mp_massChroQParamWindow->setAlignmentGroup(alignment_group); mp_massChroQParamWindow->show(); } diff --git a/src/input/xtpxpipsaxhandler.cpp b/src/input/xtpxpipsaxhandler.cpp index 8af29186ee12dc321f560e47a376a4ada385dfb9..3c2dacf863ed8c56295cf1b67c12daaec29d04c7 100644 --- a/src/input/xtpxpipsaxhandler.cpp +++ b/src/input/xtpxpipsaxhandler.cpp @@ -141,6 +141,14 @@ XtpXpipSaxHandler::startElement(const QString &namespaceURI, { is_ok = startElement_msrun(attributes); } + else if(qName == "msrun_group") + { + is_ok = startElement_alignmentGroup(attributes); + } + else if(qName == "grouped_msrun") + { + is_ok = startElement_msrunInAlignmentGroup(attributes); + } else if(qName == "peptide") { if(_count_total % 100 == 0) @@ -574,6 +582,29 @@ XtpXpipSaxHandler::startElement_msrun(QXmlAttributes attributes) return true; } +bool +XtpXpipSaxHandler::startElement_alignmentGroup(QXmlAttributes attributes) +{ + msp_alignment_group = std::make_shared<MsRunAlignmentGroup>( + attributes.value("name").simplified()); + _p_project->addMsRunAlignmentGroupToList(msp_alignment_group); + QString reference_id = attributes.value("reference").simplified(); + if(reference_id != "") + { + msp_alignment_group->setMsRunReference(_map_msruns.at(reference_id)); + } + return true; +} + +bool +XtpXpipSaxHandler::startElement_msrunInAlignmentGroup(QXmlAttributes attributes) +{ + MsRunSp ms_run = _map_msruns.at(attributes.value("id").simplified()); + msp_alignment_group->addMsRunToMsRunAlignmentGroupList(ms_run); + ms_run->setAlignmentGroup(msp_alignment_group); + return true; +} + bool XtpXpipSaxHandler::startElement_peptide_evidence_list(QXmlAttributes attributes) { @@ -837,6 +868,13 @@ XtpXpipSaxHandler::endElement_msrun() return true; } +bool +XtpXpipSaxHandler::endElement_alignmentGroup() +{ + msp_alignment_group = nullptr; + return true; +} + bool XtpXpipSaxHandler::endElement_sequence() { diff --git a/src/input/xtpxpipsaxhandler.h b/src/input/xtpxpipsaxhandler.h index 29f8767953cd2be02758081304c1080004e956a7..4f12b05a2cfeb09d5f97679a68ae6e8c768b0698 100644 --- a/src/input/xtpxpipsaxhandler.h +++ b/src/input/xtpxpipsaxhandler.h @@ -47,10 +47,13 @@ class XtpXpipSaxHandler : public QXmlDefaultHandler XtpXpipSaxHandler(WorkMonitorInterface *p_monitor, Project *p_project); ~XtpXpipSaxHandler(); - bool startElement(const QString &namespaceURI, const QString &localName, - const QString &qName, const QXmlAttributes &attributes); + bool startElement(const QString &namespaceURI, + const QString &localName, + const QString &qName, + const QXmlAttributes &attributes); - bool endElement(const QString &namespaceURI, const QString &localName, + bool endElement(const QString &namespaceURI, + const QString &localName, const QString &qName); bool startDocument(); @@ -77,6 +80,8 @@ class XtpXpipSaxHandler : public QXmlDefaultHandler bool startElement_peptide_evidence_list(QXmlAttributes attributes); bool startElement_protein(QXmlAttributes attributes); bool startElement_msrun(QXmlAttributes attributes); + bool startElement_alignmentGroup(QXmlAttributes attributes); + bool startElement_msrunInAlignmentGroup(QXmlAttributes attributes); bool startElement_identification_source(QXmlAttributes attributes); bool startElement_identification_group(QXmlAttributes attributes); @@ -92,6 +97,7 @@ class XtpXpipSaxHandler : public QXmlDefaultHandler // bool endElement_identification(); bool endElement_sequence(); bool endElement_msrun(); + bool endElement_alignmentGroup(); bool endElement_protein(); bool endElement_peptide(); bool endElement_protein_match(); @@ -124,6 +130,7 @@ class XtpXpipSaxHandler : public QXmlDefaultHandler IdentificationDataSourceSp _sp_current_identification_source; LabelingMethodSp _sp_labeling_method; MsRunSp _sp_msrun; + MsRunAlignmentGroupSp msp_alignment_group; std::map<QString, PeptideXtpSp> _map_peptides; bool _is_xtpcpp_xpip = false; QString _current_id; diff --git a/src/output/xpip.cpp b/src/output/xpip.cpp index 28f01cd96c666bf9334a963d05d90dae644092e5..aae02636f11a5a18864636076b8c89880bbe0944 100644 --- a/src/output/xpip.cpp +++ b/src/output/xpip.cpp @@ -145,6 +145,8 @@ Xpip::write(ProjectSp sp_project) _output_stream->writeEndElement(); writeMsrunList(_sp_project.get()->getMsRunStore()); + writeMsrunAlignementGroupsList( + _sp_project.get()->getMsRunAlignmentGroupList()); writeIdentificationDataSourceList( _sp_project.get()->getIdentificationDataSourceStore()); @@ -360,6 +362,39 @@ Xpip::writeMsrunList(const MsRunStore &msrun_store) _output_stream->writeEndElement(); } +void +Xpip::writeMsrunAlignementGroupsList( + const std::vector<MsRunAlignmentGroupSp> alignment_groups) +{ + _output_stream->writeStartElement("msrun_alignment_group_list"); + for(const MsRunAlignmentGroupSp group : alignment_groups) + { + qDebug() << "AAAAAAAAAA"; + _output_stream->writeStartElement("msrun_group"); + _output_stream->writeAttribute("name", + group.get()->getMsRunAlignmentGroupName()); + MsRunSp reference = group.get()->getMsRunReference(); + if(reference != nullptr) + { + _output_stream->writeAttribute( + "reference", group.get()->getMsRunReference().get()->getXmlId()); + } + else + { + _output_stream->writeAttribute("reference", ""); + } + + for(const MsRunSp ms_run : group.get()->getMsRunsInAlignmentGroup()) + { + _output_stream->writeStartElement("grouped_msrun"); + _output_stream->writeAttribute("id", ms_run.get()->getXmlId()); + _output_stream->writeEndElement(); + } + _output_stream->writeEndElement(); + } + _output_stream->writeEndElement(); +} + void Xpip::writeFastaFileList(const FastaFileStore &fasta_store) { diff --git a/src/output/xpip.h b/src/output/xpip.h index e44d9afa7cc12789dc5bca695dedfeb04ebf2a33..cbd3f5e9bbac4f5be017a926baeb04f28b2e016c 100644 --- a/src/output/xpip.h +++ b/src/output/xpip.h @@ -51,6 +51,8 @@ class Xpip void writeCounts(); void writeMsrunList(const MsRunStore &msrun_store); + void writeMsrunAlignementGroupsList( + const std::vector<MsRunAlignmentGroupSp> alignment_groups); void writeIdentificationDataSourceList( const IdentificationDataSourceStore &ident_store); void writeFastaFileList(const FastaFileStore &fasta_store);