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

Method addReferenceFormat

src/openms/source/METADATA/SpectrumLookup.cpp:107–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105
106
107 void SpectrumLookup::addReferenceFormat(const String& regexp)
108 {
109 // does the reg. exp. contain any of the recognized group names?
110 bool found = false;
111 for (vector<String>::iterator it = regexp_name_list_.begin();
112 it != regexp_name_list_.end(); ++it)
113 {
114 if (regexp.hasSubstring("?<" + (*it) + ">"))
115 {
116 found = true;
117 break;
118 }
119 }
120 if (!found)
121 {
122 String msg = "The regular expression describing the reference format must contain at least one of the following named groups (in the format '?<GROUP>'): " + regexp_names_;
123 throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
124 msg);
125 }
126
127 boost::regex re(regexp);
128 reference_formats.push_back(re);
129 }
130
131
132 Size SpectrumLookup::findByRegExpMatch_(const String& spectrum_ref,

Callers 5

main_Method · 0.80
loadMethod · 0.80
initializeLookupMethod · 0.80

Calls 4

hasSubstringMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected