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

new controls on decoy and contaminant widgets

parent a2f9fbf0
No related branches found
No related tags found
No related merge requests found
...@@ -199,9 +199,9 @@ ...@@ -199,9 +199,9 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QPushButton" name="fdr_button"> <widget class="QPushButton" name="apply_fdr_button">
<property name="text"> <property name="text">
<string>OK</string> <string>apply</string>
</property> </property>
</widget> </widget>
</item> </item>
...@@ -376,22 +376,6 @@ ...@@ -376,22 +376,6 @@
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections> <connections>
<connection>
<sender>fdr_button</sender>
<signal>clicked()</signal>
<receiver>ProjectView</receiver>
<slot>doFdrChanged()</slot>
<hints>
<hint type="sourcelabel">
<x>448</x>
<y>219</y>
</hint>
<hint type="destinationlabel">
<x>484</x>
<y>334</y>
</hint>
</hints>
</connection>
<connection> <connection>
<sender>precision_unit_combobox</sender> <sender>precision_unit_combobox</sender>
<signal>currentIndexChanged(QString)</signal> <signal>currentIndexChanged(QString)</signal>
...@@ -399,8 +383,8 @@ ...@@ -399,8 +383,8 @@
<slot>doMassPrecisionUnitChanged(QString)</slot> <slot>doMassPrecisionUnitChanged(QString)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>119</x> <x>253</x>
<y>104</y> <y>113</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>489</x> <x>489</x>
...@@ -431,8 +415,8 @@ ...@@ -431,8 +415,8 @@
<slot>doFilterChanged()</slot> <slot>doFilterChanged()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>119</x> <x>131</x>
<y>104</y> <y>101</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>815</x> <x>815</x>
...@@ -447,8 +431,8 @@ ...@@ -447,8 +431,8 @@
<slot>doApplyFilter()</slot> <slot>doApplyFilter()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>119</x> <x>448</x>
<y>104</y> <y>136</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>689</x> <x>689</x>
...@@ -472,6 +456,22 @@ ...@@ -472,6 +456,22 @@
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>apply_fdr_button</sender>
<signal>clicked()</signal>
<receiver>ProjectView</receiver>
<slot>doApplyDecoy()</slot>
<hints>
<hint type="sourcelabel">
<x>424</x>
<y>201</y>
</hint>
<hint type="destinationlabel">
<x>682</x>
<y>284</y>
</hint>
</hints>
</connection>
</connections> </connections>
<slots> <slots>
<slot>doFdrChanged()</slot> <slot>doFdrChanged()</slot>
...@@ -481,5 +481,6 @@ ...@@ -481,5 +481,6 @@
<slot>doSelectContaminantSource()</slot> <slot>doSelectContaminantSource()</slot>
<slot>doFilterChanged()</slot> <slot>doFilterChanged()</slot>
<slot>doApplyFilter()</slot> <slot>doApplyFilter()</slot>
<slot>doApplyDecoy()</slot>
</slots> </slots>
</ui> </ui>
...@@ -126,22 +126,20 @@ ProjectWindow::ProjectWindow(MainWindow *parent) ...@@ -126,22 +126,20 @@ ProjectWindow::ProjectWindow(MainWindow *parent)
ProjectWindow::~ProjectWindow() ProjectWindow::~ProjectWindow()
{ {
qDebug() << "ProjectWindow::~ProjectWindow"; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
// if (_p_ms_data_file != nullptr) delete _p_ms_data_file; // if (_p_ms_data_file != nullptr) delete _p_ms_data_file;
_worker_thread.quit(); _worker_thread.quit();
_worker_thread.wait(); _worker_thread.wait();
qDebug() << "ProjectWindow::~ProjectWindow1"; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
delete ui; delete ui;
qDebug() << "ProjectWindow::~ProjectWindow2"; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
delete _p_fasta_str_li;
qDebug() << "ProjectWindow::~ProjectWindow3";
delete _p_edit_modifications; delete _p_edit_modifications;
qDebug() << "ProjectWindow::~ProjectWindow5"; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
delete _p_edit_label_methods; delete _p_edit_label_methods;
qDebug() << "ProjectWindow::~ProjectWindow6"; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
delete _p_waiting_message_dialog; delete _p_waiting_message_dialog;
qDebug() << "ProjectWindow::~ProjectWindow end"; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
} }
Project * Project *
...@@ -153,29 +151,29 @@ void ...@@ -153,29 +151,29 @@ void
ProjectWindow::setDefaultProteinListWindow( ProjectWindow::setDefaultProteinListWindow(
ProteinListWindow *p_protein_list_window) ProteinListWindow *p_protein_list_window)
{ {
qDebug() << "ProjectWindow::setDefaultProteinListWindow begin"; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
_p_current_protein_list_window = p_protein_list_window; _p_current_protein_list_window = p_protein_list_window;
qDebug() << "ProjectWindow::setDefaultProteinListWindow end"; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
} }
void void
ProjectWindow::connectNewPtmIslandListWindow() ProjectWindow::connectNewPtmIslandListWindow()
{ {
qDebug() << "ProjectWindow::connectNewPtmIslandListWindow begin"; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
_p_current_ptm_island_list_window = new PtmIslandListWindow(this); _p_current_ptm_island_list_window = new PtmIslandListWindow(this);
_ptm_island_list_window_collection.push_back( _ptm_island_list_window_collection.push_back(
_p_current_ptm_island_list_window); _p_current_ptm_island_list_window);
qDebug() << "ProjectWindow::connectNewPtmIslandListWindow end"; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
} }
void void
ProjectWindow::connectNewProteinListWindow() ProjectWindow::connectNewProteinListWindow()
{ {
qDebug() << "ProjectWindow::connectNewProteinListWindow begin"; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
_p_current_protein_list_window = new ProteinListWindow(this); _p_current_protein_list_window = new ProteinListWindow(this);
_protein_list_window_collection.push_back(_p_current_protein_list_window); _protein_list_window_collection.push_back(_p_current_protein_list_window);
qDebug() << "ProjectWindow::connectNewProteinListWindow end"; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
} }
void void
...@@ -395,69 +393,6 @@ ProjectWindow::computeMassPrecision() ...@@ -395,69 +393,6 @@ ProjectWindow::computeMassPrecision()
} }
qDebug() << "ProjectWindow::computeMassPrecision end"; qDebug() << "ProjectWindow::computeMassPrecision end";
} }
void
ProjectWindow::doFdrChanged()
{
qDebug() << "ProjectWindow::doFdrChanged begin ";
try
{
showWaitingMessage(tr("FDR modifications"));
doDisplayLoadingMessage(tr("tagging decoy proteins"));
if(ui->decoy_regexp_radiobutton->isChecked())
{
_project_sp.get()->getProteinStore().setRegexpDecoyPattern(
ui->decoy_protein_regexp_line_edit->text());
}
else
{
_project_sp.get()->getProteinStore().clearDecoys();
QModelIndexList index_list =
ui->decoy_database_listview->selectionModel()->selectedIndexes();
if(index_list.size() > 0)
{
qDebug() << "ProjectWindow::doFdrChanged index_list.size()="
<< index_list.size();
for(QModelIndex index : index_list)
{
if(index.data(Qt::UserRole).canConvert<FastaFile *>())
{
FastaFile *p_fasta_file =
index.data(Qt::UserRole).value<FastaFile *>();
p_fasta_file->setDecoys(
_project_sp.get()->getProteinStore());
}
else
{
throw pappso::PappsoException(
QObject::tr("can not convert to FastaFile "
"index.data().canConvert<FastaFile *>()"));
}
}
}
}
doDisplayLoadingMessage(tr("updating filters"));
_project_sp.get()->updateAutomaticFilters(
_project_sp.get()->getAutomaticFilterParameters());
// re group
emit operateGrouping(_project_sp);
}
catch(pappso::PappsoException exception_pappso)
{
hideWaitingMessage();
QMessageBox::warning(
this, tr("Unable to compute FDR :"), exception_pappso.qwhat());
}
catch(std::exception exception_std)
{
hideWaitingMessage();
QMessageBox::warning(
this, tr("Unable to compute FDR :"), exception_std.what());
}
qDebug() << "ProjectWindow::doFdrChanged end ";
}
void void
ProjectWindow::refresh() ProjectWindow::refresh()
{ {
...@@ -475,6 +410,14 @@ ProjectWindow::doContaminantSelectionChanged() ...@@ -475,6 +410,14 @@ ProjectWindow::doContaminantSelectionChanged()
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
} }
void
ProjectWindow::doDecoySelectionChanged()
{
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
ui->apply_fdr_button->setEnabled(true);
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
}
void void
ProjectWindow::doAutomaticFilterParametersChanged( ProjectWindow::doAutomaticFilterParametersChanged(
AutomaticFilterParameters parameters) AutomaticFilterParameters parameters)
...@@ -687,39 +630,17 @@ ProjectWindow::doViewProteinList(IdentificationGroup *p_identification_group) ...@@ -687,39 +630,17 @@ ProjectWindow::doViewProteinList(IdentificationGroup *p_identification_group)
void void
ProjectWindow::setProjectSp(ProjectSp project_sp) ProjectWindow::setProjectSp(ProjectSp project_sp)
{ {
qDebug() << "ProjectWindow::setProjectSp begin"; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
_project_sp = project_sp; _project_sp = project_sp;
ui->decoy_regexp_radiobutton->setChecked(true);
ui->decoy_regexp_groupbox->setVisible(true);
ui->decoy_database_groupbox->setVisible(false);
if(_project_sp.get()->getProteinStore().getDecoyFastaFileList().size() > 0)
{
ui->decoy_database_files_radiobutton->setChecked(true);
ui->decoy_regexp_groupbox->setVisible(false);
ui->decoy_database_groupbox->setVisible(true);
}
ui->contaminant_widget->getProjectContaminants(_project_sp.get()); ui->contaminant_widget->getProjectContaminants(_project_sp.get());
ui->decoy_widget->getProjectDecoys(_project_sp.get());
qDebug() << "ProjectWindow::setProjectSp begin " qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
<< _project_sp.get()->getFastaFileStore().getFastaFileList().size(); << _project_sp.get()->getFastaFileStore().getFastaFileList().size();
_fastafile_list = _project_sp.get()->getFastaFileStore().getFastaFileList(); _fastafile_list = _project_sp.get()->getFastaFileStore().getFastaFileList();
_p_fasta_str_li->removeRows(0, _p_fasta_str_li->rowCount());
for(FastaFileSp fasta_file : _fastafile_list)
{
QStandardItem *item;
item =
new QStandardItem(QString("%1").arg(fasta_file.get()->getFilename()));
item->setEditable(false);
item->setData(QVariant::fromValue(fasta_file.get()), Qt::UserRole);
_p_fasta_str_li->appendRow(item);
// item->setData(QVariant(QString("%1").arg(fasta_file.get()->getAbsoluteFilePath())),Qt::UserRole);
}
for(auto &&p_window : _ptm_island_list_window_collection) for(auto &&p_window : _ptm_island_list_window_collection)
{ {
delete p_window; delete p_window;
...@@ -783,7 +704,8 @@ ProjectWindow::setProjectSp(ProjectSp project_sp) ...@@ -783,7 +704,8 @@ ProjectWindow::setProjectSp(ProjectSp project_sp)
_p_xic_window = nullptr; _p_xic_window = nullptr;
} }
qDebug() << " ProjectWindow::setProjectSp size=" qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
<< " ProjectWindow::setProjectSp size="
<< identification_list.size(); << identification_list.size();
if(identification_list.size() == 1) if(identification_list.size() == 1)
{ {
...@@ -836,19 +758,18 @@ ProjectWindow::setProjectSp(ProjectSp project_sp) ...@@ -836,19 +758,18 @@ ProjectWindow::setProjectSp(ProjectSp project_sp)
//_protein_list_window->setIdentificationGroup(_project_sp.get()->getCurrentIdentificationGroupP()); //_protein_list_window->setIdentificationGroup(_project_sp.get()->getCurrentIdentificationGroupP());
//_protein_list_window->show(); //_protein_list_window->show();
ui->decoy_protein_regexp_line_edit->setText(
_project_sp.get()->getProteinStore().getRegexpDecoy().pattern());
refresh(); refresh();
this->setEnabled(true); this->setEnabled(true);
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
// doAutomaticFilterParametersChanged(params); // doAutomaticFilterParametersChanged(params);
// doFdrChanged(); // doFdrChanged();
} }
void void
ProjectWindow::doIdentificationsComboboxChanged(int index_in) ProjectWindow::doIdentificationsComboboxChanged(int index_in)
{ {
qDebug() << "ProjectWindow::doIdentificationsComboboxChanged begin ";
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
for(int index = 0; index < ui->identifications_combobox->count(); index++) for(int index = 0; index < ui->identifications_combobox->count(); index++)
{ {
qobject_cast<IdentificationGroupWidget *>( qobject_cast<IdentificationGroupWidget *>(
...@@ -858,7 +779,8 @@ ProjectWindow::doIdentificationsComboboxChanged(int index_in) ...@@ -858,7 +779,8 @@ ProjectWindow::doIdentificationsComboboxChanged(int index_in)
qobject_cast<IdentificationGroupWidget *>( qobject_cast<IdentificationGroupWidget *>(
qvariant_cast<QObject *>(ui->identifications_combobox->itemData(index_in))) qvariant_cast<QObject *>(ui->identifications_combobox->itemData(index_in)))
->setVisible(true); ->setVisible(true);
qDebug() << "ProjectWindow::doIdentificationsComboboxChanged end ";
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
} }
void void
...@@ -901,8 +823,7 @@ ProjectWindow::doIdentificationGroupEdited( ...@@ -901,8 +823,7 @@ ProjectWindow::doIdentificationGroupEdited(
{ {
showWaitingMessage(tr("Updating identification group")); showWaitingMessage(tr("Updating identification group"));
qDebug() << "ProjectWindow::doIdentificationGroupEdited emit " qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
"operateGroupingOnIdentification(_project_sp) ";
emit operateGroupingOnIdentification(p_identification_group, emit operateGroupingOnIdentification(p_identification_group,
_project_sp.get()->getGroupingType()); _project_sp.get()->getGroupingType());
} }
...@@ -918,7 +839,8 @@ ProjectWindow::viewError(QString error) ...@@ -918,7 +839,8 @@ ProjectWindow::viewError(QString error)
void void
ProjectWindow::doAcceptedLabelingMethod() ProjectWindow::doAcceptedLabelingMethod()
{ {
qDebug() << "ProjectWindow::doAcceptedLabelingMethod";
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
showWaitingMessage(tr("Apply labeling method")); showWaitingMessage(tr("Apply labeling method"));
LabelingMethodSp labeling_method_sp = LabelingMethodSp labeling_method_sp =
...@@ -928,8 +850,7 @@ ProjectWindow::doAcceptedLabelingMethod() ...@@ -928,8 +850,7 @@ ProjectWindow::doAcceptedLabelingMethod()
doDisplayLoadingMessage(tr("labeling peptides")); doDisplayLoadingMessage(tr("labeling peptides"));
qDebug() << "ProjectWindow::doAcceptedLabelingMethod emit " qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
"operateGrouping(_project_sp) ";
emit operateGrouping(_project_sp); emit operateGrouping(_project_sp);
} }
...@@ -937,7 +858,8 @@ ProjectWindow::doAcceptedLabelingMethod() ...@@ -937,7 +858,8 @@ ProjectWindow::doAcceptedLabelingMethod()
void void
ProjectWindow::openInXicViewer(const PeptideEvidence *p_peptide_evidence) ProjectWindow::openInXicViewer(const PeptideEvidence *p_peptide_evidence)
{ {
qDebug() << "ProjectWindow::openInXicViewer begin";
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
if(_p_xic_window == nullptr) if(_p_xic_window == nullptr)
{ {
_p_xic_window = new XicWindow(this); _p_xic_window = new XicWindow(this);
...@@ -946,38 +868,22 @@ ProjectWindow::openInXicViewer(const PeptideEvidence *p_peptide_evidence) ...@@ -946,38 +868,22 @@ ProjectWindow::openInXicViewer(const PeptideEvidence *p_peptide_evidence)
_p_xic_window->show(); _p_xic_window->show();
_p_xic_window->addXic(p_peptide_evidence); _p_xic_window->addXic(p_peptide_evidence);
qDebug() << "ProjectWindow::openInXicViewer end";
}
void qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
ProjectWindow::doSelectDecoySource()
{
qDebug() << "ProjectWindow::doSelectDecoySource begin";
ui->decoy_database_groupbox->setVisible(false);
ui->decoy_regexp_groupbox->setVisible(false);
if(ui->decoy_database_files_radiobutton->isChecked())
{
ui->decoy_database_groupbox->setVisible(true);
}
else
{
ui->decoy_regexp_groupbox->setVisible(true);
}
qDebug() << "ProjectWindow::doSelectDecoySource end";
} }
void void
ProjectWindow::doFilterChanged() ProjectWindow::doFilterChanged()
{ {
ui->apply_filter_button->setEnabled(true); ui->apply_filter_button->setEnabled(true);
ui->fdr_button->setEnabled(true); ui->apply_fdr_button->setEnabled(true);
} }
void void
ProjectWindow::doApplyDecoy() ProjectWindow::doApplyDecoy()
{ {
ui->fdr_button->setEnabled(false); ui->apply_fdr_button->setEnabled(false);
// doAutomaticFilterParametersChanged(automatic_filter); // doAutomaticFilterParametersChanged(automatic_filter);
try try
{ {
...@@ -991,8 +897,7 @@ ProjectWindow::doApplyDecoy() ...@@ -991,8 +897,7 @@ ProjectWindow::doApplyDecoy()
doDisplayLoadingMessage(tr("updating filters")); doDisplayLoadingMessage(tr("updating filters"));
_project_sp.get()->updateAutomaticFilters( _project_sp.get()->updateAutomaticFilters(
_project_sp.get()->getAutomaticFilterParameters()); _project_sp.get()->getAutomaticFilterParameters());
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
emit operateGrouping(_project_sp); emit operateGrouping(_project_sp);
......
...@@ -67,8 +67,6 @@ class ProjectWindow : public QMainWindow ...@@ -67,8 +67,6 @@ class ProjectWindow : public QMainWindow
void doViewProteinList(IdentificationGroup *p_identification_group = nullptr); void doViewProteinList(IdentificationGroup *p_identification_group = nullptr);
void setDefaultProteinListWindow(ProteinListWindow *p_protein_list_window); void setDefaultProteinListWindow(ProteinListWindow *p_protein_list_window);
void doAutomaticFilterParametersChanged(AutomaticFilterParameters parameters); void doAutomaticFilterParametersChanged(AutomaticFilterParameters parameters);
void doFdrChanged();
void doSelectDecoySource();
void doMassPrecisionUnitChanged(QString combo_value); void doMassPrecisionUnitChanged(QString combo_value);
void doOperationFailed(QString); void doOperationFailed(QString);
void doOperationFinished(); void doOperationFinished();
...@@ -82,6 +80,7 @@ class ProjectWindow : public QMainWindow ...@@ -82,6 +80,7 @@ class ProjectWindow : public QMainWindow
void doViewPeptideDetail(PeptideEvidence *peptide_evidence); void doViewPeptideDetail(PeptideEvidence *peptide_evidence);
void doFilterChanged(); void doFilterChanged();
void doApplyFilter(); void doApplyFilter();
void doApplyDecoy();
// void setColor(const QColor &color); // void setColor(const QColor &color);
// void setShape(Shape shape); // void setShape(Shape shape);
signals: signals:
...@@ -141,9 +140,7 @@ class ProjectWindow : public QMainWindow ...@@ -141,9 +140,7 @@ class ProjectWindow : public QMainWindow
ProjectSp _project_sp; ProjectSp _project_sp;
QStandardItemModel *_p_fasta_str_li;
std::vector<FastaFileSp> _fastafile_list; std::vector<FastaFileSp> _fastafile_list;
WaitingMessageDialog *_p_waiting_message_dialog; WaitingMessageDialog *_p_waiting_message_dialog;
// QCPBars *_p_bars; // QCPBars *_p_bars;
}; };
...@@ -120,41 +120,56 @@ ContaminantWidget::setProjectContaminants(Project *p_project) ...@@ -120,41 +120,56 @@ ContaminantWidget::setProjectContaminants(Project *p_project)
{ {
qDebug() << "ContaminantWidget::setProjectContaminants begin"; qDebug() << "ContaminantWidget::setProjectContaminants begin";
_emit_changed = false; _emit_changed = false;
if(ui->contaminant_file_radiobutton->isChecked()) try
{ {
QModelIndexList index_list = if(ui->contaminant_file_radiobutton->isChecked())
ui->contaminant_database_listview->selectionModel()->selectedIndexes();
p_project->getProteinStore().clearContaminants();
if(index_list.size() > 0)
{ {
for(QModelIndex index : index_list) QModelIndexList index_list =
ui->contaminant_database_listview->selectionModel()
->selectedIndexes();
p_project->getProteinStore().clearContaminants();
if(index_list.size() > 0)
{ {
if(index.data(Qt::UserRole).canConvert<FastaFileSp>()) for(QModelIndex index : index_list)
{
FastaFileSp p_fasta_file =
index.data(Qt::UserRole).value<FastaFileSp>();
p_fasta_file.get()->setContaminants(
p_project->getProteinStore());
}
else
{ {
throw pappso::PappsoException( if(index.data(Qt::UserRole).canConvert<FastaFileSp>())
QObject::tr("can not convert to FastaFile " {
"index.data().canConvert<FastaFile *>()")); FastaFileSp p_fasta_file =
index.data(Qt::UserRole).value<FastaFileSp>();
p_fasta_file.get()->setContaminants(
p_project->getProteinStore());
}
else
{
throw pappso::PappsoException(
QObject::tr("can not convert to FastaFile "
"index.data().canConvert<FastaFile *>()"));
}
} }
} }
}
if(_no_project) if(_no_project)
{
ui->control_list_widget->setVisible(true);
}
}
else
{ {
ui->control_list_widget->setVisible(true); p_project->getProteinStore().setRegexpContaminantPattern(
ui->contaminant_protein_regexp_line_edit->text());
ui->control_list_widget->setVisible(false);
} }
} }
else
catch(pappso::PappsoException &exception_pappso)
{
_emit_changed = true;
throw exception_pappso;
}
catch(std::exception &exception_std)
{ {
p_project->getProteinStore().setRegexpContaminantPattern( _emit_changed = true;
ui->contaminant_protein_regexp_line_edit->text()); throw exception_std;
ui->control_list_widget->setVisible(false);
} }
_emit_changed = true; _emit_changed = true;
qDebug() << "ContaminantWidget::setProjectContaminants end"; qDebug() << "ContaminantWidget::setProjectContaminants end";
...@@ -200,7 +215,9 @@ ContaminantWidget::doSelectFastaFile() ...@@ -200,7 +215,9 @@ ContaminantWidget::doSelectFastaFile()
settings.value("path/fastafiles_directory", "").toString(); settings.value("path/fastafiles_directory", "").toString();
QStringList filenames = QFileDialog::getOpenFileNames( QStringList filenames = QFileDialog::getOpenFileNames(
this, tr("FASTA files"), default_fasta_location, this,
tr("FASTA files"),
default_fasta_location,
tr("FASTA files (*.fasta);;all files (*)")); tr("FASTA files (*.fasta);;all files (*)"));
if(filenames.size() > 0) if(filenames.size() > 0)
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<item> <item>
<widget class="QGroupBox" name="decoy_groupbox"> <widget class="QGroupBox" name="decoy_groupbox">
<property name="title"> <property name="title">
<string>Contaminants</string> <string>Decoys</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_6"> <layout class="QVBoxLayout" name="verticalLayout_6">
<item> <item>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<string>select decoys from fasta files</string> <string>select decoys from fasta files</string>
</property> </property>
<property name="text"> <property name="text">
<string>decoy file</string> <string>deco&amp;y file</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>true</bool>
...@@ -136,82 +136,34 @@ ...@@ -136,82 +136,34 @@
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>contaminant_regexp_radiobutton</sender> <sender>decoy_protein_regexp_line_edit</sender>
<signal>clicked()</signal> <signal>textChanged(QString)</signal>
<receiver>ContaminantWidget</receiver> <receiver>DecoyWidget</receiver>
<slot>doSelectContaminantSource()</slot>
<hints>
<hint type="sourcelabel">
<x>226</x>
<y>52</y>
</hint>
<hint type="destinationlabel">
<x>670</x>
<y>79</y>
</hint>
</hints>
</connection>
<connection>
<sender>pushButton_2</sender>
<signal>clicked()</signal>
<receiver>ContaminantWidget</receiver>
<slot>doSelectFastaFile()</slot>
<hints>
<hint type="sourcelabel">
<x>333</x>
<y>229</y>
</hint>
<hint type="destinationlabel">
<x>690</x>
<y>146</y>
</hint>
</hints>
</connection>
<connection>
<sender>pushButton</sender>
<signal>clicked()</signal>
<receiver>ContaminantWidget</receiver>
<slot>doClearList()</slot>
<hints>
<hint type="sourcelabel">
<x>269</x>
<y>220</y>
</hint>
<hint type="destinationlabel">
<x>508</x>
<y>201</y>
</hint>
</hints>
</connection>
<connection>
<sender>contaminant_database_listview</sender>
<signal>clicked(QModelIndex)</signal>
<receiver>ContaminantWidget</receiver>
<slot>doChanged()</slot> <slot>doChanged()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>317</x> <x>167</x>
<y>102</y> <y>267</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>714</x> <x>657</x>
<y>107</y> <y>303</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>decoy_protein_regexp_line_edit</sender> <sender>decoy_regexp_radiobutton</sender>
<signal>textChanged(QString)</signal> <signal>clicked()</signal>
<receiver>DecoyWidget</receiver> <receiver>DecoyWidget</receiver>
<slot>doChanged()</slot> <slot>doSelectDecoySource()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>167</x> <x>358</x>
<y>267</y> <y>57</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>657</x> <x>602</x>
<y>303</y> <y>99</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
......
...@@ -65,9 +65,11 @@ DecoyWidget::~DecoyWidget() ...@@ -65,9 +65,11 @@ DecoyWidget::~DecoyWidget()
void void
DecoyWidget::setRegexpDecoyPattern(const QString &pattern) DecoyWidget::setRegexpDecoyPattern(const QString &pattern)
{ {
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
_emit_changed = false; _emit_changed = false;
ui->decoy_protein_regexp_line_edit->setText(pattern); ui->decoy_protein_regexp_line_edit->setText(pattern);
_emit_changed = true; _emit_changed = true;
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
} }
...@@ -75,6 +77,7 @@ void ...@@ -75,6 +77,7 @@ void
DecoyWidget::setFastaFileList(std::vector<FastaFileSp> fasta_file_list) DecoyWidget::setFastaFileList(std::vector<FastaFileSp> fasta_file_list)
{ {
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
_p_fasta_str_li->removeRows(0, _p_fasta_str_li->rowCount()); _p_fasta_str_li->removeRows(0, _p_fasta_str_li->rowCount());
for(FastaFileSp fasta_file : fasta_file_list) for(FastaFileSp fasta_file : fasta_file_list)
{ {
...@@ -87,16 +90,20 @@ DecoyWidget::setFastaFileList(std::vector<FastaFileSp> fasta_file_list) ...@@ -87,16 +90,20 @@ DecoyWidget::setFastaFileList(std::vector<FastaFileSp> fasta_file_list)
_p_fasta_str_li->appendRow(item); _p_fasta_str_li->appendRow(item);
// item->setData(QVariant(QString("%1").arg(fasta_file.get()->getAbsoluteFilePath())),Qt::UserRole); // item->setData(QVariant(QString("%1").arg(fasta_file.get()->getAbsoluteFilePath())),Qt::UserRole);
} }
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
} }
void void
DecoyWidget::getProjectDecoys(const Project *p_project) DecoyWidget::getProjectDecoys(const Project *p_project)
{ {
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
_emit_changed = false; _emit_changed = false;
ui->decoy_regexp_radiobutton->setChecked(true); ui->decoy_regexp_radiobutton->setChecked(true);
ui->decoy_protein_regexp_line_edit->setVisible(true); ui->decoy_protein_regexp_line_edit->setVisible(true);
ui->decoy_database_listview->setVisible(false); ui->decoy_database_listview->setVisible(false);
if(p_project->getProteinStore().getContaminantFastaFileList().size() > 0) if(p_project->getProteinStore().getDecoyFastaFileList().size() > 0)
{ {
ui->decoy_file_radiobutton->setChecked(true); ui->decoy_file_radiobutton->setChecked(true);
ui->decoy_protein_regexp_line_edit->setVisible(false); ui->decoy_protein_regexp_line_edit->setVisible(false);
...@@ -104,13 +111,15 @@ DecoyWidget::getProjectDecoys(const Project *p_project) ...@@ -104,13 +111,15 @@ DecoyWidget::getProjectDecoys(const Project *p_project)
} }
ui->decoy_protein_regexp_line_edit->setText( ui->decoy_protein_regexp_line_edit->setText(
p_project->getProteinStore().getRegexpContaminant().pattern()); p_project->getProteinStore().getRegexpDecoy().pattern());
this->setFastaFileList(p_project->getFastaFileStore().getFastaFileList()); this->setFastaFileList(p_project->getFastaFileStore().getFastaFileList());
ui->control_list_widget->setVisible(false); ui->control_list_widget->setVisible(false);
_no_project = false; _no_project = false;
_emit_changed = true; _emit_changed = true;
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
} }
void void
...@@ -119,41 +128,56 @@ DecoyWidget::setProjectDecoys(Project *p_project) ...@@ -119,41 +128,56 @@ DecoyWidget::setProjectDecoys(Project *p_project)
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
_emit_changed = false; _emit_changed = false;
if(ui->decoy_file_radiobutton->isChecked()) try
{ {
QModelIndexList index_list = if(ui->decoy_file_radiobutton->isChecked())
ui->decoy_database_listview->selectionModel()->selectedIndexes();
p_project->getProteinStore().clearContaminants();
if(index_list.size() > 0)
{ {
for(QModelIndex index : index_list) QModelIndexList index_list =
ui->decoy_database_listview->selectionModel()->selectedIndexes();
p_project->getProteinStore().clearDecoys();
if(index_list.size() > 0)
{ {
if(index.data(Qt::UserRole).canConvert<FastaFileSp>()) for(QModelIndex index : index_list)
{ {
FastaFileSp p_fasta_file = if(index.data(Qt::UserRole).canConvert<FastaFileSp>())
index.data(Qt::UserRole).value<FastaFileSp>(); {
p_fasta_file.get()->setContaminants( FastaFileSp p_fasta_file =
p_project->getProteinStore()); index.data(Qt::UserRole).value<FastaFileSp>();
}
else p_fasta_file.get()->setDecoys(
{ p_project->getProteinStore());
throw pappso::PappsoException( }
QObject::tr("can not convert to FastaFile " else
"index.data().canConvert<FastaFile *>()")); {
throw pappso::PappsoException(
QObject::tr("can not convert to FastaFile "
"index.data().canConvert<FastaFile *>()"));
}
} }
} }
}
if(_no_project)
if(_no_project)
{
ui->control_list_widget->setVisible(true);
}
}
else
{ {
ui->control_list_widget->setVisible(true); p_project->getProteinStore().setRegexpDecoyPattern(
ui->decoy_protein_regexp_line_edit->text());
ui->control_list_widget->setVisible(false);
} }
} }
else catch(pappso::PappsoException &exception_pappso)
{ {
p_project->getProteinStore().setRegexpContaminantPattern( _emit_changed = true;
ui->decoy_protein_regexp_line_edit->text()); throw exception_pappso;
ui->control_list_widget->setVisible(false); }
catch(std::exception &exception_std)
{
_emit_changed = true;
throw exception_std;
} }
_emit_changed = true; _emit_changed = true;
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
...@@ -163,7 +187,8 @@ DecoyWidget::setProjectDecoys(Project *p_project) ...@@ -163,7 +187,8 @@ DecoyWidget::setProjectDecoys(Project *p_project)
void void
DecoyWidget::doChanged() DecoyWidget::doChanged()
{ {
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
<< _emit_changed;
if(_emit_changed) if(_emit_changed)
emit changed(); emit changed();
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__; qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
......
...@@ -73,8 +73,8 @@ FastaFileStore::getInstance(const FastaFile &location) ...@@ -73,8 +73,8 @@ FastaFileStore::getInstance(const FastaFile &location)
const std::vector<FastaFileSp> & const std::vector<FastaFileSp> &
FastaFileStore::getFastaFileList() const FastaFileStore::getFastaFileList() const
{ {
qDebug() << "FastaFileStore::getFastaFileList() begin";
qDebug() << "FastaFileStore::getFastaFileList() begin" qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
<< _map_fastafile.size(); << _map_fastafile.size();
return _map_fastafile; return _map_fastafile;
} }
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