MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / writeModParam_

Method writeModParam_

src/openms/source/FORMAT/HANDLERS/MzIdentMLHandler.cpp:1008–1054  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1006 }
1007
1008 void MzIdentMLHandler::writeModParam_(String& s, const std::vector<String>& mod_names, bool fixed, UInt indent) const
1009 {
1010 String cv_ns = unimod_.name();
1011 for (std::vector<String>::const_iterator it = mod_names.begin(); it != mod_names.end(); ++it)
1012 {
1013 std::set<const ResidueModification*> mods;
1014 ModificationsDB::getInstance()->searchModifications(mods, *it);
1015 if (!mods.empty())
1016 {
1017 // @TODO: if multiple mods match, we write all of them?
1018 for (std::set<const ResidueModification*>::const_iterator mt = mods.begin(); mt != mods.end(); ++mt)
1019 {
1020 char origin = (*mt)->getOrigin();
1021 if (origin == 'X') origin = '.'; // terminal without res. spec.
1022
1023 s += String(indent + 1, '\t') + "<SearchModification fixedMod=\"" + (fixed ? "true" : "false") + "\" massDelta=\"" + String((*mt)->getDiffMonoMass()) + "\" residues=\"" + origin + "\">\n";
1024
1025 // @TODO: handle protein C-term/N-term
1026 ResidueModification::TermSpecificity spec = (*mt)->getTermSpecificity();
1027 if ((spec == ResidueModification::C_TERM) || (spec == ResidueModification::N_TERM))
1028 {
1029 const String& cv_name = "modification specificity peptide " + (*mt)->getTermSpecificityName();
1030 s += String(indent + 2, '\t') + "<SpecificityRules>\n";
1031 s += String(indent + 3, '\t') + cv_.getTermByName(cv_name).toXMLString(cv_ns) + "\n";
1032 s += String(indent + 2, '\t') + "</SpecificityRules>\n";
1033 }
1034
1035 String ac = (*mt)->getUniModAccession();
1036 if (ac.hasPrefix("UniMod:")) ac = "UNIMOD:" + ac.suffix(':');
1037 if (!ac.empty())
1038 {
1039 s += String(indent + 2, '\t') + unimod_.getTerm(ac).toXMLString(cv_ns) + "\n";
1040 }
1041 else
1042 {
1043 s += String(indent + 2, '\t') + "<cvParam cvRef=\"MS\" accession=\"MS:1001460\" name=\"unknown modification\"/>\n";
1044 }
1045 s += String(indent + 1, '\t') + "</SearchModification>\n";
1046 }
1047 }
1048 else
1049 {
1050 String message = String("Registered ") + (fixed ? "fixed" : "variable") + " modification '" + *it + "' is unknown and will be ignored.";
1051 throw Exception::ElementNotFound(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, message);
1052 }
1053 }
1054 }
1055
1056 void MzIdentMLHandler::writeFragmentAnnotations_(String& s, const std::vector<PeptideHit::PeakAnnotation>& annotations, UInt indent, bool is_ppxl) const
1057 {

Callers

nothing calls this directly

Calls 14

getInstanceFunction · 0.85
searchModificationsMethod · 0.80
getDiffMonoMassMethod · 0.80
getUniModAccessionMethod · 0.80
StringClass · 0.50
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
getOriginMethod · 0.45
getTermSpecificityMethod · 0.45
toXMLStringMethod · 0.45

Tested by

no test coverage detected