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

error if fasta file is not found

parent 0d70f987
No related branches found
No related tags found
No related merge requests found
......@@ -64,7 +64,7 @@ bool ProteinMatch::contains(PeptideMatch * peptide_match) const {
}
void ProteinMatch::updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters) {
qDebug() <<"ProteinMatch::updateAutomaticFilters begin " ;
//qDebug() <<"ProteinMatch::updateAutomaticFilters begin " ;
_proxy_valid = false;
unsigned int number_of_valid_peptides =0;
bool cross_sample = automatic_filter_parameters.getFilterCrossSamplePeptideNumber();
......@@ -91,7 +91,7 @@ void ProteinMatch::updateAutomaticFilters(const AutomaticFilterParameters & auto
}
}
qDebug() <<"ProteinMatch::updateAutomaticFilters begin 2" ;
// qDebug() <<"ProteinMatch::updateAutomaticFilters begin 2" ;
if (number_of_valid_peptides == 0) {
_proxy_valid = false;
......@@ -105,7 +105,7 @@ void ProteinMatch::updateAutomaticFilters(const AutomaticFilterParameters & auto
}
}
}
qDebug() <<"ProteinMatch::updateAutomaticFilters end " << number_of_valid_peptides ;
// qDebug() <<"ProteinMatch::updateAutomaticFilters end " << number_of_valid_peptides ;
}
const ProteinXtpSp & ProteinMatch::getProteinXtpSp() const {
......
......@@ -25,6 +25,7 @@
#include <pappsomspp/fasta/fastareader.h>
#include <QStringList>
#include <QDebug>
#include <pappsomspp/exception/exceptionnotfound.h>
class AccessionContaminantReader: public pappso::FastaHandlerInterface {
public:
......@@ -94,10 +95,12 @@ void FastaFile::setContaminants(ProteinStore & protein_store) const {
}
else {
qDebug() << "FastaFile::setContaminants "<< _fasta_source.absoluteFilePath() << " not open";
throw pappso::ExceptionNotFound(QObject::tr("unable to open contaminant fasta file \"%1\"").arg(_fasta_source.absoluteFilePath()));
}
}
else {
qDebug() << "FastaFile::setContaminants "<< _fasta_source.absoluteFilePath() << " does not exists";
throw pappso::ExceptionNotFound(QObject::tr("contaminant fasta file \"%1\" not found").arg(_fasta_source.absoluteFilePath()));
}
}
......@@ -113,9 +116,11 @@ void FastaFile::setDecoys(ProteinStore & protein_store) const {
}
else {
qDebug() << "FastaFile::setDecoys "<< _fasta_source.absoluteFilePath() << " not open";
throw pappso::ExceptionNotFound(QObject::tr("unable to open decoy fasta file \"%1\"").arg(_fasta_source.absoluteFilePath()));
}
}
else {
qDebug() << "FastaFile::setDecoys "<< _fasta_source.absoluteFilePath() << " does not exists";
throw pappso::ExceptionNotFound(QObject::tr("decoy fasta file \"%1\" not found").arg(_fasta_source.absoluteFilePath()));
}
}
......@@ -282,29 +282,42 @@ void ProjectWindow::computeMassPrecision() {
void ProjectWindow::doFdrChanged() {
qDebug() << "ProjectWindow::doFdrChanged begin ";
showWaitingMessage(tr("FDR modifications"));
doDisplayLoadingMessage(tr("tagging decoy proteins"));
QModelIndexList index_list = ui->decoy_database_listview->selectionModel()->selectedIndexes();
if (index_list.size() > 0) {
_project_sp.get()->getProteinStore().clearDecoys();
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 *>()"));
try {
showWaitingMessage(tr("FDR modifications"));
doDisplayLoadingMessage(tr("tagging decoy proteins"));
QModelIndexList index_list = ui->decoy_database_listview->selectionModel()->selectedIndexes();
if (index_list.size() > 0) {
qDebug() << "ProjectWindow::doFdrChanged index_list.size()=" << index_list.size();
_project_sp.get()->getProteinStore().clearDecoys();
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 *>()"));
}
}
}
else {
_project_sp.get()->getProteinStore().setRegexpDecoyPattern(ui->decoy_protein_regexp_line_edit->text());
}
doDisplayLoadingMessage(tr("updating filters"));
_project_sp.get()->updateAutomaticFilters(_project_sp.get()->getAutomaticFilterParameters());
//re group
emit operateGrouping(_project_sp);
}
else {
_project_sp.get()->getProteinStore().setRegexpDecoyPattern(ui->decoy_protein_regexp_line_edit->text());
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());
}
doDisplayLoadingMessage(tr("updating filters"));
_project_sp.get()->updateAutomaticFilters(_project_sp.get()->getAutomaticFilterParameters());
//re group
emit operateGrouping(_project_sp);
qDebug() << "ProjectWindow::doFdrChanged end ";
}
......@@ -317,30 +330,42 @@ void ProjectWindow::refresh() {
}
void ProjectWindow::doAutomaticFilterParametersChanged(AutomaticFilterParameters parameters) {
qDebug() << "ProjectWindow::doAutomaticFilterParametersChanged begin ";
showWaitingMessage(tr("Updating filters"));
doDisplayLoadingMessage(tr("tagging contaminant proteins"));
QModelIndexList index_list = ui->contaminant_database_listview->selectionModel()->selectedIndexes();
if (index_list.size() > 0) {
_project_sp.get()->getProteinStore().clearContaminants();
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->setContaminants(_project_sp.get()->getProteinStore());
}
else {
throw pappso::PappsoException(QObject::tr("can not convert to FastaFile index.data().canConvert<FastaFile *>()"));
try {
showWaitingMessage(tr("Updating filters"));
doDisplayLoadingMessage(tr("tagging contaminant proteins"));
QModelIndexList index_list = ui->contaminant_database_listview->selectionModel()->selectedIndexes();
if (index_list.size() > 0) {
_project_sp.get()->getProteinStore().clearContaminants();
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->setContaminants(_project_sp.get()->getProteinStore());
}
else {
throw pappso::PappsoException(QObject::tr("can not convert to FastaFile index.data().canConvert<FastaFile *>()"));
}
}
}
else {
_project_sp.get()->getProteinStore().setRegexpContaminantPattern(ui->contaminant_protein_regexp_line_edit->text());
}
doDisplayLoadingMessage(tr("updating filters"));
_project_sp.get()->updateAutomaticFilters(parameters);
qDebug() << "ProjectWindow::doAutomaticFilterParametersChanged emit operateGrouping(_project_sp) ";
emit operateGrouping(_project_sp);
}
else {
_project_sp.get()->getProteinStore().setRegexpContaminantPattern(ui->contaminant_protein_regexp_line_edit->text());
catch (pappso::PappsoException exception_pappso) {
hideWaitingMessage();
QMessageBox::warning(this,
tr("Error filtering results :"), exception_pappso.qwhat());
}
catch (std::exception exception_std) {
hideWaitingMessage();
QMessageBox::warning(this,
tr("Error filtering results :"), exception_std.what());
}
doDisplayLoadingMessage(tr("updating filters"));
_project_sp.get()->updateAutomaticFilters(parameters);
qDebug() << "ProjectWindow::doAutomaticFilterParametersChanged emit operateGrouping(_project_sp) ";
emit operateGrouping(_project_sp);
qDebug() << "ProjectWindow::doAutomaticFilterParametersChanged end ";
}
......@@ -653,3 +678,4 @@ void ProjectWindow::doAcceptedLabelingMethod() {
emit operateGrouping(_project_sp);
}
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