29 #ifndef CDPL_BIOMOL_RESIDUEDICTIONARY_HPP
30 #define CDPL_BIOMOL_RESIDUEDICTIONARY_HPP
33 #include <unordered_map>
37 #include <boost/iterator/transform_iterator.hpp>
79 Entry(
const std::string& code,
const std::string& rep_code,
const std::string& rep_by_code,
const std::string& parent_code,
80 const std::string& one_letter_code,
bool obsolete,
const std::string& name,
unsigned int type,
146 std::string replacesCode;
147 std::string replacedByCode;
148 std::string parentCode;
149 std::string oneLetterCode;
157 struct CIStringHashFunc
160 std::size_t operator()(
const std::string& str)
const;
163 struct CIStringCmpFunc
166 bool operator()(
const std::string& str1,
const std::string& str2)
const;
169 typedef std::unordered_map<std::string, Entry, CIStringHashFunc, CIStringCmpFunc> EntryLookupTable;
176 typedef boost::transform_iterator<std::function<
const Entry&(
const EntryLookupTable::value_type&)>,
296 const std::string&
getName(
const std::string& code)
const;
303 unsigned int getType(
const std::string& code)
const;
331 EntryLookupTable entries;
Definition of the preprocessor macro CDPL_BIOMOL_API.
#define CDPL_BIOMOL_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of class CDPL::Chem::MolecularGraph.
A single residue dictionary entry.
Definition: ResidueDictionary.hpp:61
const std::string & getOneLetterCode() const
Returns the one-letter residue code.
const std::string & getName() const
Returns the full residue name.
unsigned int getType() const
Returns the residue type (see Biomol::ResidueType).
bool isObsolete() const
Tells whether the residue type described by this entry is obsolete.
const std::string & getReplacedByCode() const
Returns the TLC of the residue that replaces this one.
const std::string & getReplacedCode() const
Returns the TLC of the residue this entry replaces.
Chem::MolecularGraph::SharedPointer getStructure() const
Retrieves the residue structure via the configured structure-retrieval function.
Entry(const std::string &code, const std::string &rep_code, const std::string &rep_by_code, const std::string &parent_code, const std::string &one_letter_code, bool obsolete, const std::string &name, unsigned int type, const StructureRetrievalFunction &struc_ret_func)
Constructs and initializes an Entry instance with the given data.
const std::string & getParentCode() const
Returns the TLC of the parent residue.
Entry()
Constructs an empty (default-initialized) Entry instance.
const std::string & getCode() const
Returns the three-letter code (TLC) of the residue.
std::function< Chem::MolecularGraph::SharedPointer(const std::string &)> StructureRetrievalFunction
Generic wrapper for storing a user-defined function that retrieves the residue structure for a given ...
Definition: ResidueDictionary.hpp:65
Global dictionary for the lookup of meta-data associated with the residues in biological macromolecul...
Definition: ResidueDictionary.hpp:54
static void set(const SharedPointer &dict)
Replaces the process-wide default dictionary by dict.
const std::string & getReplacedCode(const std::string &code) const
Returns the TLC of the residue replaced by the residue with three-letter code code.
const std::string & getReplacedByCode(const std::string &code) const
Returns the TLC of the residue that replaces the residue with three-letter code code.
std::shared_ptr< ResidueDictionary > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated ResidueDictionary instances.
Definition: ResidueDictionary.hpp:173
ConstEntryIterator getEntriesBegin() const
Returns a constant iterator pointing to the beginning of the entry list.
boost::transform_iterator< std::function< const Entry &(const EntryLookupTable::value_type &)>, EntryLookupTable::const_iterator > ConstEntryIterator
A constant iterator over the entries of the dictionary.
Definition: ResidueDictionary.hpp:177
const std::string & getOneLetterCode(const std::string &code) const
Returns the one-letter code of the residue with three-letter code code.
Chem::MolecularGraph::SharedPointer getStructure(const std::string &code) const
Retrieves the structure of the residue with three-letter code code.
void addEntry(const Entry &entry)
Adds (or overwrites) the dictionary entry entry.
const std::string & getParentCode(const std::string &code) const
Returns the TLC of the parent residue of the residue with three-letter code code.
unsigned int getType(const std::string &code) const
Returns the residue type (see Biomol::ResidueType) of the residue with three-letter code code.
const Entry & getEntry(const std::string &code) const
Returns the dictionary entry for the residue with three-letter code code.
static bool isStdResidue(const std::string &code)
Tells whether the residue with three-letter code code is a standard biopolymer residue (amino acid or...
bool containsEntry(const std::string &code) const
Tells whether the dictionary contains an entry for the residue with three-letter code code.
const std::string & getName(const std::string &code) const
Returns the full name of the residue with three-letter code code.
void removeEntry(const std::string &code)
Removes the dictionary entry for the residue with three-letter code code.
void addEntry(Entry &&entry)
Adds (or overwrites) the dictionary entry entry by moving its data.
void clear()
Removes all entries from the dictionary.
ConstEntryIterator begin() const
Returns a constant iterator pointing to the beginning of the entry list (alias of getEntriesBegin()).
static const SharedPointer & get()
Returns the process-wide default dictionary (lazily initialized on first call).
ConstEntryIterator getEntriesEnd() const
Returns a constant iterator pointing one past the last entry.
void loadDefaults()
Loads the built-in default residue dictionary entries.
bool isObsolete(const std::string &code) const
Tells whether the residue type with three-letter code code is obsolete.
ConstEntryIterator end() const
Returns a constant iterator pointing one past the last entry (alias of getEntriesEnd()).
std::size_t getNumEntries() const
Returns the number of entries in the dictionary.
std::shared_ptr< MolecularGraph > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MolecularGraph instances.
Definition: MolecularGraph.hpp:63
The namespace of the Chemical Data Processing Library.