39 typedef typename std::set<const DigestionEnzymeType*>::iterator
EnzymeIterator;
45 static InstanceType* db_ =
nullptr;
48 db_ =
new InstanceType;
90 String(
"Enzyme with regex " + cleavage_regex +
" was not registered in Enzyme DB, register first!").c_str());
101 all_names.push_back((*it)->getName());
138 if (!db_file.empty())
162 if (param.
empty())
return;
164 std::vector<String>
split;
166 if (
split[0] !=
"Enzymes")
173 std::map<String, String> values;
179 if (
split[0] !=
"Enzymes")
break;
180 if (
split[1] != previous_enzyme)
184 previous_enzyme =
split[1];
187 values[it.getName()] =
String(it->value.toString());
199 const DigestionEnzymeType*
parseEnzyme_(std::map<String, String>& values)
const
201 DigestionEnzymeType* enzy_ptr =
new DigestionEnzymeType();
203 for (std::map<String, String>::iterator it = values.begin(); it != values.end(); ++it)
205 const String& key = it->first;
206 const String& value = it->second;
207 if (!enzy_ptr->setValueFromFile(key, value))
209 OPENMS_LOG_ERROR <<
"Error while parsing enzymes file: unknown key '" << key <<
"' with value '" << value <<
"'" << std::endl;
221 String name = enzyme->getName();
224 for (std::set<String>::const_iterator it = enzyme->getSynonyms().begin(); it != enzyme->getSynonyms().end(); ++it)
229 if (enzyme->getRegEx() !=
"")
#define OPENMS_LOG_ERROR
Macro to be used if non-fatal error are reported (processing continues)
Definition: LogStream.h:439
Digestion enzyme database (base class)
Definition: DigestionEnzymeDB.h:32
std::set< const DigestionEnzymeType * >::iterator EnzymeIterator
Definition: DigestionEnzymeDB.h:39
const DigestionEnzymeType * parseEnzyme_(std::map< String, String > &values) const
parses an enzyme, given the key/value pairs from an XML file
Definition: DigestionEnzymeDB.h:199
DigestionEnzymeDB(const String &db_file="")
Definition: DigestionEnzymeDB.h:136
DigestionEnzymeDB(const DigestionEnzymeDB &enzymes_db)=delete
copy constructor
std::map< String, const DigestionEnzymeType * > enzyme_regex_
index by regex
Definition: DigestionEnzymeDB.h:238
static InstanceType * getInstance()
this member function serves as a replacement of the constructor
Definition: DigestionEnzymeDB.h:43
const DigestionEnzymeType * getEnzymeByRegEx(const String &cleavage_regex) const
Definition: DigestionEnzymeDB.h:84
ConstEnzymeIterator endEnzyme() const
Definition: DigestionEnzymeDB.h:132
virtual ~DigestionEnzymeDB()
destructor
Definition: DigestionEnzymeDB.h:57
ConstEnzymeIterator beginEnzyme() const
Definition: DigestionEnzymeDB.h:131
void getAllNames(std::vector< String > &all_names) const
returns all the enzyme names (does NOT include synonym names)
Definition: DigestionEnzymeDB.h:96
std::set< const DigestionEnzymeType * >::const_iterator ConstEnzymeIterator
Definition: DigestionEnzymeDB.h:38
void readEnzymesFromFile_(const String &filename)
reads enzymes from the given file
Definition: DigestionEnzymeDB.h:156
const DigestionEnzymeType * getEnzyme(const String &name) const
Definition: DigestionEnzymeDB.h:72
bool hasEnzyme(const DigestionEnzymeType *enzyme) const
returns true if the db contains the enzyme of the given pointer
Definition: DigestionEnzymeDB.h:122
bool hasEnzyme(const String &name) const
returns true if the db contains a enzyme with the given name (supports synonym names)
Definition: DigestionEnzymeDB.h:110
std::set< const DigestionEnzymeType * > const_enzymes_
set of enzymes
Definition: DigestionEnzymeDB.h:240
DigestionEnzymeDB & operator=(const DigestionEnzymeDB &enzymes_db)=delete
assignment operator
std::map< String, const DigestionEnzymeType * > enzyme_names_
index by names
Definition: DigestionEnzymeDB.h:236
bool hasRegEx(const String &cleavage_regex) const
returns true if the db contains a enzyme with the given regex
Definition: DigestionEnzymeDB.h:116
void addEnzyme_(const DigestionEnzymeType *enzyme)
add to internal data; also update indices for search by name and regex
Definition: DigestionEnzymeDB.h:216
Exception base class.
Definition: Exception.h:63
Element could not be found exception.
Definition: Exception.h:653
A method or algorithm argument contains illegal values.
Definition: Exception.h:629
Parse Error exception.
Definition: Exception.h:592
static String find(const String &filename, StringList directories=StringList())
Looks up the location of the file filename.
The file pendant of the Param class used to load and store the param datastructure as paramXML (i....
Definition: ParamXMLFile.h:25
void load(const String &filename, Param ¶m)
Read XML file.
Forward const iterator for the Param class.
Definition: Param.h:168
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:44
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:34
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.
static bool split(const String &this_s, const char splitter, std::vector< String > &substrings, bool quote_protect)
Definition: StringUtilsSimple.h:340
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19