|
Rosetta
|
: The Scorer computes the score of each Individual in a Population. It applies a list of movers, calculates a variety of score terms and combines them. The scorer also collects statistics and summarizes information. More...
#include <Scorer.hh>
Public Member Functions | |
| Scorer (FragmentLibrary &library, core::Size n_runs, char ligand_chain) | |
| void | initialize_from_options (EvolutionOptionsCOP options, protocols::rosetta_scripts::XmlObjectsCOP rosetta_script, core::Size rank) |
| void | score_population (Population &pop) |
| Sets the score for all individuals in the population, calculates it where needed. More... | |
| void | score_individual (Individual &individual) |
| Checks if this individuals ligand was already scores, scores it if not, and sets the score for the individual. More... | |
| void | score_ligand (LigandIdentifier const &ligand, std::string const &smiles="", core::Size save_n_scores=0) |
| Sets the current ligand and calls all steps to score it completely. More... | |
| void | add_mover (moves::MoverOP const &mover) |
| Adds a mover. More... | |
| void | set_ligand (LigandIdentifier const &ligand, std::string const &smiles="") |
| Sets the current ligand on which should be worked. More... | |
| bool | has_ligand () const |
| Checks if a ligand is currently set. More... | |
| bool | next_step (core::Size save_n_scores=0) |
| Performs the next scoring step on the current individual. Returns true, if this was the last step. More... | |
| bool | is_scored (LigandIdentifier const &ligand) const |
| Returns true if the ligand was already scored. More... | |
| std::map< std::string, core::Real > const & | get_scores (LigandIdentifier const &ligand) const |
| Returns all scores in a map with a string identifier. More... | |
| void | set_main_term (std::string const &score_term) |
| Sets which term should be used for optimization. More... | |
| void | set_base_similarity_penalty (core::Real base_penalty) |
| Sets the penalty for ligands which are appear more than once within a population. More... | |
| void | set_pose_path (std::string const &path) |
| Sets the path where poses should be saved. Leave it empty to save in the current working directory. More... | |
| void | set_score_function (core::scoring::ScoreFunctionOP score_function) |
| Sets the desired score function. More... | |
| void | set_scores (LigandIdentifier const &identifier, std::map< std::string, core::Real > const &scores) |
| Sets all score terms for an identifier if not set yet. More... | |
| core::Size | n_score_terms () const |
| Return how many score terms are calculated. More... | |
| utility::vector1< core::Real > | get_raw_scores (LigandIdentifier const &identifier) const |
| Returns the raw scores of an identifier for mpi communication. More... | |
| void | load_scores (std::string const &path) |
| Loads scores for combinations of reagents and reactions from file. These are used during the run instead of rescoring. Format is the output format of RLE. More... | |
| void | set_raw_scores (LigandIdentifier const &identifier, double const *raw_scores) |
| Transforms raw double scores into a proper map and calls set_scores @detail Expects scores in the same order as score_terms. More... | |
| void | save_results () const |
| Writes all results to disk. More... | |
| void | save_external_scoring_results (core::Size rank) |
| Writes multiple scores per ligand to disk. More... | |
| std::map< LigandIdentifier, std::set< core::Size > > const & | expose_id_memory () const |
| For debugging and benchmarking purposes. More... | |
| bool | check_memory (LigandIdentifier const &ligand) |
| Checks if score for this ligand is available in memory and loads it if possible. More... | |
| utility::vector1< LigandIdentifier > | get_best_loaded (core::Size size) const |
| Returns a list of LigandIdentifiers for loaded scores sorted by their main term score. More... | |
| void | set_similarity_penalty_threshold (core::Real threshold) |
Private Member Functions | |
| void | create_pose () |
| Creates a pose and rotamers for the current ligand. More... | |
| void | apply_movers () |
| Applies all movers in order to the current ligands pose. More... | |
| void | calculate_scores (core::Size save_n_scores=0) |
| Calculates all scores for the current ligand and saves them if lower than the old ones. More... | |
| void | dump_pose () |
| Dumps the current best pose to disk with the ligand identifier as name. More... | |
| utility::vector1< std::string > | ligand_line (LigandIdentifier const &identifier) const |
Private Attributes | |
| char | ligand_chain_ = 'X' |
| std::string | pose_path_ |
| std::string | main_score_term_ |
| core::Size | n_runs_ = 0 |
| core::Size | current_runs_ = 0 |
| LigandIdentifier | current_ligand_ |
| std::string | current_ligand_smiles_ |
| FragmentLibrary & | library_ |
| core::pose::PoseOP | basic_pose_ = nullptr |
| core::pose::PoseOP | best_pose_ = nullptr |
| core::pose::PoseOP | working_pose_ |
| utility::vector1< moves::MoverOP > | mover_ |
| std::map< LigandIdentifier, std::map< std::string, core::Real > > | score_memory_ |
| std::map< std::string, std::map< utility::vector1< std::string >, std::map< std::string, core::Real > > > | loaded_score_memory_ |
| Important! LigendIdentifier here is NOT the same as in the rest of the program. This uses the real names from reactions and reagents. More... | |
| std::map< LigandIdentifier, std::set< core::Size > > | id_memory_ |
| bool | score_next_ = false |
| core::scoring::ScoreFunctionOP | score_function_ = nullptr |
| core::Real | base_similarity_penalty_ = 0.2 |
| core::Real | similarity_penalty_threshold_ = 0.95 |
: The Scorer computes the score of each Individual in a Population. It applies a list of movers, calculates a variety of score terms and combines them. The scorer also collects statistics and summarizes information.
| protocols::ligand_evolution::Scorer::Scorer | ( | FragmentLibrary & | library, |
| core::Size | n_runs, | ||
| char | ligand_chain | ||
| ) |
| void protocols::ligand_evolution::Scorer::add_mover | ( | moves::MoverOP const & | mover | ) |
|
private |
Applies all movers in order to the current ligands pose.
References basic_pose_, mover_, and working_pose_.
Referenced by next_step().
|
private |
Calculates all scores for the current ligand and saves them if lower than the old ones.
If save_all_scores is set, all scores are save in memory. This should only be used for external smiles scoring since it overrides a lot of otherwise needed and/or desired features.
References basic_pose_, best_pose_, current_ligand_, current_runs_, protocols::ligand_docking::get_interface_deltas(), is_scored(), ligand_chain_, main_score_term_, protocols::hybridization::score, score_function_, score_memory_, protocols::ligand_evolution::score_terms_, protocols::TR(), and working_pose_.
Referenced by next_step().
| bool protocols::ligand_evolution::Scorer::check_memory | ( | LigandIdentifier const & | ligand | ) |
Checks if score for this ligand is available in memory and loads it if possible.
References library_, loaded_score_memory_, protocols::ligand_evolution::FragmentLibrary::reaction_id(), protocols::ligand_evolution::FragmentLibrary::reagent_id(), score_memory_, and protocols::TR().
Referenced by score_ligand().
|
private |
Creates a pose and rotamers for the current ligand.
References basic_pose_, protocols::ligand_evolution::FragmentLibrary::create_ligand_pose(), current_ligand_, current_ligand_smiles_, library_, ligand_chain_, and protocols::TR().
Referenced by next_step().
|
private |
Dumps the current best pose to disk with the ligand identifier as name.
References best_pose_, current_ligand_, pose_path_, and protocols::TR().
Referenced by next_step().
| std::map< LigandIdentifier, std::set< core::Size > > const & protocols::ligand_evolution::Scorer::expose_id_memory | ( | ) | const |
For debugging and benchmarking purposes.
References id_memory_.
| utility::vector1< LigandIdentifier > protocols::ligand_evolution::Scorer::get_best_loaded | ( | core::Size | size | ) | const |
Returns a list of LigandIdentifiers for loaded scores sorted by their main term score.
| size | Sets how many identifiers should be returned. If <= 0, all will be returned |
References library_, loaded_score_memory_, main_score_term_, protocols::mean_field::min(), core::scoring::pair, protocols::ligand_evolution::FragmentLibrary::reaction_name_to_index(), protocols::ligand_evolution::FragmentLibrary::reagent_name_to_index(), protocols::hybridization::score, and protocols::TR().
Referenced by protocols::ligand_evolution::Population::initialize_from_evotoptions().
| utility::vector1< core::Real > protocols::ligand_evolution::Scorer::get_raw_scores | ( | LigandIdentifier const & | identifier | ) | const |
Returns the raw scores of an identifier for mpi communication.
References score_memory_, and protocols::ligand_evolution::score_terms_.
| std::map< std::string, core::Real > const & protocols::ligand_evolution::Scorer::get_scores | ( | LigandIdentifier const & | ligand | ) | const |
Returns all scores in a map with a string identifier.
References protocols::sewing::data_storage::ligand, and score_memory_.
| bool protocols::ligand_evolution::Scorer::has_ligand | ( | ) | const |
Checks if a ligand is currently set.
References current_ligand_.
| void protocols::ligand_evolution::Scorer::initialize_from_options | ( | EvolutionOptionsCOP | options, |
| protocols::rosetta_scripts::XmlObjectsCOP | rosetta_script, | ||
| core::Size | rank | ||
| ) |
| bool protocols::ligand_evolution::Scorer::is_scored | ( | LigandIdentifier const & | ligand | ) | const |
Returns true if the ligand was already scored.
References protocols::sewing::data_storage::ligand, and score_memory_.
Referenced by calculate_scores(), score_ligand(), set_ligand(), and set_scores().
|
private |
References protocols::ligand_evolution::FragmentLibrary::identifier_to_smiles(), library_, protocols::ligand_evolution::FragmentLibrary::max_positions(), protocols::ligand_evolution::FragmentLibrary::reaction_id(), protocols::ligand_evolution::FragmentLibrary::reaction_positions(), protocols::ligand_evolution::FragmentLibrary::reagent_id(), protocols::hybridization::score, score_memory_, protocols::ligand_evolution::score_terms_, and core::id::to_string().
Referenced by save_results().
| void protocols::ligand_evolution::Scorer::load_scores | ( | std::string const & | path | ) |
Loads scores for combinations of reagents and reactions from file. These are used during the run instead of rescoring. Format is the output format of RLE.
References library_, loaded_score_memory_, main_score_term_, protocols::ligand_evolution::FragmentLibrary::max_positions(), protocols::hybridization::path, protocols::ligand_evolution::score_terms_, core::id::to_string(), and protocols::TR().
Referenced by initialize_from_options().
| core::Size protocols::ligand_evolution::Scorer::n_score_terms | ( | ) | const |
Return how many score terms are calculated.
References protocols::ligand_evolution::score_terms_.
| bool protocols::ligand_evolution::Scorer::next_step | ( | core::Size | save_n_scores = 0 | ) |
Performs the next scoring step on the current individual. Returns true, if this was the last step.
References apply_movers(), basic_pose_, best_pose_, calculate_scores(), create_pose(), current_ligand_, current_ligand_smiles_, current_runs_, dump_pose(), n_runs_, score_next_, protocols::ligand_evolution::score_terms_, set_scores(), and protocols::TR().
Referenced by score_ligand().
| void protocols::ligand_evolution::Scorer::save_external_scoring_results | ( | core::Size | rank | ) |
Writes multiple scores per ligand to disk.
References protocols::ligand_evolution::FragmentLibrary::identifier_to_smiles(), library_, core::conformation::membrane::out, core::scoring::pair, score_memory_, protocols::ligand_evolution::score_terms_, core::id::to_string(), and protocols::TR().
| void protocols::ligand_evolution::Scorer::save_results | ( | ) | const |
Writes all results to disk.
References library_, ligand_line(), main_score_term_, protocols::mean_field::max(), protocols::ligand_evolution::FragmentLibrary::max_positions(), core::conformation::membrane::out, core::scoring::pair, score_memory_, protocols::ligand_evolution::score_terms_, core::id::to_string(), and protocols::TR().
| void protocols::ligand_evolution::Scorer::score_individual | ( | Individual & | individual | ) |
Checks if this individuals ligand was already scores, scores it if not, and sets the score for the individual.
References protocols::ligand_evolution::Individual::id(), id_memory_, protocols::ligand_evolution::Individual::identifier(), main_score_term_, protocols::ligand_evolution::Individual::score(), score_ligand(), score_memory_, and protocols::ligand_evolution::score_terms_.
Referenced by score_population().
| void protocols::ligand_evolution::Scorer::score_ligand | ( | LigandIdentifier const & | ligand, |
| std::string const & | smiles = "", |
||
| core::Size | save_n_scores = 0 |
||
| ) |
Sets the current ligand and calls all steps to score it completely.
References check_memory(), is_scored(), protocols::sewing::data_storage::ligand, next_step(), set_ligand(), and protocols::TR().
Referenced by score_individual().
| void protocols::ligand_evolution::Scorer::score_population | ( | Population & | pop | ) |
Sets the score for all individuals in the population, calculates it where needed.
If the same ligand is multiple times present within the population, each occures after the first gets an increasing penalty.
References base_similarity_penalty_, protocols::ligand_evolution::Individual::id(), protocols::ligand_evolution::Individual::identifier(), protocols::ligand_evolution::Population::individual(), protocols::ligand_evolution::Population::individuals(), library_, protocols::ligand_evolution::Individual::score(), score_individual(), protocols::ligand_evolution::FragmentLibrary::similarity(), similarity_penalty_threshold_, protocols::ligand_evolution::Population::size(), protocols::ligand_evolution::Population::sort(), and protocols::TR().
| void protocols::ligand_evolution::Scorer::set_base_similarity_penalty | ( | core::Real | base_penalty | ) |
Sets the penalty for ligands which are appear more than once within a population.
The penalty is a relative fraction of the current main score for each ligand. It starts at 0 and increases with each additional ligand by the base penalty
References base_similarity_penalty_.
Referenced by initialize_from_options().
| void protocols::ligand_evolution::Scorer::set_ligand | ( | LigandIdentifier const & | ligand, |
| std::string const & | smiles = "" |
||
| ) |
Sets the current ligand on which should be worked.
References current_ligand_, current_ligand_smiles_, current_runs_, is_scored(), protocols::sewing::data_storage::ligand, and protocols::TR().
Referenced by score_ligand().
| void protocols::ligand_evolution::Scorer::set_main_term | ( | std::string const & | score_term | ) |
Sets which term should be used for optimization.
References main_score_term_, protocols::ligand_evolution::score_terms_, and protocols::TR().
Referenced by initialize_from_options().
| void protocols::ligand_evolution::Scorer::set_pose_path | ( | std::string const & | path | ) |
Sets the path where poses should be saved. Leave it empty to save in the current working directory.
References protocols::hybridization::path, and pose_path_.
Referenced by initialize_from_options().
| void protocols::ligand_evolution::Scorer::set_raw_scores | ( | LigandIdentifier const & | identifier, |
| double const * | raw_scores | ||
| ) |
Transforms raw double scores into a proper map and calls set_scores @detail Expects scores in the same order as score_terms.
References protocols::ligand_evolution::score_terms_, and set_scores().
| void protocols::ligand_evolution::Scorer::set_score_function | ( | core::scoring::ScoreFunctionOP | score_function | ) |
Sets the desired score function.
References score_function_.
Referenced by initialize_from_options().
| void protocols::ligand_evolution::Scorer::set_scores | ( | LigandIdentifier const & | identifier, |
| std::map< std::string, core::Real > const & | scores | ||
| ) |
Sets all score terms for an identifier if not set yet.
This functions expects that the scores were calculated by another instance of a Scorer which took care of all runs and wrote the best pose to disk
References is_scored(), score_memory_, and protocols::TR().
Referenced by next_step(), and set_raw_scores().
| void protocols::ligand_evolution::Scorer::set_similarity_penalty_threshold | ( | core::Real | threshold | ) |
References similarity_penalty_threshold_.
Referenced by initialize_from_options().
|
private |
Referenced by score_population(), and set_base_similarity_penalty().
|
private |
Referenced by apply_movers(), calculate_scores(), create_pose(), and next_step().
|
private |
Referenced by calculate_scores(), dump_pose(), and next_step().
|
private |
Referenced by calculate_scores(), create_pose(), dump_pose(), has_ligand(), next_step(), and set_ligand().
|
private |
Referenced by create_pose(), next_step(), and set_ligand().
|
private |
Referenced by calculate_scores(), next_step(), and set_ligand().
|
private |
Referenced by expose_id_memory(), and score_individual().
|
private |
|
private |
Referenced by calculate_scores(), and create_pose().
|
private |
Important! LigendIdentifier here is NOT the same as in the rest of the program. This uses the real names from reactions and reagents.
Referenced by check_memory(), get_best_loaded(), and load_scores().
|
private |
Referenced by calculate_scores(), get_best_loaded(), load_scores(), save_results(), score_individual(), and set_main_term().
|
private |
Referenced by add_mover(), and apply_movers().
|
private |
Referenced by next_step().
|
private |
Referenced by dump_pose(), and set_pose_path().
|
private |
Referenced by calculate_scores(), and set_score_function().
|
private |
|
private |
Referenced by next_step().
|
private |
Referenced by score_population(), and set_similarity_penalty_threshold().
|
private |
Referenced by apply_movers(), and calculate_scores().