Rosetta 3.5
|
#include <DynamicAggregateFunction.hh>
Public Types | |
typedef MultistateAggregateFunction | parent |
typedef protocols::genetic_algorithm::Entity | Entity |
typedef numeric::expression_parser::Expression | Expression |
typedef numeric::expression_parser::ExpressionOP | ExpressionOP |
typedef numeric::expression_parser::ExpressionCOP | ExpressionCOP |
typedef numeric::expression_parser::VariableExpression | VariableExpression |
typedef numeric::expression_parser::VariableExpressionOP | VariableExpressionOP |
typedef numeric::expression_parser::VariableExpressionCOP | VariableExpressionCOP |
typedef numeric::expression_parser::ArithmeticASTExpressionOP | ArithmeticASTExpressionOP |
typedef utility::vector1 < core::Real > | ExpressionValues |
typedef core::Size | Size |
![]() | |
typedef utility::pointer::ReferenceCount | parent |
typedef utility::vector1 < core::Real > | StateEnergies |
typedef utility::vector1 < core::Size > | StateIndices |
typedef protocols::genetic_algorithm::Entity | Entity |
Public Member Functions | |
DynamicAggregateFunction () | |
virtual | ~DynamicAggregateFunction () |
void | set_num_entity_elements (Size setting) |
void | set_score_function (core::scoring::ScoreFunction const &sfxn) |
core::Size | num_states () const |
core::Size | num_npd_properties () const |
virtual core::Real | evaluate (StateEnergies const &, StateEnergies const &npd_properties, Entity const &) |
virtual StateIndices | select_relevant_states (StateEnergies const &en, StateEnergies const &npd, Entity const &) |
void | initialize_from_input_file (DaemonSetOP daemon_set, std::istream &input) |
ExpressionCOP | variable_expression (numeric::expression_parser::ArithmeticASTValue const &) const |
ExpressionCOP | function_expression (numeric::expression_parser::FunctionTokenCOP function, utility::vector1< ExpressionCOP > const &args) const |
void | add_file_contents (std::string const &fname, std::string const &contents) |
Pair a file name with a string – instead of opening a file when asked to read this file, the DAF will use the contents of the file as provided. More... | |
std::string | state_name (Size state_index) const |
![]() | |
MultistateAggregateFunction () | |
virtual | ~MultistateAggregateFunction () |
Private Member Functions | |
void | read_all_variables_from_input_file (std::istream &input) |
void | initialize_scanner () |
void | process_STATE_line (std::string const &line, Size line_number, std::istream &input_line) |
void | process_STATE_VECTOR_line (std::string const &line, Size line_number, std::istream &input_line, utility::vector1< std::pair< std::string, std::string > > &strucvec_filenames) |
void | process_POSE_ENERGY_line (std::string const &line, Size line_number, std::istream &input_line) |
void | process_POSE_ENERGY_VECTOR_line (std::string const &line, Size line_number, std::istream &input_line) |
void | process_NPD_PROPERTY_line (std::string const &line, Size line_number, std::istream &input_line) |
void | process_VECTOR_VARIABLE_line (std::string const &line, Size line_number, std::istream &input_line, std::map< std::string, std::list< std::string > > &vector_variables) |
void | process_SCALAR_EXPRESSION_line (std::string const &line, Size line_number, std::istream &input_line, std::map< std::string, ArithmeticASTExpressionOP > &scalar_expression_asts) |
void | process_VECTOR_EXPRESSION_line (std::string const &line, Size line_number, std::istream &input_line, std::map< std::string, std::pair< std::map< std::string, std::string >, ArithmeticASTExpressionOP > > &vector_expression_list) |
void | process_ENTITY_FUNCTION_line (std::string const &line, Size line_number, std::istream &input_line) |
void | process_FITNESS_line (std::string const &line, Size line_number, std::istream &input_line, ArithmeticASTExpressionOP &fitness_expression_ast) |
void | read_state_vector_file (std::string const &vec_varname, std::string const &fname, Size &n_vector_states) |
void | create_state_variable_expressions (Size &count_state, Size &count_npd_index, Size &count_variable_index) |
void | create_variable_vector_expressions (Size &count_state, Size &count_npd_index, Size &count_variable_index) |
void | create_scalar_and_vector_expression_variable_expressions (std::map< std::string, ArithmeticASTExpressionOP > const &scalar_expression_asts, std::map< std::string, std::list< std::string > > const &vector_variables, Size &count_state) |
void | turn_expression_ASTs_into_expressions (std::map< std::string, ArithmeticASTExpressionOP > const &scalar_expression_asts, std::map< std::string, std::pair< std::map< std::string, std::string >, ArithmeticASTExpressionOP > > const &vector_expression_asts, ArithmeticASTExpressionOP fitness_expression_ast) |
utility::vector1 < VectorExpressionCOP > | verify_vector_arguments (std::string const &fname, utility::vector1< ExpressionCOP > const &args, Size expected_nargs) const |
void | verify_variable_name_or_throw (std::string const &vname, std::string const &command_name, std::string const &line, Size line_number) |
void | initialize_pack_daemons (DaemonSetOP daemon_set) |
void | count_file_reads (std::map< std::string, Size > &total_reads, std::map< std::string, Size > &reads_completed) const |
void | increment_total_read_count_for_file (std::string const &fname, std::map< std::string, Size > &total_reads, std::map< std::string, Size > &reads_completed) const |
std::string | get_file_contents (std::string const &filename, std::map< std::string, Size > const &total_reads, std::map< std::string, Size > &reads_completed, std::map< std::string, std::string > &file_contents_map) const |
void | initialize_daemon_with_all_states (DaemonSetOP daemon_set, std::map< std::string, Size > const &total_reads, std::map< std::string, Size > &reads_completed) |
void | distribute_jobs_to_remote_daemons (DaemonSetOP daemon_set, std::map< std::string, Size > const &total_reads, std::map< std::string, Size > &reads_completed) |
StructureFileNames const & | file_inputs_for_job (int job_index) const |
void | assign_jobs_to_local_daemon_set (std::list< int > const &job_indices, DaemonSetOP daemon_set, std::map< std::string, Size > const &total_reads, std::map< std::string, Size > &reads_completed, std::map< std::string, std::string > &file_contents_map) const |
void | assign_jobs_to_remote_daemon_sets (int proc_id, std::list< int > const &job_indices, std::map< std::string, Size > const &total_reads, std::map< std::string, Size > &reads_completed, std::map< std::string, std::string > &file_contents_map) const |
bool | verify_remote_daemon_set_initialization_successful (int proc_id) const |
void | send_success_message_to_remote_daemon_set (int proc_id) const |
void | send_error_message_to_remote_daemon_sets () const |
void | assign_state_energies_to_variables_and_subexpressions (StateEnergies const &state_energies, StateEnergies const &npd_properties, Entity const &entity, bool verbose=false) |
Size | count_num_npd_properties () const |
used to determine the number of requested NPD properties that will be calculated; used to size the variable_expressions_for_npd_properties_ array. More... | |
typedef numeric::expression_parser::ArithmeticASTExpressionOP protocols::pack_daemon::DynamicAggregateFunction::ArithmeticASTExpressionOP |
typedef protocols::genetic_algorithm::Entity protocols::pack_daemon::DynamicAggregateFunction::Entity |
typedef numeric::expression_parser::Expression protocols::pack_daemon::DynamicAggregateFunction::Expression |
typedef numeric::expression_parser::ExpressionCOP protocols::pack_daemon::DynamicAggregateFunction::ExpressionCOP |
typedef numeric::expression_parser::ExpressionOP protocols::pack_daemon::DynamicAggregateFunction::ExpressionOP |
typedef utility::vector1< core::Real > protocols::pack_daemon::DynamicAggregateFunction::ExpressionValues |
typedef numeric::expression_parser::VariableExpression protocols::pack_daemon::DynamicAggregateFunction::VariableExpression |
typedef numeric::expression_parser::VariableExpressionCOP protocols::pack_daemon::DynamicAggregateFunction::VariableExpressionCOP |
typedef numeric::expression_parser::VariableExpressionOP protocols::pack_daemon::DynamicAggregateFunction::VariableExpressionOP |
protocols::pack_daemon::DynamicAggregateFunction::DynamicAggregateFunction | ( | ) |
|
virtual |
void protocols::pack_daemon::DynamicAggregateFunction::add_file_contents | ( | std::string const & | fname, |
std::string const & | contents | ||
) |
Pair a file name with a string – instead of opening a file when asked to read this file, the DAF will use the contents of the file as provided.
References file_contents_.
|
private |
References protocols::pack_daemon::StructureFileNames::correspondence_file_name_, core::sequence::end, file_inputs_for_job(), get_file_contents(), npd_variable_indices_for_states_, protocols::pack_daemon::StructureFileNames::pdb_name_, core::import_pose::pose_from_pdbstring(), and protocols::pack_daemon::StructureFileNames::resfile_name_.
Referenced by distribute_jobs_to_remote_daemons(), and initialize_daemon_with_all_states().
|
private |
References protocols::pack_daemon::add_daemon, protocols::pack_daemon::StructureFileNames::correspondence_file_name_, core::sequence::end, file_inputs_for_job(), get_file_contents(), npd_variable_indices_for_states_, protocols::pack_daemon::StructureFileNames::pdb_name_, and protocols::pack_daemon::StructureFileNames::resfile_name_.
Referenced by distribute_jobs_to_remote_daemons().
|
private |
References entity_funcs_, scalar_expressions_, variable_expressions_, variable_expressions_for_npd_properties_, and variable_expressions_for_states_.
Referenced by evaluate(), and select_relevant_states().
|
private |
References protocols::pack_daemon::StructureFileNames::correspondence_file_name_, increment_total_read_count_for_file(), named_state_data_file_names_, protocols::pack_daemon::StructureFileNames::pdb_name_, protocols::pack_daemon::StructureFileNames::resfile_name_, and state_vector_data_file_names_.
Referenced by initialize_pack_daemons().
|
private |
used to determine the number of requested NPD properties that will be calculated; used to size the variable_expressions_for_npd_properties_ array.
References named_state_data_file_names_, npd_properties_for_state_variables_, and state_vector_data_file_names_.
Referenced by read_all_variables_from_input_file().
|
private |
creates a variable expression for each sub-expression that will hold the intermediate result of a sub-expression. Increments the count_variable_index input parameter and places the VariableExpression into the variable_expressions_ array into position count_variable_index.
References scalar_expression_map_, surrogate_expression_map_, variable_expressions_, variable_name_2_variable_exp_index_, and vector_expression_map_.
Referenced by read_all_variables_from_input_file().
|
private |
For each element of the named_state_data_file_names_ data member, creates a VariableExpression (named with the variable name given in the STATE command from the DynamicAggregateFunction input file). This variable expression is put into three member variables: the variable_expressions_for_states_ vector, the variable_expressions_ vector, and the named_state_expression_map_. This method increments the count_states input parameter for each VariableExpression that it processes, pairing the value of the count_states variable with the index for this VariableExpression in both the variable_expressions_for_states_ vector and in the variable_expressions_ vector.
References files_for_state_, named_state_data_file_names_, named_state_expression_map_, npd_properties_for_state_variables_, npd_variable_indices_for_states_, scalar_expression_map_, state_variable_name_2_state_index_, variable_expressions_, variable_expressions_for_npd_properties_, variable_expressions_for_states_, and variable_name_2_variable_exp_index_.
Referenced by read_all_variables_from_input_file().
|
private |
This method iterates across state_vector_data_file_names_ map, and creates a VariableVectorExpression for each entry. It adds this VariableVectorExpression to the state_vector_variables_ map. For each element in the state_vector_data_file_names_ map, and for each state-file-triple held in each particular element, it creates a VariableExpression and pairs the index in the input count_state vector. This VariableExpression is added to three member variables: the variable_expressions_for_states_ vector, the variable_expressions_ vector. Each VariableVectorExpression is given a vector of its set of VariableExpressions in its constructor. It will access these variables directly when it is queried for its vector_values. The indices of the state varaibles are inserted into the state_indices_for_state_vector_ map.
References files_for_state_, npd_properties_for_state_variables_, npd_variable_indices_for_states_, state_indices_for_state_vector_, state_variable_name_2_state_index_, state_vector_data_file_names_, state_vector_variables_, variable_expressions_, variable_expressions_for_npd_properties_, variable_expressions_for_states_, variable_name_2_variable_exp_index_, and vector_expression_map_.
Referenced by read_all_variables_from_input_file().
|
private |
References assign_jobs_to_local_daemon_set(), assign_jobs_to_remote_daemon_sets(), protocols::pack_daemon::error_message, send_error_message_to_remote_daemon_sets(), send_success_message_to_remote_daemon_set(), variable_expressions_for_states_, and verify_remote_daemon_set_initialization_successful().
Referenced by initialize_pack_daemons().
|
virtual |
|
private |
References files_for_state_.
Referenced by assign_jobs_to_local_daemon_set(), and assign_jobs_to_remote_daemon_sets().
ExpressionCOP protocols::pack_daemon::DynamicAggregateFunction::function_expression | ( | numeric::expression_parser::FunctionTokenCOP | function, |
utility::vector1< ExpressionCOP > const & | args | ||
) | const |
Handles the functions that the ExpressionCreator base class does not. Ensures that the functions that are expecting vector arguments are actually given vector arguments. This is not guaranteed by the scanning or parsing of the input file.
References verify_vector_arguments().
Referenced by protocols::pack_daemon::VectorExpressionCreator::handle_function_expression().
|
private |
References file_contents_, and protocols::abinitio::filename().
Referenced by assign_jobs_to_local_daemon_set(), and assign_jobs_to_remote_daemon_sets().
|
private |
Referenced by count_file_reads().
|
private |
References assign_jobs_to_local_daemon_set(), and variable_expressions_for_states_.
Referenced by initialize_pack_daemons().
void protocols::pack_daemon::DynamicAggregateFunction::initialize_from_input_file | ( | DaemonSetOP | daemon_set, |
std::istream & | input | ||
) |
|
private |
References count_file_reads(), distribute_jobs_to_remote_daemons(), and initialize_daemon_with_all_states().
Referenced by initialize_from_input_file().
|
private |
References scanner_.
Referenced by read_all_variables_from_input_file().
core::Size protocols::pack_daemon::DynamicAggregateFunction::num_npd_properties | ( | ) | const |
References variable_expressions_for_npd_properties_.
core::Size protocols::pack_daemon::DynamicAggregateFunction::num_states | ( | ) | const |
References variable_expressions_for_states_.
|
private |
References entity_funcs_, entity_funcs_dec_line_, file_contents_, num_entity_elements_, scanner_, and verify_variable_name_or_throw().
Referenced by read_all_variables_from_input_file().
|
private |
This method reads the line of the input file beginning with the command FITNESS. Each DynamicAggregateFunction input file should contain exactly one FITNESS command. The fitness line should be of the form: FITNESS <expression> where the expression must return a value (it should not be a vector expression) and may refer to functions and variables so long as those variables have been declared earlier in the file. The abstract syntax tree (ast) for the fitness expression is returned in the input parameter, fitness_expression_ast.
References scanner_.
Referenced by read_all_variables_from_input_file().
|
private |
|
private |
|
private |
|
private |
This methods reads the line beginning with the command SCALAR_EXPRESSION which should be in the following format ( items in <> are explained below) SCALAR_EXPRESSION <varname> = <expression>
References expression_evaluation_order_by_name_, scalar_variable_names_dec_line_, scanner_, variable_names_dec_line_, and verify_variable_name_or_throw().
Referenced by read_all_variables_from_input_file().
|
private |
Reads the contents of the line which should include four things:
References protocols::pack_daemon::StructureFileNames::correspondence_file_name_, named_state_data_file_names_, protocols::pack_daemon::StructureFileNames::pdb_name_, protocols::pack_daemon::StructureFileNames::resfile_name_, scalar_variable_names_dec_line_, scanner_, state_name(), state_variable_names_, variable_names_dec_line_, and verify_variable_name_or_throw().
Referenced by read_all_variables_from_input_file().
|
private |
This method reads a line beginning with the command STATE_VECTOR looking for two things on this line:
References scanner_, state_vector_variable_names_, variable_names_dec_line_, vector_variable_names_dec_line_, and verify_variable_name_or_throw().
Referenced by read_all_variables_from_input_file().
|
private |
|
private |
|
private |
References count_num_npd_properties(), create_scalar_and_vector_expression_variable_expressions(), create_state_variable_expressions(), create_variable_vector_expressions(), files_for_state_, function_names_, illegal_variable_names_, initialize_scanner(), named_state_data_file_names_, npd_variable_indices_for_states_, process_ENTITY_FUNCTION_line(), process_FITNESS_line(), process_NPD_PROPERTY_line(), process_POSE_ENERGY_line(), process_POSE_ENERGY_VECTOR_line(), process_SCALAR_EXPRESSION_line(), process_STATE_line(), process_STATE_VECTOR_line(), process_VECTOR_EXPRESSION_line(), process_VECTOR_VARIABLE_line(), read_state_vector_file(), state_vector_data_file_names_, turn_expression_ASTs_into_expressions(), variable_expressions_, variable_expressions_for_npd_properties_, and variable_expressions_for_states_.
Referenced by initialize_from_input_file().
|
private |
This function reads the contents of a state-vector file. The input parameter vec_varname refers to the variable name associated with the file named by the second input parameter – this pairing occurred somewhere in the DynamicAggregateFunction input file in a STATE_VECTOR command. The format of the state vector should be a series of lines each with three strings. String 1: the name of the pdb file containing a state that should be repacked. String 2: the name of the correspondence file mapping residues in the input pdb to the shared residues. String 3: the name of the secondary resfile describing how the packer should treat residues other than the correspondence residues in the protein. Lines beginning with "#" are ignored. The triples read from this file are appended to the state_vector_data_file_names_ member variable. The method increments the input variable n_vector_states for each triple that it reads from the state-vector file.
References protocols::pack_daemon::StructureFileNames::correspondence_file_name_, file_contents_, protocols::pack_daemon::StructureFileNames::pdb_name_, protocols::pack_daemon::StructureFileNames::resfile_name_, state_vector_data_file_names_, and variable_names_dec_line_.
Referenced by read_all_variables_from_input_file().
|
virtual |
Relies on the Expression "active_variables" method to determine which variables are selected and contribute to the fitness function
Implements protocols::pack_daemon::MultistateAggregateFunction.
References assign_state_energies_to_variables_and_subexpressions(), fitness_exp_, and state_variable_name_2_state_index_.
|
private |
References protocols::pack_daemon::error_message.
Referenced by distribute_jobs_to_remote_daemons(), and initialize_from_input_file().
|
private |
References protocols::pack_daemon::success_message.
Referenced by distribute_jobs_to_remote_daemons().
void protocols::pack_daemon::DynamicAggregateFunction::set_num_entity_elements | ( | Size | setting) |
References num_entity_elements_.
void protocols::pack_daemon::DynamicAggregateFunction::set_score_function | ( | core::scoring::ScoreFunction const & | sfxn) |
Required for processing the POSE_ENERGY and POSE_ENERGY_VECTOR commands
References core::scoring::ScoreFunction::clone(), and sfxn_.
std::string protocols::pack_daemon::DynamicAggregateFunction::state_name | ( | Size | state_index) | const |
References variable_expressions_for_states_.
Referenced by process_STATE_line().
|
private |
Turns expression abstract-syntax trees into Expression objects. The VectorExpressionCreator keeps a reference to me so that it can pass control of flow to me when processing variable- and function-construction events. The scalar_expressions_ array is updated to hold the ExpressionOPs for these sub-expressions as pairs each Expression with the corresponding index of its VariableExpression so that I can later update that VariableExpression (held in the variable_expressions_ array) when evaluating that sub-expression. The fitness_exp_ is assigned to the Expression coming from the fitness_expression_ast.
References expression_evaluation_order_by_name_, fitness_exp_, focused_iterative_vector_expression_, scalar_expressions_, surrogate_expression_map_, variable_name_2_variable_exp_index_, and vector_expression_map_.
Referenced by read_all_variables_from_input_file().
ExpressionCOP protocols::pack_daemon::DynamicAggregateFunction::variable_expression | ( | numeric::expression_parser::ArithmeticASTValue const & | ) | const |
returns a VariableExpressionOP or VectorVariableExpressionOP given a particular variable. Throws an exception if a variable is requested that is not a member of any of the following maps: named_state_expression_map_, state_vector_variables_, or sub_expression_map_.
References entity_funcs_, focused_iterative_vector_expression_, named_state_expression_map_, scalar_expression_map_, state_vector_variables_, and vector_expression_map_.
Referenced by protocols::pack_daemon::VectorExpressionCreator::handle_variable_expression().
|
private |
References protocols::pack_daemon::error_message, and protocols::pack_daemon::success_message.
Referenced by distribute_jobs_to_remote_daemons().
|
private |
References entity_funcs_, entity_funcs_dec_line_, function_names_, illegal_variable_names_, and variable_names_dec_line_.
Referenced by process_ENTITY_FUNCTION_line(), process_NPD_PROPERTY_line(), process_POSE_ENERGY_line(), process_POSE_ENERGY_VECTOR_line(), process_SCALAR_EXPRESSION_line(), process_STATE_line(), process_STATE_VECTOR_line(), process_VECTOR_EXPRESSION_line(), and process_VECTOR_VARIABLE_line().
|
private |
Verifies that the args array for a vector function has size 1, and that the sole element is a VectorExpression. Returns an owning-pointer to the downcasted VectorExpression, or throws an exception if the downcast fails.
Referenced by function_expression().
|
private |
|
private |
Referenced by process_ENTITY_FUNCTION_line(), and verify_variable_name_or_throw().
|
private |
|
private |
|
private |
|
private |
Referenced by select_relevant_states(), and turn_expression_ASTs_into_expressions().
|
private |
Referenced by turn_expression_ASTs_into_expressions(), and variable_expression().
|
private |
Function names may not be used as variable names.
Referenced by read_all_variables_from_input_file(), and verify_variable_name_or_throw().
|
private |
This set represents strings that may not be used as variable names but which are not funciton names
Referenced by read_all_variables_from_input_file(), and verify_variable_name_or_throw().
|
private |
|
private |
Referenced by create_state_variable_expressions(), and variable_expression().
|
private |
|
private |
|
private |
|
private |
|
private |
Referenced by process_ENTITY_FUNCTION_line(), and set_num_entity_elements().
|
private |
|
private |
|
private |
|
private |
Referenced by initialize_scanner(), process_ENTITY_FUNCTION_line(), process_FITNESS_line(), process_NPD_PROPERTY_line(), process_POSE_ENERGY_line(), process_POSE_ENERGY_VECTOR_line(), process_SCALAR_EXPRESSION_line(), process_STATE_line(), process_STATE_VECTOR_line(), process_VECTOR_EXPRESSION_line(), and process_VECTOR_VARIABLE_line().
|
private |
Referenced by set_score_function().
|
private |
Referenced by create_variable_vector_expressions().
|
private |
Keep track for each state-variable name its state's index.
Referenced by create_state_variable_expressions(), create_variable_vector_expressions(), and select_relevant_states().
|
private |
Referenced by process_NPD_PROPERTY_line(), and process_STATE_line().
|
private |
|
private |
Referenced by process_NPD_PROPERTY_line(), and process_STATE_VECTOR_line().
|
private |
Referenced by create_variable_vector_expressions(), and variable_expression().
|
private |
|
private |
|
private |
|
private |
|
private |
Keep track for each varible name (or scalar expression name) its index in the ?? vector.
Referenced by create_scalar_and_vector_expression_variable_expressions(), create_state_variable_expressions(), create_variable_vector_expressions(), and turn_expression_ASTs_into_expressions().
|
private |
|
private |
|
private |
|
private |