| 206 | } |
| 207 | |
| 208 | void ModificationsDB::searchModifications(set<const ResidueModification*>& mods, |
| 209 | const String& mod_name_, |
| 210 | const String& residue, |
| 211 | ResidueModification::TermSpecificity term_spec) const |
| 212 | { |
| 213 | mods.clear(); |
| 214 | |
| 215 | String mod_name = mod_name_; |
| 216 | |
| 217 | char res = '?'; // empty |
| 218 | if (!residue.empty()) res = residue[0]; |
| 219 | |
| 220 | #pragma omp critical(OpenMS_ModificationsDB) |
| 221 | { |
| 222 | bool found = true; |
| 223 | auto modifications = modification_names_.find(mod_name); |
| 224 | if (modifications == modification_names_.end()) |
| 225 | { |
| 226 | // Try to fix things, Skyline for example uses unimod:10 and not UniMod:10 syntax |
| 227 | if (mod_name.size() > 6 && mod_name.prefix(6).toLower() == "unimod") |
| 228 | { |
| 229 | mod_name = "UniMod" + mod_name.substr(6, mod_name.size() - 6); |
| 230 | } |
| 231 | |
| 232 | modifications = modification_names_.find(mod_name); |
| 233 | if (modifications == modification_names_.end()) |
| 234 | { |
| 235 | OPENMS_LOG_WARN << OPENMS_PRETTY_FUNCTION << "Modification not found: " << mod_name << endl; |
| 236 | found = false; |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | if (found) |
| 241 | { |
| 242 | for (const auto& it : modifications->second) |
| 243 | { |
| 244 | if ( residuesMatch_(res, it) && |
| 245 | (term_spec == ResidueModification::NUMBER_OF_TERM_SPECIFICITY || |
| 246 | (term_spec == it->getTermSpecificity()))) |
| 247 | { |
| 248 | mods.insert(it); |
| 249 | } |
| 250 | } |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | const ResidueModification* ModificationsDB::getModification(const String& mod_name, const String& residue, ResidueModification::TermSpecificity term_spec) const |
| 256 | { |