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

FDR and contaminant selection now works selecting fasta files

parent 42378830
No related branches found
No related tags found
No related merge requests found
......@@ -32,9 +32,10 @@ public:
};
void setSequence(const QString& description, const QString& sequence) override {
qDebug() << "PeptideReader::setSequence " << description << " " <<sequence;
//qDebug() << "PeptideReader::setSequence " << description << " " <<sequence;
QStringList descr_split = description.simplified().split(" ");
QString accession = descr_split.at(0);
//qDebug() << "PeptideReader::setSequence " << accession << " " <<accession;
_protein_store.setContaminantAccession(accession);
};
private:
......
......@@ -54,6 +54,7 @@ ProjectWindow::ProjectWindow(MainWindow *parent):
ui->contaminant_database_listview->setModel(_p_fasta_str_li);
QItemSelectionModel * selection_model = ui->contaminant_database_listview->selectionModel();
ui->contaminant_database_listview->setSelectionMode(QAbstractItemView::MultiSelection);
ui->decoy_database_listview->setSelectionMode(QAbstractItemView::MultiSelection);
_p_automatic_filter_widget = new AutomaticFilterWidget(this);
ui->filter_parameter_layout->addWidget(_p_automatic_filter_widget);
......@@ -259,7 +260,22 @@ void ProjectWindow::doFdrChanged() {
qDebug() << "ProjectWindow::doFdrChanged begin ";
showWaitingMessage(tr("FDR modifications"));
doDisplayLoadingMessage(tr("tagging decoy proteins"));
_project_sp.get()->getProteinStore().setRegexpDecoyPattern(ui->decoy_protein_regexp_line_edit->text());
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 *>()"));
}
}
}
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());
......
......@@ -34,12 +34,12 @@
ProteinStore::ProteinStore()
{
QSettings settings;
QSettings settings;
_regexp_contaminant.setPattern(settings.value("automatic_filter/contaminant_regexp","^conta\\|").toString());
_regexp_decoy.setPattern(settings.value("automatic_filter/decoy_regexp",".*\\|reversed$").toString());
}
ProteinStore::~ProteinStore()
......@@ -51,7 +51,7 @@ QRegExp ProteinStore::getRegexpContaminant() const {
}
void ProteinStore::setRegexpContaminantPattern(const QString & pattern) {
_regexp_contaminant.setPattern(pattern);
for (std::pair<const QString, ProteinXtpSp> & acc_protein :_map_accession_protein_list) {
setProteinInformations(acc_protein.second);
}
......@@ -63,11 +63,11 @@ QRegExp ProteinStore::getRegexpDecoy() const {
}
void ProteinStore::setRegexpDecoyPattern(const QString & pattern) {
_regexp_decoy.setPattern(pattern);
for (std::pair<const QString, ProteinXtpSp> & acc_protein :_map_accession_protein_list) {
setProteinInformations(acc_protein.second);
}
QSettings settings;
QSettings settings;
settings.setValue("automatic_filter/decoy_regexp", pattern);
}
......@@ -84,10 +84,16 @@ void ProteinStore::clearContaminants() {
}
void ProteinStore::setDecoyAccession(QString accession) {
_map_accession_protein_list.at(accession).get()->setIsDecoy(true);
std::map<QString, ProteinXtpSp>::iterator it = _map_accession_protein_list.find(accession);
if (it != _map_accession_protein_list.end()) {
it->second.get()->setIsDecoy(true);
}
}
void ProteinStore::setContaminantAccession(QString accession) {
_map_accession_protein_list.at(accession).get()->setIsContaminant(true);
std::map<QString, ProteinXtpSp>::iterator it = _map_accession_protein_list.find(accession);
if (it != _map_accession_protein_list.end()) {
it->second.get()->setIsContaminant(true);
}
}
ProteinXtpSp & ProteinStore::getInstance(ProteinXtpSp & peptide_in) {
......@@ -106,7 +112,7 @@ void ProteinStore::setProteinInformations(ProteinXtpSp & peptide_in) {
peptide_in.get()->setIsDecoy(false);
QString accession = peptide_in.get()->getAccession();
peptide_in.get()->parseAccession2dbxref();
if ((!_regexp_contaminant.isEmpty()) && (_regexp_contaminant.indexIn(accession, 0)>-1)) {
//qDebug() << "ProteinStore::setProteinInformations is contaminant " << accession;
peptide_in.get()->setIsContaminant(true);
......
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