|
OpenMS
2.6.0
|
Go to the documentation of this file.
65 typedef typename std::set<const DigestionEnzymeType*>::iterator
EnzymeIterator;
71 static InstanceType* db_ =
nullptr;
74 db_ =
new InstanceType;
95 const DigestionEnzymeType*
getEnzyme(
const String& name)
const
103 throw Exception::ElementNotFound(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, name);
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];
204 it.getName().split(
':', split);
205 if (split[0] !=
"Enzymes")
break;
206 if (split[1] != previous_enzyme)
210 previous_enzyme = split[1];
213 values[it.getName()] = it->value;
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() !=
"")
A method or algorithm argument contains illegal values.
Definition: Exception.h:648
bool hasRegEx(const String &cleavage_regex) const
returns true if the db contains a enzyme with the given regex
Definition: DigestionEnzymeDB.h:142
const DigestionEnzymeType * parseEnzyme_(Map< String, String > &values) const
parses an enzyme, given the key/value pairs from an XML file
Definition: DigestionEnzymeDB.h:225
static InstanceType * getInstance()
this member function serves as a replacement of the constructor
Definition: DigestionEnzymeDB.h:69
A more convenient string class.
Definition: String.h:59
void addEnzyme_(const DigestionEnzymeType *enzyme)
add to internal data; also update indices for search by name and regex
Definition: DigestionEnzymeDB.h:242
void getAllNames(std::vector< String > &all_names) const
returns all the enzyme names (does NOT include synonym names)
Definition: DigestionEnzymeDB.h:122
The file pendant of the Param class used to load and store the param datastructure as paramXML.
Definition: ParamXMLFile.h:49
DigestionEnzymeDB & operator=(const DigestionEnzymeDB &enzymes_db)=delete
assignment operator
std::set< const DigestionEnzymeType * >::iterator EnzymeIterator
Definition: DigestionEnzymeDB.h:65
static String find(const String &filename, StringList directories=StringList())
Looks up the location of the file filename.
const DigestionEnzymeType * getEnzyme(const String &name) const
Definition: DigestionEnzymeDB.h:98
Forward const iterator for the Param class.
Definition: Param.h:197
Map< String, const DigestionEnzymeType * > enzyme_names_
index by names
Definition: DigestionEnzymeDB.h:262
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
DigestionEnzymeDB(const String &db_file="")
Definition: DigestionEnzymeDB.h:162
ConstEnzymeIterator beginEnzyme() const
Definition: DigestionEnzymeDB.h:157
bool empty() const
Returns if there are no entries.
std::set< const DigestionEnzymeType * > const_enzymes_
set of enzymes
Definition: DigestionEnzymeDB.h:266
const DigestionEnzymeType * getEnzymeByRegEx(const String &cleavage_regex) const
Definition: DigestionEnzymeDB.h:110
std::set< const DigestionEnzymeType * >::const_iterator ConstEnzymeIterator
Definition: DigestionEnzymeDB.h:64
Exception base class.
Definition: Exception.h:89
bool split(const char splitter, std::vector< String > &substrings, bool quote_protect=false) const
Splits a string into substrings using splitter as delimiter.
bool hasEnzyme(const DigestionEnzymeType *enzyme) const
returns true if the db contains the enzyme of the given pointer
Definition: DigestionEnzymeDB.h:148
Map< String, const DigestionEnzymeType * > enzyme_regex_
index by regex
Definition: DigestionEnzymeDB.h:264
void readEnzymesFromFile_(const String &filename)
reads enzymes from the given file
Definition: DigestionEnzymeDB.h:182
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
ParamIterator end() const
End iterator for the internal tree.
#define OPENMS_LOG_ERROR
Macro to be used if non-fatal error are reported (processing continues)
Definition: LogStream.h:455
ParamIterator begin() const
Begin iterator for the internal tree.
String getName() const
Returns the absolute path of the current element (including all sections)
Parse Error exception.
Definition: Exception.h:622
Management and storage of parameters / INI files.
Definition: Param.h:73
const char * what() const noexcept override
Returns the error message of the exception.
ConstEnzymeIterator endEnzyme() const
Definition: DigestionEnzymeDB.h:158
Map class based on the STL map (containing several convenience functions)
Definition: Map.h:50
void load(const String &filename, Param ¶m)
Read XML file.
Digestion enzyme database (base class)
Definition: DigestionEnzymeDB.h:57
virtual ~DigestionEnzymeDB()
destructor
Definition: DigestionEnzymeDB.h:83
String & toLower()
Converts the string to lowercase.