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()
}
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) {
......
......@@ -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);
......
......@@ -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) {
......
......@@ -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;
......
......@@ -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);
}
}
......
......@@ -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;
......
......@@ -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) {
......
......@@ -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;
......
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