From 29e9d01b0de84a0883fa548dc13af8596c536b4c Mon Sep 17 00:00:00 2001 From: Olivier Langella <olivier.langella@u-psud.fr> Date: Sun, 4 Mar 2018 23:15:55 +0100 Subject: [PATCH] WIP: Mascot parser --- src/input/mascot/mascotdatparser.cpp | 28 ++++++++++++++++++++++++++-- src/input/mascot/mascotdatparser.h | 2 ++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/input/mascot/mascotdatparser.cpp b/src/input/mascot/mascotdatparser.cpp index 21ed9da84..1ef92308c 100644 --- a/src/input/mascot/mascotdatparser.cpp +++ b/src/input/mascot/mascotdatparser.cpp @@ -31,7 +31,8 @@ #include "mimeparser.h" #include <QDebug> #include <pappsomspp/pappsoexception.h> -#include <pappsomspp/peptide/peptide.h> +#include "../../core/peptidextp.h" +#include "../../core/proteinmatch.h" MascotDatParser::MascotDatParser(Project * p_project, IdentificationGroup * p_identification_group, IdentificationDataSource * p_identification_data_source) { @@ -120,6 +121,7 @@ void MascotDatParser::parseHeaderLine(const QString & header_line) { else if (header_list[1].startsWith("queries")) { qDebug() << "queries=" << header_list[2]; _number_of_queries = header_list[2].toUInt(); + _query_peptide_results.resize(_number_of_queries); } //min_peaks_for_homology=6 //max_hits=50 @@ -150,6 +152,8 @@ void MascotDatParser::parseHeaderLine(const QString & header_line) { void MascotDatParser::saveAndClearPeptide() { qDebug() << "MascotDatParser::saveAndClearPeptide begin"; if (_current_peptide.query_index > 0) { + // save + _query_peptide_results[_current_peptide.query_index-1].push_back(_current_peptide); //parse and save QString peptide_str =_current_peptide.peptide_string_list.at(4); @@ -161,7 +165,9 @@ void MascotDatParser::saveAndClearPeptide() { peptide_str = peptide_str.replace(subst_list.at(0+i).toInt()-1,1,subst_list.at(2+i)); } } - pappso::Peptide peptide(peptide_str); + PeptideXtpSp peptide_sp; + peptide_sp = PeptideXtp(peptide_str).makePeptideXtpSp(); + peptide_sp = _p_project->getPeptideStore().getInstance(peptide_sp); if (_current_peptide.protein_string_list.size() != _current_peptide.fasta_file_list.size()) { throw pappso::PappsoException(QObject::tr("ERROR (_current_peptide.protein_string_list.size() != _current_peptide.fasta_file_list.size()) %1").arg(_current_peptide.protein_string_list.join(",\""))); @@ -178,6 +184,24 @@ void MascotDatParser::saveAndClearPeptide() { } unsigned int start = position_list.at(1).toUInt(); unsigned int stop = position_list.at(2).toUInt(); + + ProteinXtp protein; + protein.setAccession(accession); + + ProteinMatch * p_protein_match = _p_identification_group->getProteinMatchInstance(protein.getAccession()); + if (p_protein_match == nullptr) { + throw pappso::PappsoException(QObject::tr("ERROR (p_protein_match == nullptr) %1").arg(str)); + } + + ProteinXtpSp sp_xtp_protein = protein.makeProteinXtpSp(); + p_protein_match->setProteinXtpSp(_p_project->getProteinStore().getInstance(sp_xtp_protein)); + p_protein_match->setChecked(true); + + PeptideMatch peptide_match; + peptide_match.setStart(start); + //peptide_match.setPeptideEvidenceSp(); + + p_protein_match->addPeptideMatch(peptide_match); } } diff --git a/src/input/mascot/mascotdatparser.h b/src/input/mascot/mascotdatparser.h index c349ff68c..23f387754 100644 --- a/src/input/mascot/mascotdatparser.h +++ b/src/input/mascot/mascotdatparser.h @@ -71,6 +71,8 @@ private: PeptideLine _current_peptide; + std::vector<std::vector<PeptideLine>> _query_peptide_results; + }; -- GitLab