Rosetta
Public Member Functions | Private Member Functions | Private Attributes | List of all members
protocols::ligand_evolution::FragmentLibrary Class Reference

The FragmentLibrary implements a combinatorial library for reaction and reagent data. Its main task is to hold chemical information and provide new ligands. More...

#include <FragmentLibrary.hh>

Public Member Functions

 FragmentLibrary ()
 
 ~FragmentLibrary ()
 
FragmentLibraryoperator= (FragmentLibrary const &other)=delete
 
 FragmentLibrary (FragmentLibrary const &other)=delete
 
void initialize_from_options (EvolutionOptionsOP options, core::Size external_scoring, core::Size rank)
 
void set_pose (core::pose::PoseCOP pose)
 Sets the internally used pose for ligand creation. More...
 
core::pose::PoseOP create_ligand_pose (LigandIdentifier const &id, bool create_rotamers, char ligand_chain) const
 generates a smiles representation for the id and calls create_ligand_pose with smiles More...
 
core::pose::PoseOP create_ligand_pose (std::string const &smiles, bool create_rotamers, char ligand_chain) const
 generates a new residue represented by a given ligand code and adds it to a detached copy of the internally saved pose object More...
 
void load_data (std::string const &reaction_file_path, std::string const &reagent_file_path, core::Size rank)
 Loads smirks reaction file and all reagents in the same folder. More...
 
void load_smiles (std::string const &path_to_data)
 Loads external smiles for later scoring from file. More...
 
LigandIdentifier random_ligand () const
 Simple function to generate a completely random ligand. More...
 
ReagentSimilarityList get_similar_reagents (core::Size reagent_id, core::Size reaction_id, core::Size position) const
 Searches for similar reagents within a given reaction and position. More...
 
core::Size reactions_size () const
 Returns the number of reactions. More...
 
core::Size reagents_size () const
 Returns the total number of reagents. More...
 
core::Size reagents_size (core::Size reaction_index) const
 Returns the total number of reagents for the given reaction. More...
 
core::Size reagents_size (core::Size reaction_index, core::Size position) const
 Returns the number of reagents at one specific position in the given reaction. More...
 
core::Size random_reaction () const
 Returns a random reaction index weighted for size of possible molecules. More...
 
core::Size random_reaction (std::set< core::Size > const &exclude) const
 Returns a random reaction that is not included in exclude weighted for size of possible molecules. More...
 
std::string reaction_id (core::Size reaction_id) const
 Returns the id of this reaction. More...
 
std::string reagent_id (core::Size reagent_id) const
 Returns the id of this reagent. More...
 
std::string run_reaction (LigandIdentifier const &identifier) const
 Runs the reaction specified by the ligand identifier and returns the resulting rdkit molecule. More...
 
std::string identifier_to_smiles (LigandIdentifier const &identifier) const
 Generates a new molecule with rdkit reaction and returns its smiles representation. More...
 
core::Size n_unscored_smiles () const
 Returns the number of saved external smiles that should be scored. More...
 
core::Size max_positions () const
 Returns the number of maximum positions for all reactions used. More...
 
core::Size reaction_positions (core::Size reaction_id) const
 Returns for a given reaction the number of positions used. More...
 
core::Size reaction_name_to_index (std::string const &reaction_name) const
 Returns the used reaction index for a given reaction name. Returns 0 if not found. More...
 
core::Size reagent_name_to_index (core::Size reaction_index, core::Size position, std::string const &reagent_name) const
 Returns the index for a given reagent. Returns 0 if not found. More...
 
std::shared_ptr< RDKit::SparseIntVect< unsigned int > > calculate_fingerprint (LigandIdentifier const &id)
 Calculates a RDKit Morgan fingerprint for a given ligand. Fingerprints are saved and can be retrieved quickly. More...
 
core::Real similarity (LigandIdentifier const &id1, LigandIdentifier const &id2)
 Returns the Tanimoto Similarity based on RDKit Morgan fingerprints for two given ligands. The fingerprints are either calculated or retrieved if previously calculated. More...
 

Private Member Functions

core::conformation::ResidueOP create_ligand (std::string const &smiles, bool create_rotamers) const
 LigandIdentifier is interpreted as [reaction, reagent1, reagent2]. More...
 
void load_reactions (std::string const &reaction_file_name)
 utility function to load all reactions. More...
 
void load_reagents (std::string const &reagent_file_path)
 utility function to load all reagents. Returns indices of newly added entries in reagents_ More...
 
core::Size generate_rotamers (core::chemical::MutableResidueType &new_ligand) const
 Tries to generate rotamers and returns how many were generated. More...
 
core::pose::PoseOP create_pose (core::conformation::Residue &ligand, char ligand_chain) const
 Takes a ligand and adds it to a detached copy of the internally saved pose object. More...
 

Private Attributes

utility::vector1< ReagentOPreagents_
 List of all available reagents. More...
 
utility::vector1< ReactionOPreactions_
 List of all available reactions. More...
 
core::pose::PoseCOP pose_
 Stores the original pose to dock all ligands in. More...
 
numeric::random::WeightedSampler weighted_sampler_
 Weighted sampler for random unbiased selection. More...
 
utility::vector1< std::string > smiles_
 Only used in benchmarking runs. Stores external molecules defined by smiles. More...
 
std::map< std::string, core::Sizereaction_name_to_index_
 Used during data loading to map reaction names to indices whilst loading reagents. More...
 
core::Size max_reagents_ = 0
 stores how many reagents are used at max for a reaction to set the correct length for ligand identifiers More...
 
std::map< LigandIdentifier, std::shared_ptr< RDKit::SparseIntVect< unsigned int > > > fingerprints_
 stores calculated fingerprints for quick references More...
 

Detailed Description

The FragmentLibrary implements a combinatorial library for reaction and reagent data. Its main task is to hold chemical information and provide new ligands.

Constructor & Destructor Documentation

◆ FragmentLibrary() [1/2]

protocols::ligand_evolution::FragmentLibrary::FragmentLibrary ( )
default

◆ ~FragmentLibrary()

protocols::ligand_evolution::FragmentLibrary::~FragmentLibrary ( )
default

◆ FragmentLibrary() [2/2]

protocols::ligand_evolution::FragmentLibrary::FragmentLibrary ( FragmentLibrary const &  other)
delete

Member Function Documentation

◆ calculate_fingerprint()

std::shared_ptr< RDKit::SparseIntVect< unsigned int > > protocols::ligand_evolution::FragmentLibrary::calculate_fingerprint ( LigandIdentifier const &  id)

Calculates a RDKit Morgan fingerprint for a given ligand. Fingerprints are saved and can be retrieved quickly.

References fingerprints_, and run_reaction().

Referenced by similarity().

◆ create_ligand()

core::conformation::ResidueOP protocols::ligand_evolution::FragmentLibrary::create_ligand ( std::string const &  smiles,
bool  create_rotamers 
) const
private

LigandIdentifier is interpreted as [reaction, reagent1, reagent2].

References core::chemical::rdkit::RDMolToRestype::generate_restype(), generate_rotamers(), core::chemical::ResidueType::make(), and protocols::TR().

Referenced by create_ligand_pose().

◆ create_ligand_pose() [1/2]

core::pose::PoseOP protocols::ligand_evolution::FragmentLibrary::create_ligand_pose ( LigandIdentifier const &  id,
bool  create_rotamers,
char  ligand_chain 
) const

generates a smiles representation for the id and calls create_ligand_pose with smiles

References run_reaction(), smiles_, and protocols::TR().

Referenced by protocols::ligand_evolution::Scorer::create_pose().

◆ create_ligand_pose() [2/2]

core::pose::PoseOP protocols::ligand_evolution::FragmentLibrary::create_ligand_pose ( std::string const &  smiles,
bool  create_rotamers,
char  ligand_chain 
) const

generates a new residue represented by a given ligand code and adds it to a detached copy of the internally saved pose object

References create_ligand(), create_pose(), and protocols::TR().

◆ create_pose()

core::pose::PoseOP protocols::ligand_evolution::FragmentLibrary::create_pose ( core::conformation::Residue ligand,
char  ligand_chain 
) const
private

Takes a ligand and adds it to a detached copy of the internally saved pose object.

References protocols::sewing::data_storage::ligand, pose_, and protocols::TR().

Referenced by create_ligand_pose().

◆ generate_rotamers()

core::Size protocols::ligand_evolution::FragmentLibrary::generate_rotamers ( core::chemical::MutableResidueType new_ligand) const
private

◆ get_similar_reagents()

ReagentSimilarityList protocols::ligand_evolution::FragmentLibrary::get_similar_reagents ( core::Size  reagent_id,
core::Size  reaction_id,
core::Size  position 
) const

◆ identifier_to_smiles()

std::string protocols::ligand_evolution::FragmentLibrary::identifier_to_smiles ( LigandIdentifier const &  identifier) const

Generates a new molecule with rdkit reaction and returns its smiles representation.

References run_reaction(), and smiles_.

Referenced by protocols::ligand_evolution::Scorer::ligand_line(), and protocols::ligand_evolution::Scorer::save_external_scoring_results().

◆ initialize_from_options()

void protocols::ligand_evolution::FragmentLibrary::initialize_from_options ( EvolutionOptionsOP  options,
core::Size  external_scoring,
core::Size  rank 
)

◆ load_data()

void protocols::ligand_evolution::FragmentLibrary::load_data ( std::string const &  reaction_file_path,
std::string const &  reagent_file_path,
core::Size  rank 
)

Loads smirks reaction file and all reagents in the same folder.

References load_reactions(), load_reagents(), reactions_, reagents_, protocols::TR(), and weighted_sampler_.

Referenced by initialize_from_options().

◆ load_reactions()

void protocols::ligand_evolution::FragmentLibrary::load_reactions ( std::string const &  reaction_file_name)
private

utility function to load all reactions.

References max_reagents_, reaction_name_to_index_, reactions_, and protocols::TR().

Referenced by load_data().

◆ load_reagents()

void protocols::ligand_evolution::FragmentLibrary::load_reagents ( std::string const &  reagent_file_path)
private

utility function to load all reagents. Returns indices of newly added entries in reagents_

References reaction_name_to_index_, reactions_, reagents_, and protocols::TR().

Referenced by load_data().

◆ load_smiles()

void protocols::ligand_evolution::FragmentLibrary::load_smiles ( std::string const &  path_to_data)

Loads external smiles for later scoring from file.

References smiles_, and protocols::TR().

Referenced by initialize_from_options().

◆ max_positions()

core::Size protocols::ligand_evolution::FragmentLibrary::max_positions ( ) const

◆ n_unscored_smiles()

core::Size protocols::ligand_evolution::FragmentLibrary::n_unscored_smiles ( ) const

Returns the number of saved external smiles that should be scored.

References smiles_.

Referenced by protocols::ligand_evolution::EvolutionManager::external_scoring().

◆ operator=()

FragmentLibrary& protocols::ligand_evolution::FragmentLibrary::operator= ( FragmentLibrary const &  other)
delete

◆ random_ligand()

LigandIdentifier protocols::ligand_evolution::FragmentLibrary::random_ligand ( ) const

Simple function to generate a completely random ligand.

References max_reagents_, random_reaction(), and reactions_.

Referenced by protocols::ligand_evolution::Population::add_random().

◆ random_reaction() [1/2]

core::Size protocols::ligand_evolution::FragmentLibrary::random_reaction ( ) const

Returns a random reaction index weighted for size of possible molecules.

References weighted_sampler_.

Referenced by protocols::ligand_evolution::Mutator::mutate(), and random_ligand().

◆ random_reaction() [2/2]

core::Size protocols::ligand_evolution::FragmentLibrary::random_reaction ( std::set< core::Size > const &  exclude) const

Returns a random reaction that is not included in exclude weighted for size of possible molecules.

References reactions_, and reactions_size().

◆ reaction_id()

std::string protocols::ligand_evolution::FragmentLibrary::reaction_id ( core::Size  reaction_id) const

◆ reaction_name_to_index()

core::Size protocols::ligand_evolution::FragmentLibrary::reaction_name_to_index ( std::string const &  reaction_name) const

Returns the used reaction index for a given reaction name. Returns 0 if not found.

References reaction_name_to_index_.

Referenced by protocols::ligand_evolution::Scorer::get_best_loaded().

◆ reaction_positions()

core::Size protocols::ligand_evolution::FragmentLibrary::reaction_positions ( core::Size  reaction_id) const

◆ reactions_size()

core::Size protocols::ligand_evolution::FragmentLibrary::reactions_size ( ) const

Returns the number of reactions.

References reactions_.

Referenced by random_reaction().

◆ reagent_id()

std::string protocols::ligand_evolution::FragmentLibrary::reagent_id ( core::Size  reagent_id) const

◆ reagent_name_to_index()

core::Size protocols::ligand_evolution::FragmentLibrary::reagent_name_to_index ( core::Size  reaction_index,
core::Size  position,
std::string const &  reagent_name 
) const

Returns the index for a given reagent. Returns 0 if not found.

References reactions_, and reagents_.

Referenced by protocols::ligand_evolution::Scorer::get_best_loaded().

◆ reagents_size() [1/3]

core::Size protocols::ligand_evolution::FragmentLibrary::reagents_size ( ) const

Returns the total number of reagents.

References reagents_.

Referenced by protocols::ligand_evolution::Mutator::mutate(), and reagents_size().

◆ reagents_size() [2/3]

core::Size protocols::ligand_evolution::FragmentLibrary::reagents_size ( core::Size  reaction_index) const

Returns the total number of reagents for the given reaction.

References reactions_, and reagents_size().

◆ reagents_size() [3/3]

core::Size protocols::ligand_evolution::FragmentLibrary::reagents_size ( core::Size  reaction_index,
core::Size  position 
) const

Returns the number of reagents at one specific position in the given reaction.

References reactions_.

◆ run_reaction()

std::string protocols::ligand_evolution::FragmentLibrary::run_reaction ( LigandIdentifier const &  identifier) const

Runs the reaction specified by the ligand identifier and returns the resulting rdkit molecule.

References reactions_, reagents_, and protocols::TR().

Referenced by calculate_fingerprint(), create_ligand_pose(), and identifier_to_smiles().

◆ set_pose()

void protocols::ligand_evolution::FragmentLibrary::set_pose ( core::pose::PoseCOP  pose)

Sets the internally used pose for ligand creation.

References pose_.

Referenced by initialize_from_options().

◆ similarity()

core::Real protocols::ligand_evolution::FragmentLibrary::similarity ( LigandIdentifier const &  id1,
LigandIdentifier const &  id2 
)

Returns the Tanimoto Similarity based on RDKit Morgan fingerprints for two given ligands. The fingerprints are either calculated or retrieved if previously calculated.

References calculate_fingerprint().

Referenced by get_similar_reagents(), and protocols::ligand_evolution::Scorer::score_population().

Member Data Documentation

◆ fingerprints_

std::map< LigandIdentifier, std::shared_ptr< RDKit::SparseIntVect<unsigned int> > > protocols::ligand_evolution::FragmentLibrary::fingerprints_
private

stores calculated fingerprints for quick references

Referenced by calculate_fingerprint().

◆ max_reagents_

core::Size protocols::ligand_evolution::FragmentLibrary::max_reagents_ = 0
private

stores how many reagents are used at max for a reaction to set the correct length for ligand identifiers

Referenced by load_reactions(), max_positions(), and random_ligand().

◆ pose_

core::pose::PoseCOP protocols::ligand_evolution::FragmentLibrary::pose_
private

Stores the original pose to dock all ligands in.

Referenced by create_pose(), and set_pose().

◆ reaction_name_to_index_

std::map< std::string, core::Size > protocols::ligand_evolution::FragmentLibrary::reaction_name_to_index_
private

Used during data loading to map reaction names to indices whilst loading reagents.

Referenced by load_reactions(), load_reagents(), and reaction_name_to_index().

◆ reactions_

utility::vector1< ReactionOP > protocols::ligand_evolution::FragmentLibrary::reactions_
private

◆ reagents_

utility::vector1< ReagentOP > protocols::ligand_evolution::FragmentLibrary::reagents_
private

◆ smiles_

utility::vector1< std::string > protocols::ligand_evolution::FragmentLibrary::smiles_
private

Only used in benchmarking runs. Stores external molecules defined by smiles.

Referenced by create_ligand_pose(), identifier_to_smiles(), load_smiles(), and n_unscored_smiles().

◆ weighted_sampler_

numeric::random::WeightedSampler protocols::ligand_evolution::FragmentLibrary::weighted_sampler_
private

Weighted sampler for random unbiased selection.

Referenced by load_data(), and random_reaction().


The documentation for this class was generated from the following files: