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

get protein match instance

parent 727603c1
No related branches found
No related tags found
No related merge requests found
......@@ -29,8 +29,8 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Xml_EXECUTABLE_COMPILE_FLAGS} ${Qt5
#sudo apt-get install libpappsomspp-dev
#FIND_PACKAGE( Pappsomspp REQUIRED )
# SET (PAPPSOMSPP_DIR "/home/olivier/eclipse/git/pappsomspp")
SET (PAPPSOMSPP_DIR "/home/langella/developpement/git/pappsomspp")
SET (PAPPSOMSPP_DIR "/home/olivier/eclipse/git/pappsomspp")
# SET (PAPPSOMSPP_DIR "/home/langella/developpement/git/pappsomspp")
SET (PAPPSOMSPP_INCLUDE_DIR "${PAPPSOMSPP_DIR}/src")
SET (PAPPSOMSPP_QT4_LIBRARY "${PAPPSOMSPP_DIR}/cbuild/src/libpappsomspp-qt4.so")
......
......@@ -50,19 +50,17 @@ void IdentificationGroup::updateAutomaticFilters(const AutomaticFilterParameters
}
}
ProteinMatch * IdentificationGroup::getProteinMatch(const QString accession) {
ProteinMatch * IdentificationGroup::getProteinMatchInstance(const QString accession) {
if (accession.isEmpty()) {
throw pappso::PappsoException(QObject::tr("Error protein match not found : accession is empty"));
}
auto it_cache = _cache_accession_protein_match.find(accession);
if (it_cache == _cache_accession_protein_match.end()) {
//accession not found in cache
for (ProteinMatch * p_protein_match : _protein_match_list) {
if (p_protein_match->getProteinXtpSp().get()->getAccession() == accession) {
_cache_accession_protein_match.insert(std::pair<QString, ProteinMatch *>(accession, p_protein_match));
return p_protein_match;
}
}
ProteinMatch * p_protein_match = new ProteinMatch();
_cache_accession_protein_match.insert(std::pair<QString, ProteinMatch *>(accession, p_protein_match));
_protein_match_list.push_back(p_protein_match);
return p_protein_match;
}
else {
return it_cache->second;
......@@ -70,17 +68,7 @@ ProteinMatch * IdentificationGroup::getProteinMatch(const QString accession) {
return nullptr;
}
void IdentificationGroup::addProteinMatch(ProteinMatch * protein_match) {
QString accession = protein_match->getProteinXtpSp().get()->getAccession();
if (accession.isEmpty()) {
throw pappso::PappsoException(QObject::tr("Error adding protein match : accession is empty"));
}
auto it_cache = _cache_already_added_protein_match.find(protein_match);
if (it_cache == _cache_already_added_protein_match.end()) {
//accession not found in cache
_cache_already_added_protein_match.insert(protein_match);
_protein_match_list.push_back(protein_match);
}
_protein_match_list.push_back(protein_match);
}
bool IdentificationGroup::contains (const MsRun * p_msrun) const {
......
......@@ -44,7 +44,7 @@ public:
IdentificationGroup(Project * project);
~IdentificationGroup();
ProteinMatch * getProteinMatch(const QString accession);
ProteinMatch * getProteinMatchInstance(const QString accession);
void addProteinMatch(ProteinMatch * protein_match);
std::vector<ProteinMatch *> & getProteinMatchList();
void addMsRunSp(MsRunSp ms_run_sp);
......@@ -95,7 +95,6 @@ private :
std::vector<MsRunSp> _ms_run_list;
std::map<QString, ProteinMatch *> _cache_accession_protein_match;
std::set<ProteinMatch *> _cache_already_added_protein_match;
};
#endif // IDENTIFICATIONGROUP_H
......@@ -52,7 +52,7 @@ void PeptideMatch::setStart(unsigned int start) {
_start =start;
}
pappso::mz PeptideMatch::getDeltaMass() const {
return (_exp_mass - _peptide_sp.get()->getMass());
return ((_exp_mass+pappso::MHPLUS) - _peptide_sp.get()->getMz(1));
}
unsigned int PeptideMatch::getStart() const {
return _start;
......
......@@ -72,7 +72,7 @@ public :
* */
void updateAutomaticFilters(const AutomaticFilterParameters & automatic_filter_parameters);
/** @brief get delta between theoretical mass and experimental mass
/** @brief get delta between theoretical mhplus mass and mhplus experimental mass
*/
pappso::mz getDeltaMass() const;
......
......@@ -132,7 +132,7 @@ bool XtandemSaxHandler::startElement_group(QXmlAttributes attrs) {
_scan = attrs.value("id").toUInt();
_mhplus_obser = attrs.value("mh").toDouble();
_charge = attrs.value("z").toUInt();
//_retention_time = attrs.value("rt");
_retention_time = attrs.value("rt").replace("PT","").replace("S","").toDouble();
}
return is_ok;
}
......@@ -156,22 +156,16 @@ bool XtandemSaxHandler::startElement_protein(QXmlAttributes attributes) {
//qDebug() << "startElement_protein begin";
QString accession = attributes.value("label").simplified().split(" ", QString::SkipEmptyParts).at(0);
//qDebug() << "startElement_protein accession" << accession;
_p_protein_match = _p_identification_group->getProteinMatch(accession);
_p_protein_match = _p_identification_group->getProteinMatchInstance(accession);
//qDebug() << "startElement_protein p_protein_match 1 " << _p_protein_match;
_current_protein.setAccession(accession);
if (_p_protein_match == nullptr) {
_p_protein_match = new ProteinMatch();
//qDebug() << "startElement_protein p_protein_match 2 " << _p_protein_match;
_p_protein_match->setChecked(false);
}
_p_protein_match->setChecked(false);
//qDebug() << "startElement_protein p_protein_match 3 " << _p_protein_match;
ProteinXtpSp sp_xtp_protein = _current_protein.makeProteinXtpSp();
_p_protein_match->setProteinXtpSp(_p_project->getProteinStore().getInstance(sp_xtp_protein));
_p_protein_match->setChecked(true);
_p_identification_group->addProteinMatch(_p_protein_match);
//qDebug() << "startElement_protein end" ;
return is_ok;
}
......@@ -247,7 +241,7 @@ bool XtandemSaxHandler::startElement_aa(QXmlAttributes attributes) {
}
bool XtandemSaxHandler::endElement_domain() {
bool is_ok = true;
bool is_ok = true;
_current_peptide_sp = _p_project->getPeptideStore().getInstance(_current_peptide_sp);
_p_peptide_match->setPeptideXtpSp(_current_peptide_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