Class compound_factory

Class Documentation

class compound_factory

Use the compound_factory singleton instance to create compound objects.

Public Functions

void set_default_dictionary(const std::filesystem::path &inDictFile)

Set the default dictionary file to inDictFile.

void push_dictionary(const std::filesystem::path &inDictFile)

Override any previously loaded dictionary with inDictFile.

void pop_dictionary()

Remove the last pushed dictionary.

bool is_known_peptide(const std::string &res_name) const

Return whether res_name is a valid and known peptide.

bool is_known_base(const std::string &res_name) const

Return whether res_name is a valid and known base.

const compound *create(std::string id)

Create the compound object for id.

This will create the compound instance for id if it doesn’t exist already. The result is owned by this factory and should not be deleted by the user.

Parameters

id – The compound ID, a three letter code usually

Returns

The compound, or nullptr if it could not be created (missing info)

~compound_factory()

Public Static Functions

static void init(bool useThreadLocalInstanceOnly)

Initialise a singleton instance.

If you have a multithreaded application and want to have different compounds in each thread (e.g. a web service processing user requests with different sets of compounds) you can set the useThreadLocalInstanceOnly flag to true.

static compound_factory &instance()

Return the singleton instance. If initialized with local threads, this is the instance for the current thread.

static void clear()

Delete and reset the singleton instance. If initialized with local threads, this is the instance for the current thread.

Public Static Attributes

static CIFPP_EXPORT const std::map< std::string, char > kAAMap

Globally accessible static list of the default amino acids.

static CIFPP_EXPORT const std::map< std::string, char > kBaseMap

Globally accessible static list of the default bases.