diff --git a/src/core/identificationgroup.cpp b/src/core/identificationgroup.cpp index 2bb1162f6ab7618fca5f1813cc7bf8f6d0c3772b..c66ab899ce19925faf37096e614899f94d7a70b8 100644 --- a/src/core/identificationgroup.cpp +++ b/src/core/identificationgroup.cpp @@ -42,6 +42,10 @@ IdentificationGroup::~IdentificationGroup() } + const GroupStore & IdentificationGroup::getGroupStore() const { + return _group_store; + } + unsigned int IdentificationGroup::countDecoyPeptideMatch(ValidationState state) const { unsigned int i=0; for (auto & p_protein_match : _protein_match_list) { diff --git a/src/core/identificationgroup.h b/src/core/identificationgroup.h index 74ba6ab90b5f1a2ee434078f403869162d620bb2..ee430508a3e6c68a6438b55699ec369de9255020 100644 --- a/src/core/identificationgroup.h +++ b/src/core/identificationgroup.h @@ -45,6 +45,7 @@ public: ~IdentificationGroup(); ProteinMatch * getProteinMatchInstance(const QString accession); + const GroupStore & getGroupStore() const; void addProteinMatch(ProteinMatch * protein_match); std::vector<ProteinMatch *> & getProteinMatchList(); void addMsRunSp(MsRunSp ms_run_sp); diff --git a/src/grouping/groupinggroup.cpp b/src/grouping/groupinggroup.cpp index f5da520f6227655d7b06150309d9516d43baef6b..8c13cad3dd114f76bc683777e02504e18d56fd53 100644 --- a/src/grouping/groupinggroup.cpp +++ b/src/grouping/groupinggroup.cpp @@ -137,6 +137,11 @@ std::size_t GroupingGroup::countSpecificSequence(const ProteinMatch * p_protein_ return count; } + + QString GroupingGroup::getProteinGroupingIdOfSubgroup(unsigned int subgroup_number) const { + return QString("%1%2a1").arg(pappso::Utils::getLexicalOrderedString(_group_number)).arg(pappso::Utils::getLexicalOrderedString(subgroup_number)); + } + void GroupingGroup::add(const ProteinMatch * p_protein_match) { _group_number = p_protein_match->getGrpProteinSp().get()->getGroupNumber(); if (p_protein_match->getGrpProteinSp().get()->getRank() == 1) { diff --git a/src/grouping/groupinggroup.h b/src/grouping/groupinggroup.h index 5d740da7eb970e36f4aba5d57aa4544a6ce7b3e2..a84980b9a13a5d360f83655d5ffcbbaab7da07ac 100644 --- a/src/grouping/groupinggroup.h +++ b/src/grouping/groupinggroup.h @@ -57,6 +57,11 @@ public: * */ const QStringList getSubgroupIdList(const PeptideMatch * p_peptide_match) const; + /** @brief give the protein group id of the representant of a subgroup + * */ + QString getProteinGroupingIdOfSubgroup(unsigned int subgroup_number) const; + + const std::vector<std::pair<unsigned int, const PeptideMatch *>> & getPairSgNumberPeptideMatchList() const; diff --git a/src/output/masschroqml.cpp b/src/output/masschroqml.cpp index b60f05983dc9a40a8d4cb7a8e663ebebd2df9e93..49f5186d970bc3c5b5deb6f4e5a47df809c579f4 100644 --- a/src/output/masschroqml.cpp +++ b/src/output/masschroqml.cpp @@ -339,23 +339,33 @@ void MassChroQml::writeIsotopeLabelList() { void MassChroQml::writePeptideList() { //<peptide_list> _output_stream->writeStartElement("peptide_list"); + const std::map<unsigned int, GroupingGroupSp> & group_store = _p_identification_group->getGroupStore().getGroupMap(); + + for (auto & group_pair :group_store) { + writePeptideListInGroup(group_pair.second.get()); + } +} + +void MassChroQml::writePeptideListInGroup(const GroupingGroup * p_group) { + + const std::vector<std::pair<unsigned int, const PeptideMatch *>> & sg_peptide_match_list = p_group->getPairSgNumberPeptideMatchList(); std::vector<McqPeptide> mcq_peptide_list; - for (ProteinMatch * p_protein_match :_p_identification_group->getProteinMatchList()) { - if (!p_protein_match->isGrouped()) continue; - for (PeptideMatch * peptide_match :p_protein_match->getPeptideMatchList()) { - if (!peptide_match->isGrouped()) continue; + + for (auto & sg_peptide_pair :sg_peptide_match_list) { + unsigned int sg_number = sg_peptide_pair.first; + const PeptideMatch * peptide_match = sg_peptide_pair.second; McqPeptide mcq_peptide; mcq_peptide.id = peptide_match->getGrpPeptideSp().get()->getGroupingId(); mcq_peptide.mods << peptide_match->getPeptideXtpSp().get()->getModifString(); - mcq_peptide.prot_ids << p_protein_match->getGrpProteinSp().get()->getGroupingId(); + mcq_peptide.prot_ids << p_group->getProteinGroupingIdOfSubgroup(sg_number); mcq_peptide.seq = peptide_match->getPeptideXtpSp().get()->getSequence(); mcq_peptide.native_peptide = peptide_match->getPeptideXtpSp().get()->getNativePeptideP(); mcq_peptide.data.push_back(peptide_match->getMsRunP()->getXmlId()); mcq_peptide.scan.push_back(peptide_match->getScan()); mcq_peptide.charge.push_back(peptide_match->getCharge()); mcq_peptide_list.push_back(mcq_peptide); - } + } diff --git a/src/output/masschroqml.h b/src/output/masschroqml.h index ff291ffc01e3603dc52b73f96c3998ae09595280..8eeeb559ff93118ce9dc7587f0c4363d4f662320 100644 --- a/src/output/masschroqml.h +++ b/src/output/masschroqml.h @@ -48,12 +48,14 @@ private: void writeGroups(); void writeProteinList(); void writePeptideList(); + void writePeptideListInGroup(const GroupingGroup * p_group); void writeIsotopeLabelList(); void writeAlignments(); void writeQuantificationMethods(); void writeQuantificationResults(); void writeQuantificationTraces(); void writeQuantify(); + private : QFile * _output_file; QXmlStreamWriter * _output_stream; diff --git a/src/utils/groupstore.cpp b/src/utils/groupstore.cpp index 17c46e71fa183d750ff8d2e278dabda2f49af06a..6371c5fc29486d0a68a67fe4c3663dc7e2b90d32 100644 --- a/src/utils/groupstore.cpp +++ b/src/utils/groupstore.cpp @@ -57,6 +57,9 @@ std::size_t GroupStore::countSubGroup() const { return count; } + const std::map<unsigned int, GroupingGroupSp> & GroupStore::getGroupMap() const { + return _map_group; + } GroupingGroupSp GroupStore::getInstance(unsigned int group_number) { diff --git a/src/utils/groupstore.h b/src/utils/groupstore.h index 7ed6182cfa1cda06cf6ecf16cb7e6765e083ee93..98db1ce5408f9f7c607098d7e18e25664234a5ef 100644 --- a/src/utils/groupstore.h +++ b/src/utils/groupstore.h @@ -41,6 +41,8 @@ public: GroupStore(); ~GroupStore(); GroupingGroupSp getInstance(unsigned int group_number); + const std::map<unsigned int, GroupingGroupSp> & getGroupMap() const; + void clear(); std::size_t countGroup() const; std::size_t countSubGroup() const;