diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9d83c28381795063e2aaf2c1413a7bf8b640d8bf..42d4fb8ffd3688b5b44840562b52e09eea518787 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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") diff --git a/src/core/identification_sources/identificationxtandemfile.cpp b/src/core/identification_sources/identificationxtandemfile.cpp index 1f21279ea68f704d4b53a4b41a8ed1ee0215e937..3502835d87158b8de89bcdf77dcf0d4561bd6253 100644 --- a/src/core/identification_sources/identificationxtandemfile.cpp +++ b/src/core/identification_sources/identificationxtandemfile.cpp @@ -78,7 +78,7 @@ void IdentificationXtandemFile::parseTo(Project* p_project) { } } - XtandemSaxHandler * parser = new XtandemSaxHandler(p_project, identification_group_p); + XtandemSaxHandler * parser = new XtandemSaxHandler(p_project, identification_group_p, this); QXmlSimpleReader simplereader; simplereader.setContentHandler(parser); diff --git a/src/core/identificationgroup.cpp b/src/core/identificationgroup.cpp index f85a149bceb40724962661b6cd653d491a050969..23eebfb3e05a4317cb4c674aebdce26978a6e42f 100644 --- a/src/core/identificationgroup.cpp +++ b/src/core/identificationgroup.cpp @@ -67,7 +67,7 @@ void IdentificationGroup::addProteinMatch(ProteinMatch * protein_match) { throw pappso::PappsoException(QObject::tr("Error adding protein match : accession is empty")); } for (ProteinMatch * p_protein_match : _protein_match_list) { - if (p_protein_match->getProteinXtpSp().get()->getAccession() == accession) { + if ((p_protein_match != protein_match) && (p_protein_match->getProteinXtpSp().get()->getAccession() == accession)) { throw pappso::PappsoException(QObject::tr("Error adding protein match : accession %1 already registered").arg(accession)); } } diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 609e69950fcc1edb7de3b90cd804898a67bc1f15..8a03691f71654a48bdcbcca1cd7a84cbf85f2a4a 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -64,6 +64,7 @@ void XtpLoaderThread::doLoadingResults(bool is_individual, AutomaticFilterParame project_sp.get()->readResultFile(filename); } + project_sp.get()->updateAutomaticFilters(param); emit projectReady(project_sp); } @@ -98,6 +99,7 @@ MainWindow::MainWindow(QWidget *parent): //addDockWidget(Qt::RightDockWidgetArea, dock); qRegisterMetaType<ProjectSp>("ProjectSp"); + qRegisterMetaType<AutomaticFilterParameters>("AutomaticFilterParameters"); #if QT_VERSION >= 0x050000 // Qt5 code /* @@ -110,6 +112,7 @@ MainWindow::MainWindow(QWidget *parent): connect(this, SIGNAL(operateXpipFile(QString)), worker,SLOT(doXpipFileLoad(QString))); connect(worker, SIGNAL(projectReady(ProjectSp)), this,SLOT(doProjectReady(ProjectSp))); + connect(this, SIGNAL(operateLoadingResults(bool,AutomaticFilterParameters,QStringList)), worker,SLOT(doLoadingResults(bool,AutomaticFilterParameters,QStringList))); connect(_p_load_results_dialog, SIGNAL(accepted()), this,SLOT(doAcceptedLoadResultDialog())); /* connect(&workerThread, SIGNAL(finished()), worker, SLOT(deleteLater())); diff --git a/src/input/xpipsaxhandler.cpp b/src/input/xpipsaxhandler.cpp index f494d5fd69a1b63a21a474b7d6629998e07cf711..bd719e399d2af7ffaad10b7f5e5ebae375bccad9 100644 --- a/src/input/xpipsaxhandler.cpp +++ b/src/input/xpipsaxhandler.cpp @@ -240,8 +240,6 @@ bool XpipSaxHandler::startElement_peptide(QXmlAttributes attributes) { _p_peptide_match->setStart(attributes.value("start").simplified().toUInt()-1); _p_peptide_match->setCharge(attributes.value("charge").simplified().toUInt()); - _p_peptide_match->setCharge(attributes.value("charge").simplified().toUInt()); - IdentificationDataSource* p_identification_data_source = _p_project->getIdentificationDataSourceStore().getInstance(attributes.value("sample_file").simplified()).get(); _p_peptide_match->setIdentificationDataSource( p_identification_data_source); if (p_identification_data_source->getMsRunSp().get() == nullptr) { diff --git a/src/input/xtandemsaxhandler.cpp b/src/input/xtandemsaxhandler.cpp index a720f5839c82e96eededa46f7ab35f5b2be73532..8e7b258b143004f204a6d008029b0391ba243f0f 100644 --- a/src/input/xtandemsaxhandler.cpp +++ b/src/input/xtandemsaxhandler.cpp @@ -35,9 +35,13 @@ #include "../utils/peptidestore.h" #include "../utils/proteinstore.h" -XtandemSaxHandler::XtandemSaxHandler(Project * p_project, IdentificationGroup * p_identification_group):_p_project(p_project) +XtandemSaxHandler::XtandemSaxHandler(Project * p_project, IdentificationGroup * p_identification_group, + IdentificationDataSource * p_identification_data_source):_p_project(p_project) { _p_identification_group = p_identification_group; + + _p_identification_data_source =p_identification_data_source; + _sp_msrun = p_identification_data_source->getMsRunSp(); } XtandemSaxHandler::~XtandemSaxHandler() @@ -63,8 +67,7 @@ bool XtandemSaxHandler::startElement(const QString & namespaceURI, const QString } else if (qName == "file") { is_ok = startElement_file(attributes); - } else if (qName == "peptide") { - is_ok = startElement_peptide(attributes); + } else if (qName == "aa") { is_ok = startElement_aa(attributes); } else if (qName == "domain") { @@ -117,7 +120,7 @@ bool XtandemSaxHandler::endElement(const QString & namespaceURI, const QString & bool XtandemSaxHandler::startElement_group(QXmlAttributes attrs) { //<group id="1976" mh="1120.529471" z="2" rt="PT667.022S" expect="9.7e-04" label="GRMZM2G083841_P01 P04711 Phosphoenolpyruvate carboxylase 1 (PEPCase 1)(PEPC 1)(EC..." type="model" sumI="5.34" maxI="35986.9" fI="359.869" act="0" > - + bool is_ok = true; // logger.debug("startElementgroup begin"); // <group label="performance parameters" type="parameters"> _current_group_label = attrs.value("label"); @@ -128,118 +131,127 @@ bool XtandemSaxHandler::startElement_group(QXmlAttributes attrs) { _charge = attrs.value("z").toUInt(); //_retention_time = attrs.value("rt"); } + return is_ok; } bool XtandemSaxHandler::startElement_note(QXmlAttributes attributes) { //<note label="description">GRMZM2G083841_P01 P04711 Phosphoenolpyruvate carboxylase 1 (PEPCase 1)(PEPC 1)(EC //4.1.1.31) seq=translation; coord=9:61296279..61301686:1; parent_transcript=GRMZM2G083841_T01; ////parent_gene=GRMZM2G083841</note> + bool is_ok = true; _is_protein_description = false; if (attributes.value("label") == "description") { if (_tag_stack[_tag_stack.size() - 2] == "protein") { _is_protein_description = true; } } + return is_ok; } bool XtandemSaxHandler::startElement_protein(QXmlAttributes attributes) { //<protein expect="-704.6" id="1976.1" uid="195701" label="GRMZM2G083841_P01 P04711 Phosphoenolpyruvate carboxylase 1 (PEPCase 1)(PEPC 1)(EC..." sumI="9.36" > - - qDebug() << "startElement_protein "; + bool is_ok = true; + //qDebug() << "startElement_protein begin"; QString accession = attributes.value("label").simplified().split(" ", QString::SkipEmptyParts).at(0); - ProteinMatch * p_protein_match = _p_identification_group->getProteinMatch(accession); + //qDebug() << "startElement_protein accession" << accession; + _p_protein_match = _p_identification_group->getProteinMatch(accession); + //qDebug() << "startElement_protein p_protein_match 1 " << _p_protein_match; _current_protein.setAccession(accession); - if (p_protein_match == nullptr) { + 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); } + //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)); - qDebug() << "startElement_protein end" ; - return true; + _p_protein_match->setProteinXtpSp(_p_project->getProteinStore().getInstance(sp_xtp_protein)); + + _p_identification_group->addProteinMatch(_p_protein_match); + //qDebug() << "startElement_protein end" ; + return is_ok; } bool XtandemSaxHandler::startElement_file(QXmlAttributes attributes) { + bool is_ok = true; //<file type="peptide" URL="/gorgone/pappso/formation/TD/Database/Genome_Z_mays_5a.fasta"/> if (attributes.value("type") == "peptide") { //prot_.setDatabase(identification_.getDatabaseSet().getInstance( - // attrs.getValue("URL"))); + // attrs.getValue("URL"))); } + return is_ok; } bool XtandemSaxHandler::startElement_domain(QXmlAttributes attributes) { //<domain id="1976.1.1" start="620" end="629" expect="9.7e-04" mh="1120.5307" delta="-0.0012" hyperscore="29.9" //nextscore="10.2" y_score="10.4" y_ions="7" b_score="11.2" b_ions="3" pre="QLYR" post="RYGV" //seq="AQEEMAQVAK" missed_cleavages="0"> - qDebug() << "startElement_domain "; + bool is_ok = true; + _current_text = _current_text.simplified().replace(" ", ""); + if (!_current_text.isEmpty()) { + _p_protein_match->getProteinXtpSp().get()->setSequence(_current_text); + } + + // <domain id="4017.1.1" start="21" end="31" expect="2.0e-06" + // mh="1263.575" + // delta="0.998" hyperscore="32.9" nextscore="12.2" y_score="10.7" + // y_ions="9" b_score="0.0" b_ions="0" + // pre="VLGR" post="VEFM" seq="TGSQGQCTQVR" missed_cleavages="10"> + + // valeur généric du scan + _current_peptide_sp = PeptideXtp(attributes.value("seq").simplified()).makePeptideXtpSp(); + _p_peptide_match = new PeptideMatch(_sp_msrun.get(), attributes.value("id").simplified().section(".",0,0).toUInt()); + + _p_peptide_match->setRetentionTime(_retention_time); + _p_peptide_match->setEvalue(attributes.value("expect").simplified().toDouble()); + + pappso::pappso_double xtandem_mhtheo = attributes.value("mh").simplified().toDouble(); + pappso::pappso_double xtandem_delta = attributes.value("delta").simplified().toDouble(); + + pappso::pappso_double exp_mass = xtandem_mhtheo - xtandem_delta; - MsRunSp ms_run = _p_project->getMsRunStore().getInstance(attributes.value("value").simplified()); - ms_run.get()->setXmlId(attributes.value("value").simplified()); - ms_run.get()->setFilename(attributes.value("value").simplified()); - _p_identification_group->addMsRunSp(ms_run); - qDebug() << "startElement_domain end" ; - return true; -} -bool XtandemSaxHandler::startElement_peptide(QXmlAttributes attributes) { - -//<peptide sample="20120208_Blein_rep4_1_B03_DW21-4-26-328" - //sample_file="/gorgone/pappso/moulon/users/Melisande/test-param-masschroq/20120208_Blein_rep4_1_B03_DW21-4-26-328.xml" - //scan="2589" scan_in_xtandem="2589" RT="603" mhplus_obser="873.5401" mhplus_theo="873.5408" deltamass="-7.0E-4" - //sequence="IATAIEKK" pre="NPAR" post="AADA" start="331" stop="338" charge="2" evalue="9.2E-4" hypercorr="35.2" validate="true"> -//<modifs></modifs></peptide> - - //<modifs><modif aa="M" modvalue="15.99491" posi="17" posi_in_prot="49"/> -//</modifs> - qDebug() << "startElement_peptide "; - _current_peptide_sp = PeptideXtp(attributes.value("sequence").simplified()).makePeptideXtpSp(); - MsRunSp ms_run_id = _p_project->getMsRunStore().getInstance(attributes.value("sample").simplified()); - _p_peptide_match = new PeptideMatch(ms_run_id.get(), attributes.value("scan").simplified().toUInt()); - _p_peptide_match->setRetentionTime(attributes.value("RT").simplified().toDouble()); - _p_peptide_match->setEvalue(attributes.value("evalue").simplified().toDouble()); - pappso::pappso_double exp_mass = attributes.value("mhplus_obser").simplified().toDouble() - pappso::MHPLUS; _p_peptide_match->setExperimentalMass(exp_mass); _p_peptide_match->setStart(attributes.value("start").simplified().toUInt()-1); - _p_peptide_match->setCharge(attributes.value("charge").simplified().toUInt()); - - _p_peptide_match->setCharge(attributes.value("charge").simplified().toUInt()); + _p_peptide_match->setCharge(_charge); - IdentificationDataSource* p_identification_data_source = _p_project->getIdentificationDataSourceStore().getInstance(attributes.value("sample_file").simplified()).get(); - _p_peptide_match->setIdentificationDataSource( p_identification_data_source); - if (p_identification_data_source->getMsRunSp().get() == nullptr) { - p_identification_data_source->setMsRunSp(ms_run_id); - } - if (p_identification_data_source->getMsRunSp().get() != ms_run_id.get()) { - throw pappso::PappsoException(QObject::tr("p_identification_data_source->getMsRunSp().get() != ms_run_id.get()")); - } + _p_peptide_match->setIdentificationDataSource( _p_identification_data_source); _p_peptide_match->setChecked(false); if (attributes.value("validate").simplified().toLower() == "true") { _p_peptide_match->setChecked(true); } _p_protein_match->addPeptideMatch(_p_peptide_match); - qDebug() << "startElement_peptide end" ; - return true; + + + + // missing informations + //peptide.set_hypercorr(Float.valueOf(attrs.getValue("hyperscore"))); + //peptide.set_pre(attrs.getValue("pre")); + //peptide.set_post(attrs.getValue("post")); + //qDebug() << "startElement_domain end" ; + return is_ok; } bool XtandemSaxHandler::startElement_aa(QXmlAttributes attributes) { //<aa type="M" at="624" modified="15.99491" /> + bool is_ok = true; qDebug() << "startElement_aa "; - pappso::AaModificationP modif = _map_massstr_aamod[attributes.value("modvalue").simplified()]; - unsigned int position = attributes.value("posi").simplified().toUInt(); - _current_peptide_sp.get()->addAaModification(modif, position-1); + pappso::AaModificationP modif = getAaModificationP(attributes.value("modified").simplified().toDouble()); + unsigned int position_in_prot = attributes.value("at").simplified().toUInt()-1; + _current_peptide_sp.get()->addAaModification(modif, position_in_prot-_p_peptide_match->getStart()); qDebug() << "startElement_aa end" ; - return true; + return is_ok; } bool XtandemSaxHandler::endElement_note() { //<note label="description">GRMZM2G083841_P01 P04711 Phosphoenolpyruvate carboxylase 1 (PEPCase 1)(PEPC 1)(EC //4.1.1.31) seq=translation; coord=9:61296279..61301686:1; parent_transcript=GRMZM2G083841_T01; ////parent_gene=GRMZM2G083841</note> + bool is_ok = true; if (_is_protein_description) { _p_protein_match->getProteinXtpSp().get()->setDescription(_current_text.section(" ",1)); } - return true; + return is_ok; } diff --git a/src/input/xtandemsaxhandler.h b/src/input/xtandemsaxhandler.h index c1864f9d81f58ea89d7cad090c2b478079f34d62..f129e5c30d53b0777e1de5c6ef60b95e50a1604b 100644 --- a/src/input/xtandemsaxhandler.h +++ b/src/input/xtandemsaxhandler.h @@ -43,7 +43,8 @@ class XtandemSaxHandler: public QXmlDefaultHandler { public: - XtandemSaxHandler(Project * p_project, IdentificationGroup * p_identification_group); + XtandemSaxHandler(Project * p_project, IdentificationGroup * p_identification_group, + IdentificationDataSource * p_identification_data_source); ~XtandemSaxHandler(); bool startElement(const QString & namespaceURI, const QString & localName, @@ -65,15 +66,14 @@ public: private: - bool startElement_group(QXmlAttributes attrs); - bool startElement_peptide(QXmlAttributes attributes); + bool startElement_group(QXmlAttributes attrs); bool startElement_protein(QXmlAttributes attributes); bool startElement_note(QXmlAttributes attributes); bool startElement_file(QXmlAttributes attributes); bool startElement_aa(QXmlAttributes attributes); bool startElement_domain(QXmlAttributes attributes); bool endElement_note(); - + pappso::AaModificationP getAaModificationP(pappso::mz mass) const; private: @@ -83,14 +83,16 @@ private: Project * _p_project; IdentificationGroup * _p_identification_group; - + IdentificationDataSource * _p_identification_data_source; + MsRunSp _sp_msrun; + ProteinMatch * _p_protein_match; PeptideMatch * _p_peptide_match; ProteinXtp _current_protein; PeptideXtpSp _current_peptide_sp; - + QMap<QString, pappso::AaModificationP> _map_massstr_aamod; - + QString _current_group_label; QString _current_group_type; unsigned int _scan;