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

better masschroqml writer

parent 81658ef7
No related branches found
No related tags found
No related merge requests found
......@@ -36,9 +36,9 @@
struct McqObserved {
bool operator ==(const McqObserved &other) const {
return (data==other.data && scan==other.scan && charge==other.charge);
return (msrun==other.msrun && scan==other.scan && charge==other.charge);
};
QString data;
const MsRun * msrun;
unsigned int scan;
unsigned int charge;
};
......@@ -369,7 +369,7 @@ void MassChroQml::writePeptideListInGroup(const GroupingGroup * p_group) {
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();
McqObserved observed = {peptide_match->getMsRunP()->getXmlId(),peptide_match->getScan(),peptide_match->getCharge() };
McqObserved observed = {peptide_match->getMsRunP(),peptide_match->getScan(),peptide_match->getCharge() };
mcq_peptide.observed_in.push_back(observed);
mcq_peptide_list.push_back(mcq_peptide);
......@@ -446,14 +446,14 @@ void MassChroQml::writePeptideListInGroup(const GroupingGroup * p_group) {
//<observed_in data="samp0" scan="655" z="2" />
std::sort(mcq_peptide.observed_in.begin(), mcq_peptide.observed_in.end(),[](const McqObserved & first, const McqObserved & second) {
return std::tie(first.charge, first.scan, first.data) < std::tie(second.charge, second.scan, second.data);
return std::tie(first.charge, first.scan, first.msrun) < std::tie(second.charge, second.scan, second.msrun);
});
auto last = std::unique(mcq_peptide.observed_in.begin(), mcq_peptide.observed_in.end());
mcq_peptide.observed_in.erase(last, mcq_peptide.observed_in.end());
for (McqObserved observed_in : mcq_peptide.observed_in) {
_output_stream->writeStartElement("observed_in");
_output_stream->writeAttribute("data",observed_in.data);
_output_stream->writeAttribute("data",observed_in.msrun->getXmlId());
_output_stream->writeAttribute("scan",QString("%1").arg(observed_in.scan));
_output_stream->writeAttribute("z",QString("%1").arg(observed_in.charge));
_output_stream->writeEndElement();
......
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