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

new group functions

parent 81b7860f
No related branches found
No related tags found
No related merge requests found
...@@ -42,6 +42,10 @@ IdentificationGroup::~IdentificationGroup() ...@@ -42,6 +42,10 @@ IdentificationGroup::~IdentificationGroup()
} }
const GroupStore & IdentificationGroup::getGroupStore() const {
return _group_store;
}
unsigned int IdentificationGroup::countDecoyPeptideMatch(ValidationState state) const { unsigned int IdentificationGroup::countDecoyPeptideMatch(ValidationState state) const {
unsigned int i=0; unsigned int i=0;
for (auto & p_protein_match : _protein_match_list) { for (auto & p_protein_match : _protein_match_list) {
......
...@@ -45,6 +45,7 @@ public: ...@@ -45,6 +45,7 @@ public:
~IdentificationGroup(); ~IdentificationGroup();
ProteinMatch * getProteinMatchInstance(const QString accession); ProteinMatch * getProteinMatchInstance(const QString accession);
const GroupStore & getGroupStore() const;
void addProteinMatch(ProteinMatch * protein_match); void addProteinMatch(ProteinMatch * protein_match);
std::vector<ProteinMatch *> & getProteinMatchList(); std::vector<ProteinMatch *> & getProteinMatchList();
void addMsRunSp(MsRunSp ms_run_sp); void addMsRunSp(MsRunSp ms_run_sp);
......
...@@ -137,6 +137,11 @@ std::size_t GroupingGroup::countSpecificSequence(const ProteinMatch * p_protein_ ...@@ -137,6 +137,11 @@ std::size_t GroupingGroup::countSpecificSequence(const ProteinMatch * p_protein_
return count; 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) { void GroupingGroup::add(const ProteinMatch * p_protein_match) {
_group_number = p_protein_match->getGrpProteinSp().get()->getGroupNumber(); _group_number = p_protein_match->getGrpProteinSp().get()->getGroupNumber();
if (p_protein_match->getGrpProteinSp().get()->getRank() == 1) { if (p_protein_match->getGrpProteinSp().get()->getRank() == 1) {
......
...@@ -57,6 +57,11 @@ public: ...@@ -57,6 +57,11 @@ public:
* */ * */
const QStringList getSubgroupIdList(const PeptideMatch * p_peptide_match) const; 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; const std::vector<std::pair<unsigned int, const PeptideMatch *>> & getPairSgNumberPeptideMatchList() const;
......
...@@ -339,23 +339,33 @@ void MassChroQml::writeIsotopeLabelList() { ...@@ -339,23 +339,33 @@ void MassChroQml::writeIsotopeLabelList() {
void MassChroQml::writePeptideList() { void MassChroQml::writePeptideList() {
//<peptide_list> //<peptide_list>
_output_stream->writeStartElement("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; std::vector<McqPeptide> mcq_peptide_list;
for (ProteinMatch * p_protein_match :_p_identification_group->getProteinMatchList()) {
if (!p_protein_match->isGrouped()) continue; for (auto & sg_peptide_pair :sg_peptide_match_list) {
for (PeptideMatch * peptide_match :p_protein_match->getPeptideMatchList()) { unsigned int sg_number = sg_peptide_pair.first;
if (!peptide_match->isGrouped()) continue; const PeptideMatch * peptide_match = sg_peptide_pair.second;
McqPeptide mcq_peptide; McqPeptide mcq_peptide;
mcq_peptide.id = peptide_match->getGrpPeptideSp().get()->getGroupingId(); mcq_peptide.id = peptide_match->getGrpPeptideSp().get()->getGroupingId();
mcq_peptide.mods << peptide_match->getPeptideXtpSp().get()->getModifString(); 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.seq = peptide_match->getPeptideXtpSp().get()->getSequence();
mcq_peptide.native_peptide = peptide_match->getPeptideXtpSp().get()->getNativePeptideP(); mcq_peptide.native_peptide = peptide_match->getPeptideXtpSp().get()->getNativePeptideP();
mcq_peptide.data.push_back(peptide_match->getMsRunP()->getXmlId()); mcq_peptide.data.push_back(peptide_match->getMsRunP()->getXmlId());
mcq_peptide.scan.push_back(peptide_match->getScan()); mcq_peptide.scan.push_back(peptide_match->getScan());
mcq_peptide.charge.push_back(peptide_match->getCharge()); mcq_peptide.charge.push_back(peptide_match->getCharge());
mcq_peptide_list.push_back(mcq_peptide); mcq_peptide_list.push_back(mcq_peptide);
}
} }
......
...@@ -48,12 +48,14 @@ private: ...@@ -48,12 +48,14 @@ private:
void writeGroups(); void writeGroups();
void writeProteinList(); void writeProteinList();
void writePeptideList(); void writePeptideList();
void writePeptideListInGroup(const GroupingGroup * p_group);
void writeIsotopeLabelList(); void writeIsotopeLabelList();
void writeAlignments(); void writeAlignments();
void writeQuantificationMethods(); void writeQuantificationMethods();
void writeQuantificationResults(); void writeQuantificationResults();
void writeQuantificationTraces(); void writeQuantificationTraces();
void writeQuantify(); void writeQuantify();
private : private :
QFile * _output_file; QFile * _output_file;
QXmlStreamWriter * _output_stream; QXmlStreamWriter * _output_stream;
......
...@@ -57,6 +57,9 @@ std::size_t GroupStore::countSubGroup() const { ...@@ -57,6 +57,9 @@ std::size_t GroupStore::countSubGroup() const {
return count; return count;
} }
const std::map<unsigned int, GroupingGroupSp> & GroupStore::getGroupMap() const {
return _map_group;
}
GroupingGroupSp GroupStore::getInstance(unsigned int group_number) { GroupingGroupSp GroupStore::getInstance(unsigned int group_number) {
......
...@@ -41,6 +41,8 @@ public: ...@@ -41,6 +41,8 @@ public:
GroupStore(); GroupStore();
~GroupStore(); ~GroupStore();
GroupingGroupSp getInstance(unsigned int group_number); GroupingGroupSp getInstance(unsigned int group_number);
const std::map<unsigned int, GroupingGroupSp> & getGroupMap() const;
void clear(); void clear();
std::size_t countGroup() const; std::size_t countGroup() const;
std::size_t countSubGroup() const; std::size_t countSubGroup() const;
......
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