| 153 | } |
| 154 | |
| 155 | void UnimodXMLHandler::endElement(const XMLCh* const /*uri*/, const XMLCh* const /*local_name*/, const XMLCh* const qname) |
| 156 | { |
| 157 | tag_ = String(sm_.convert(qname)); |
| 158 | |
| 159 | // write the modifications to vector |
| 160 | if (tag_ == "umod:mod" || tag_ == "mod") |
| 161 | { |
| 162 | modification_->setDiffAverageMass(avge_mass_); |
| 163 | modification_->setDiffMonoMass(mono_mass_); |
| 164 | modification_->setDiffFormula(diff_formula_); |
| 165 | for (Size i = 0; i != sites_.size(); ++i) |
| 166 | { |
| 167 | ResidueModification* new_mod = new ResidueModification(*modification_); |
| 168 | new_mod->setOrigin(sites_[i]); |
| 169 | new_mod->setTermSpecificity(term_specs_[i]); |
| 170 | new_mod->setNeutralLossDiffFormulas(neutral_loss_diff_formulas_[i]); |
| 171 | modifications_.push_back(new_mod); |
| 172 | } |
| 173 | |
| 174 | avge_mass_ = 0.0; |
| 175 | mono_mass_ = 0.0; |
| 176 | diff_formula_ = EmpiricalFormula(); |
| 177 | term_specs_.clear(); |
| 178 | sites_.clear(); |
| 179 | neutral_loss_diff_formulas_.clear(); |
| 180 | |
| 181 | delete modification_; |
| 182 | return; |
| 183 | } |
| 184 | |
| 185 | if (tag_ == "umod:specificity" || tag_ == "specificity") |
| 186 | { |
| 187 | if (was_valid_peptide_modification_) // as we exclude "Protein" modifications (see above) |
| 188 | { |
| 189 | neutral_loss_diff_formulas_.push_back(neutral_loss_diff_formula_); |
| 190 | modification_->setNeutralLossMonoMasses(neutral_loss_mono_masses_); |
| 191 | modification_->setNeutralLossAverageMasses(neutral_loss_avg_masses_); |
| 192 | neutral_loss_diff_formula_.clear(); |
| 193 | neutral_loss_mono_masses_.clear(); |
| 194 | neutral_loss_avg_masses_.clear(); |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | if ( (tag_ == "umod:NeutralLoss" || tag_ == "NeutralLoss") && !diff_formula_.isEmpty() ) |
| 199 | { |
| 200 | // now diff_formula_ contains the neutral loss diff formula |
| 201 | neutral_loss_diff_formula_.push_back(diff_formula_); |
| 202 | neutral_loss_mono_masses_.push_back(mono_mass_); |
| 203 | neutral_loss_avg_masses_.push_back(avge_mass_); |
| 204 | avge_mass_ = 0.0; |
| 205 | mono_mass_ = 0.0; |
| 206 | diff_formula_ = EmpiricalFormula(); |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | void UnimodXMLHandler::characters(const XMLCh* const /*chars*/, const XMLSize_t /*length*/) |
| 211 | { |
nothing calls this directly
no test coverage detected