41 typedef typename std::set<const DigestionEnzymeType*>::iterator
EnzymeIterator;
50 static const InstanceType* db_ =
new InstanceType;
75 const DigestionEnzymeType*
getEnzyme(
const std::string& name)
const
77 const DigestionEnzymeType* enzyme =
findEnzyme_(name);
78 if (enzyme ==
nullptr)
93 std::string(
"Enzyme with regex " + cleavage_regex +
" was not registered in Enzyme DB, register first!").c_str());
104 all_names.push_back((*it)->getName());
119 bool hasRegEx(
const std::string& cleavage_regex)
const
156 std::string name = enzyme->getName();
161 [&name](
const DigestionEnzymeType* e) { return e->getName() == name; });
164 const DigestionEnzymeType* old = *existing;
167 auto points_to_old = [old](
const auto& entry) {
return entry.second == old; };
171 if (!old->getRegEx().empty())
182 for (
const auto& syn : enzyme->getSynonyms())
188 for (
const auto& syn : enzyme->getSynonyms())
193 if (enzyme->getRegEx() !=
"")
205 for (
auto& provider : providers)
207 auto enzymes = provider->loadEnzymes();
208 for (
auto& enzyme : enzymes)
219 key.reserve(name.size());
220 for (
unsigned char c : name)
222 if (std::isspace(c) || c ==
'-' || c ==
'_')
continue;
223 key +=
static_cast<char>(std::tolower(c));
229 const DigestionEnzymeType*
findEnzyme_(
const std::string& name)
const
234 return (pos !=
enzyme_keys_.end()) ? pos->second :
nullptr;
Digestion enzyme database (base class)
Definition DigestionEnzymeDB.h:34
void getAllNames(std::vector< std::string > &all_names) const
returns all the enzyme names (does NOT include synonym names)
Definition DigestionEnzymeDB.h:99
bool hasEnzyme(const std::string &name) const
returns true if the db contains a enzyme with the given name (supports synonym names; matched as in g...
Definition DigestionEnzymeDB.h:113
const DigestionEnzymeType * findEnzyme_(const std::string &name) const
returns the enzyme with the given name or synonym (see getEnzyme()), or nullptr if unknown
Definition DigestionEnzymeDB.h:229
DigestionEnzymeDB(const DigestionEnzymeDB &enzymes_db)=delete
copy constructor
bool hasRegEx(const std::string &cleavage_regex) const
returns true if the db contains a enzyme with the given regex
Definition DigestionEnzymeDB.h:119
DigestionEnzymeDB()=default
ConstEnzymeIterator endEnzyme() const
Definition DigestionEnzymeDB.h:135
virtual ~DigestionEnzymeDB()
destructor
Definition DigestionEnzymeDB.h:58
static std::string lookupKey_(const std::string &name)
key for lenient name lookup (see getEnzyme()): lowercase, without whitespace, '-' and '_'
Definition DigestionEnzymeDB.h:216
void loadFromProviders_(std::vector< std::unique_ptr< DigestionEnzymeDataProvider< DigestionEnzymeType > > > &providers)
Definition DigestionEnzymeDB.h:203
ConstEnzymeIterator beginEnzyme() const
Definition DigestionEnzymeDB.h:134
std::map< std::string, const DigestionEnzymeType * > enzyme_names_
index by names and synonyms (as written)
Definition DigestionEnzymeDB.h:237
const DigestionEnzymeType * getEnzymeByRegEx(const std::string &cleavage_regex) const
Definition DigestionEnzymeDB.h:87
static const InstanceType * getInstance()
Definition DigestionEnzymeDB.h:46
std::map< std::string, const DigestionEnzymeType * > enzyme_regex_
index by regex
Definition DigestionEnzymeDB.h:241
DigestionEnzymeDB & operator=(const DigestionEnzymeDB &enzymes_db)=delete
assignment operator
std::set< constDigestionEnzymeType * >::const_iterator ConstEnzymeIterator
Definition DigestionEnzymeDB.h:40
std::map< std::string, const DigestionEnzymeType * > enzyme_keys_
index by lookupKey_() of names and synonyms
Definition DigestionEnzymeDB.h:239
std::set< constDigestionEnzymeType * >::iterator EnzymeIterator
Definition DigestionEnzymeDB.h:41
bool hasEnzyme(const DigestionEnzymeType *enzyme) const
returns true if the db contains the enzyme of the given pointer
Definition DigestionEnzymeDB.h:125
const DigestionEnzymeType * getEnzyme(const std::string &name) const
Definition DigestionEnzymeDB.h:75
std::set< const DigestionEnzymeType * > const_enzymes_
set of enzymes
Definition DigestionEnzymeDB.h:243
void addEnzyme_(const DigestionEnzymeType *enzyme)
Definition DigestionEnzymeDB.h:154
Abstract interface for providing digestion enzyme data.
Definition DigestionEnzymeDataProvider.h:30
Element could not be found exception.
Definition Exception.h:657
A method or algorithm argument contains illegal values.
Definition Exception.h:633
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19