65 typedef typename std::set<const DigestionEnzymeType*>::iterator
EnzymeIterator;
71 static InstanceType* db_ =
nullptr;
74 db_ =
new InstanceType;
116 String(
"Enzyme with regex " + cleavage_regex +
" was not registered in Enzyme DB, register first!").c_str());
127 all_names.push_back((*it)->getName());
164 if (!db_file.empty())
188 if (param.
empty())
return;
190 std::vector<String> split;
192 if (split[0] !=
"Enzymes")
194 throw Exception::ParseError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, split[0],
"name 'Enzymes' expected");
200 String previous_enzyme = split[1];
205 if (split[0] !=
"Enzymes")
break;
206 if (split[1] != previous_enzyme)
210 previous_enzyme = split[1];
213 values[it.getName()] =
String(it->value.toString());
227 DigestionEnzymeType* enzy_ptr =
new DigestionEnzymeType();
231 const String& key = it->first;
232 const String& value = it->second;
233 if (!enzy_ptr->setValueFromFile(key, value))
235 OPENMS_LOG_ERROR <<
"Error while parsing enzymes file: unknown key '" << key <<
"' with value '" << value <<
"'" << std::endl;
247 String name = enzyme->getName();
250 for (std::set<String>::const_iterator it = enzyme->getSynonyms().begin(); it != enzyme->getSynonyms().end(); ++it)
255 if (enzyme->getRegEx() !=
"")
#define OPENMS_LOG_ERROR
Macro to be used if non-fatal error are reported (processing continues)
Definition: LogStream.h:455
Digestion enzyme database (base class)
Definition: DigestionEnzymeDB.h:58
std::set< const DigestionEnzymeType * >::iterator EnzymeIterator
Definition: DigestionEnzymeDB.h:65
Map< String, const DigestionEnzymeType * > enzyme_regex_
index by regex
Definition: DigestionEnzymeDB.h:264
DigestionEnzymeDB(const String &db_file="")
Definition: DigestionEnzymeDB.h:162
DigestionEnzymeDB(const DigestionEnzymeDB &enzymes_db)=delete
copy constructor
Map< String, const DigestionEnzymeType * > enzyme_names_
index by names
Definition: DigestionEnzymeDB.h:262
static InstanceType * getInstance()
this member function serves as a replacement of the constructor
Definition: DigestionEnzymeDB.h:69
const DigestionEnzymeType * getEnzymeByRegEx(const String &cleavage_regex) const
Definition: DigestionEnzymeDB.h:110
ConstEnzymeIterator endEnzyme() const
Definition: DigestionEnzymeDB.h:158
virtual ~DigestionEnzymeDB()
destructor
Definition: DigestionEnzymeDB.h:83
const DigestionEnzymeType * parseEnzyme_(Map< String, String > &values) const
parses an enzyme, given the key/value pairs from an XML file
Definition: DigestionEnzymeDB.h:225
ConstEnzymeIterator beginEnzyme() const
Definition: DigestionEnzymeDB.h:157
void getAllNames(std::vector< String > &all_names) const
returns all the enzyme names (does NOT include synonym names)
Definition: DigestionEnzymeDB.h:122
std::set< const DigestionEnzymeType * >::const_iterator ConstEnzymeIterator
Definition: DigestionEnzymeDB.h:64
void readEnzymesFromFile_(const String &filename)
reads enzymes from the given file
Definition: DigestionEnzymeDB.h:182
const DigestionEnzymeType * getEnzyme(const String &name) const
Definition: DigestionEnzymeDB.h:98
bool hasEnzyme(const DigestionEnzymeType *enzyme) const
returns true if the db contains the enzyme of the given pointer
Definition: DigestionEnzymeDB.h:148
bool hasEnzyme(const String &name) const
returns true if the db contains a enzyme with the given name (supports synonym names)
Definition: DigestionEnzymeDB.h:136
std::set< const DigestionEnzymeType * > const_enzymes_
set of enzymes
Definition: DigestionEnzymeDB.h:266
DigestionEnzymeDB & operator=(const DigestionEnzymeDB &enzymes_db)=delete
assignment operator
bool hasRegEx(const String &cleavage_regex) const
returns true if the db contains a enzyme with the given regex
Definition: DigestionEnzymeDB.h:142
void addEnzyme_(const DigestionEnzymeType *enzyme)
add to internal data; also update indices for search by name and regex
Definition: DigestionEnzymeDB.h:242
Exception base class.
Definition: Exception.h:92
Element could not be found exception.
Definition: Exception.h:670
A method or algorithm argument contains illegal values.
Definition: Exception.h:656
Parse Error exception.
Definition: Exception.h:630
static String find(const String &filename, StringList directories=StringList())
Looks up the location of the file filename.
Map class based on the STL map (containing several convenience functions)
Definition: Map.h:52
The file pendant of the Param class used to load and store the param datastructure as paramXML.
Definition: ParamXMLFile.h:51
void load(const String &filename, Param ¶m)
Read XML file.
Forward const iterator for the Param class.
Definition: Param.h:194
std::string getName() const
Returns the absolute path of the current element (including all sections)
Management and storage of parameters / INI files.
Definition: Param.h:70
ParamIterator begin() const
Begin iterator for the internal tree.
bool empty() const
Returns if there are no entries.
ParamIterator end() const
End iterator for the internal tree.
A more convenient string class.
Definition: String.h:61
bool split(const char splitter, std::vector< String > &substrings, bool quote_protect=false) const
Splits a string into substrings using splitter as delimiter.
String & toLower()
Converts the string to lowercase.
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47