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

handle decoy and contaminant filter status, more information in ODS output

parent 7870c2d4
No related branches found
No related tags found
No related merge requests found
...@@ -84,6 +84,10 @@ ProteinStore & Project::getProteinStore() { ...@@ -84,6 +84,10 @@ ProteinStore & Project::getProteinStore() {
return _protein_store; return _protein_store;
} }
const ProteinStore & Project::getProteinStore() const {
return _protein_store;
}
IdentificationDataSourceStore & Project::getIdentificationDataSourceStore() { IdentificationDataSourceStore & Project::getIdentificationDataSourceStore() {
return _identification_data_source_store; return _identification_data_source_store;
} }
......
...@@ -49,6 +49,7 @@ public: ...@@ -49,6 +49,7 @@ public:
ProjectSp makeProjectSp() const; ProjectSp makeProjectSp() const;
ProteinStore & getProteinStore(); ProteinStore & getProteinStore();
PeptideStore & getPeptideStore(); PeptideStore & getPeptideStore();
const ProteinStore & getProteinStore() const;
MsRunStore & getMsRunStore(); MsRunStore & getMsRunStore();
const MsRunStore & getMsRunStore() const; const MsRunStore & getMsRunStore() const;
FastaFileStore & getFastaFileStore(); FastaFileStore & getFastaFileStore();
......
...@@ -92,6 +92,7 @@ void FastaFile::setContaminants(ProteinStore & protein_store) const { ...@@ -92,6 +92,7 @@ void FastaFile::setContaminants(ProteinStore & protein_store) const {
if (fasta_file.open(QIODevice::ReadOnly)) { if (fasta_file.open(QIODevice::ReadOnly)) {
reader.parse(&fasta_file); reader.parse(&fasta_file);
fasta_file.close(); fasta_file.close();
protein_store.addContaminantFastaFile(*this);
} }
else { else {
qDebug() << "FastaFile::setContaminants "<< _fasta_source.absoluteFilePath() << " not open"; qDebug() << "FastaFile::setContaminants "<< _fasta_source.absoluteFilePath() << " not open";
...@@ -113,6 +114,7 @@ void FastaFile::setDecoys(ProteinStore & protein_store) const { ...@@ -113,6 +114,7 @@ void FastaFile::setDecoys(ProteinStore & protein_store) const {
if (fasta_file.open(QIODevice::ReadOnly)) { if (fasta_file.open(QIODevice::ReadOnly)) {
reader.parse(&fasta_file); reader.parse(&fasta_file);
fasta_file.close(); fasta_file.close();
protein_store.addDecoyFastaFile(*this);
} }
else { else {
qDebug() << "FastaFile::setDecoys "<< _fasta_source.absoluteFilePath() << " not open"; qDebug() << "FastaFile::setDecoys "<< _fasta_source.absoluteFilePath() << " not open";
......
...@@ -67,5 +67,35 @@ InfoSheet::InfoSheet (OdsExport * p_ods_export, CalcWriterInterface * p_writer, ...@@ -67,5 +67,35 @@ InfoSheet::InfoSheet (OdsExport * p_ods_export, CalcWriterInterface * p_writer,
p_writer->writeCell("Maximum protein Evalue"); p_writer->writeCell("Maximum protein Evalue");
p_writer->writeCell(filter_param.getFilterProteinEvalue()); p_writer->writeCell(filter_param.getFilterProteinEvalue());
p_writer->writeLine(); p_writer->writeLine();
p_writer->writeLine();
p_writer->writeLine();
std::vector<FastaFile> conta_file_list = p_project->getProteinStore().getContaminantFastaFileList();
if (conta_file_list.size() == 0) {
p_writer->writeCell("contaminant pattern");
p_writer->writeCell(p_project->getProteinStore().getRegexpContaminant().pattern());
}
else {
p_writer->writeCell("contaminant fasta files");
for (FastaFile & fasta_file : conta_file_list) {
p_writer->writeCell(fasta_file.getAbsoluteFilePath());
}
}
std::vector<FastaFile> decoy_file_list = p_project->getProteinStore().getDecoyFastaFileList();
if (conta_file_list.size() == 0) {
p_writer->writeCell("decoy pattern");
p_writer->writeCell(p_project->getProteinStore().getRegexpDecoy().pattern());
}
else {
p_writer->writeCell("decoy fasta files");
for (FastaFile & fasta_file : decoy_file_list) {
p_writer->writeCell(fasta_file.getAbsoluteFilePath());
}
}
} }
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
******************************************************************************/ ******************************************************************************/
#include "proteinstore.h" #include "proteinstore.h"
#include "../files/fastafile.h"
#include <QDebug> #include <QDebug>
#include <QSettings> #include <QSettings>
...@@ -46,6 +47,13 @@ ProteinStore::~ProteinStore() ...@@ -46,6 +47,13 @@ ProteinStore::~ProteinStore()
{ {
} }
const std::vector<FastaFile> & ProteinStore::getContaminantFastaFileList() const {
return _fasta_contaminant_list;
}
const std::vector<FastaFile> & ProteinStore::getDecoyFastaFileList() const {
return _fasta_decoy_list;
}
QRegExp ProteinStore::getRegexpContaminant() const { QRegExp ProteinStore::getRegexpContaminant() const {
return (_regexp_contaminant); return (_regexp_contaminant);
} }
...@@ -73,16 +81,26 @@ void ProteinStore::setRegexpDecoyPattern(const QString & pattern) { ...@@ -73,16 +81,26 @@ void ProteinStore::setRegexpDecoyPattern(const QString & pattern) {
} }
void ProteinStore::clearDecoys() { void ProteinStore::clearDecoys() {
_fasta_decoy_list.clear();
for (std::pair<const QString, ProteinXtpSp> & acc_protein :_map_accession_protein_list) { for (std::pair<const QString, ProteinXtpSp> & acc_protein :_map_accession_protein_list) {
acc_protein.second.get()->setIsDecoy(false); acc_protein.second.get()->setIsDecoy(false);
} }
} }
void ProteinStore::clearContaminants() { void ProteinStore::clearContaminants() {
_fasta_contaminant_list.clear();
for (std::pair<const QString, ProteinXtpSp> & acc_protein :_map_accession_protein_list) { for (std::pair<const QString, ProteinXtpSp> & acc_protein :_map_accession_protein_list) {
acc_protein.second.get()->setIsContaminant(false); acc_protein.second.get()->setIsContaminant(false);
} }
} }
void ProteinStore::addContaminantFastaFile(const FastaFile & fasta_file) {
_fasta_contaminant_list.push_back(fasta_file);
}
void ProteinStore::addDecoyFastaFile(const FastaFile & fasta_file) {
_fasta_decoy_list.push_back(fasta_file);
}
void ProteinStore::setDecoyAccession(QString accession) { void ProteinStore::setDecoyAccession(QString accession) {
std::map<QString, ProteinXtpSp>::iterator it = _map_accession_protein_list.find(accession); std::map<QString, ProteinXtpSp>::iterator it = _map_accession_protein_list.find(accession);
if (it != _map_accession_protein_list.end()) { if (it != _map_accession_protein_list.end()) {
......
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
#include <QString> #include <QString>
#include <QRegExp> #include <QRegExp>
#include <map> #include <map>
#include <vector>
class FastaFile;
class ProteinStore class ProteinStore
{ {
...@@ -54,6 +57,13 @@ public: ...@@ -54,6 +57,13 @@ public:
QRegExp getRegexpContaminant() const; QRegExp getRegexpContaminant() const;
void addContaminantFastaFile(const FastaFile & fasta_file);
void addDecoyFastaFile(const FastaFile & fasta_file);
const std::vector<FastaFile> & getContaminantFastaFileList() const;
const std::vector<FastaFile> & getDecoyFastaFileList() const;
void clearContaminants(); void clearContaminants();
void clearDecoys(); void clearDecoys();
...@@ -65,6 +75,12 @@ private : ...@@ -65,6 +75,12 @@ private :
private : private :
std::map<QString, ProteinXtpSp> _map_accession_protein_list; std::map<QString, ProteinXtpSp> _map_accession_protein_list;
/** \brief decoy Fasta file liste */
std::vector<FastaFile> _fasta_decoy_list;
/** \brief contaminant Fasta file liste */
std::vector<FastaFile> _fasta_contaminant_list;
/** \brief recognize decoy accession */ /** \brief recognize decoy accession */
QRegExp _regexp_decoy; QRegExp _regexp_decoy;
/** \brief recognize contaminant accession */ /** \brief recognize contaminant accession */
......
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