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

accept empty labels for unmodified peptides

parent 02ae941f
No related branches found
No related tags found
No related merge requests found
...@@ -85,7 +85,8 @@ Label::containsAaModificationP( ...@@ -85,7 +85,8 @@ Label::containsAaModificationP(
{ {
for(LabelModification label_modification : _modification_list) for(LabelModification label_modification : _modification_list)
{ {
if(std::find(modification_set.begin(), modification_set.end(), if(std::find(modification_set.begin(),
modification_set.end(),
label_modification.modification) != modification_set.end()) label_modification.modification) != modification_set.end())
{ {
return true; return true;
...@@ -142,3 +143,11 @@ Label::writeMassChroqMl(QXmlStreamWriter *output_stream) const ...@@ -142,3 +143,11 @@ Label::writeMassChroqMl(QXmlStreamWriter *output_stream) const
// </isotope_label> // </isotope_label>
output_stream->writeEndElement(); output_stream->writeEndElement();
} }
bool
Label::isEmpty() const
{
if(_modification_list.size() == 0)
return true;
return false;
}
...@@ -57,6 +57,7 @@ class Label ...@@ -57,6 +57,7 @@ class Label
const QString &getXmlId() const; const QString &getXmlId() const;
const std::vector<LabelModification> &getLabelModifictionList() const; const std::vector<LabelModification> &getLabelModifictionList() const;
bool isEmpty() const;
private: private:
QString _xml_id; QString _xml_id;
......
...@@ -70,17 +70,23 @@ LabelingMethod::LabelingMethod(const QString &method_id) : _xml_id(method_id) ...@@ -70,17 +70,23 @@ LabelingMethod::LabelingMethod(const QString &method_id) : _xml_id(method_id)
} }
Label * const Label *
LabelingMethod::getLabel( LabelingMethod::getLabel(
const std::list<pappso::AaModificationP> &modification_set) const const std::list<pappso::AaModificationP> &modification_set) const
{ {
for(Label *p_label : _label_list) for(Label *p_label : _label_list)
{ {
if(p_label->containsAaModificationP(modification_set)) if(p_label->containsAaModificationP(modification_set))
{ {
return p_label; return p_label;
} }
} }
auto p_empty_label = getEmptyLabel();
if(p_empty_label != nullptr)
{
return p_empty_label;
}
return nullptr; return nullptr;
} }
...@@ -152,3 +158,14 @@ LabelingMethod::getLabelList() const ...@@ -152,3 +158,14 @@ LabelingMethod::getLabelList() const
{ {
return _label_list; return _label_list;
} }
const Label *
LabelingMethod::getEmptyLabel() const
{
for(const Label *p_label : _label_list)
{
if(p_label->isEmpty())
return p_label;
}
return nullptr;
}
...@@ -47,12 +47,14 @@ class LabelingMethod ...@@ -47,12 +47,14 @@ class LabelingMethod
LabelingMethod(const LabelingMethod &other); LabelingMethod(const LabelingMethod &other);
~LabelingMethod(); ~LabelingMethod();
LabelingMethodSp makeLabelingMethodSp() const; LabelingMethodSp makeLabelingMethodSp() const;
Label * const Label *
getLabel(const std::list<pappso::AaModificationP> &modification_set) const; getLabel(const std::list<pappso::AaModificationP> &modification_set) const;
const QString &getXmlId() const; const QString &getXmlId() const;
void writeMassChroqMl(QXmlStreamWriter *output_stream) const; void writeMassChroqMl(QXmlStreamWriter *output_stream) const;
const std::vector<Label *> &getLabelList() const; const std::vector<Label *> &getLabelList() const;
const Label *getEmptyLabel() const;
private: private:
void parseMethod(QDomNode &method_node); void parseMethod(QDomNode &method_node);
void parseLabel(QDomNode &method_node); void parseLabel(QDomNode &method_node);
......
...@@ -127,7 +127,7 @@ PeptideXtp::applyLabelingMethod(LabelingMethodSp labeling_method_sp) ...@@ -127,7 +127,7 @@ PeptideXtp::applyLabelingMethod(LabelingMethodSp labeling_method_sp)
modification_set.unique(); modification_set.unique();
_p_label = nullptr; _p_label = nullptr;
Label *p_label = labeling_method_sp.get()->getLabel(modification_set); const Label *p_label = labeling_method_sp.get()->getLabel(modification_set);
if(p_label != nullptr) if(p_label != nullptr)
{ {
_p_label = p_label; _p_label = p_label;
......
...@@ -77,7 +77,7 @@ class PeptideXtp : public pappso::Peptide ...@@ -77,7 +77,7 @@ class PeptideXtp : public pappso::Peptide
*/ */
pappso::PeptideSp _sp_native_peptide = nullptr; pappso::PeptideSp _sp_native_peptide = nullptr;
Label *_p_label = nullptr; const Label *_p_label = nullptr;
}; };
#endif // PEPTIDEXTP_H #endif // PEPTIDEXTP_H
...@@ -22,5 +22,7 @@ ...@@ -22,5 +22,7 @@
<mod at="R" value="6.02" acc="MOD:01331"/> <mod at="R" value="6.02" acc="MOD:01331"/>
<mod at="K" value="4.01" acc="MOD:00942"/> <mod at="K" value="4.01" acc="MOD:00942"/>
</isotope_label> </isotope_label>
<isotope_label id="light">
</isotope_label>
</isotope_label_list> </isotope_label_list>
</catalog> </catalog>
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