![]() |
Rosetta
2021.16
|
A helper class to assist in parsing rotamer libraries. More...
#include <RotamericSingleResidueDunbrackLibraryParser.hh>

Public Member Functions | |
| RotamericSingleResidueDunbrackLibraryParser (core::Size const num_mainchain_torsions, core::Size const max_possible_chis, core::Size const max_possible_rotamers, bool const correct_rotamer_well_order_on_read, bool const symmetrize_rotamer_library) | |
| Default constructor. More... | |
| RotamericSingleResidueDunbrackLibraryParser (RotamericSingleResidueDunbrackLibraryParser const &src) | |
| ~RotamericSingleResidueDunbrackLibraryParser () override | |
| RotamericSingleResidueDunbrackLibraryParserOP | clone () const |
| void | clear_imporated_data () |
| Clear all of the data read from a file. More... | |
| std::string | read_file (utility::io::izstream &infile, bool first_line_three_letter_code_already_read, core::chemical::AA const aa) |
| Read an input stream to set up this object. More... | |
| template<core::Size T, core::Size N> | |
| void | configure_rotameric_single_residue_dunbrack_library (RotamericSingleResidueDunbrackLibrary< T, N > &library, utility::fixedsizearray1< Size, N > const &n_bb_bins) const |
| Based on the material read from the file and stored in this object, configure a dunbrack library. More... | |
| template<Size N> | |
| Size | calc_product (utility::fixedsizearray1< Size, N > factors) const |
| Calculate the product of elements in a fixedsizearray. More... | |
Private Member Functions | |
| bool | check_for_extra_column (utility::io::izstream &infile, bool const first_line_three_letter_code_already_read) const |
| When the first non-comment line is read from a rotamer file, check whether there's an extra column (signifying that this is a Shapovalov file, which has an extra column in the middle.) More... | |
| bool | correct_for_duplicated_mainchain_data () |
| The legacy reader had a check for mainchain torsions equal to -180, in which case the last rotamer read was discarded. Maintaining that here. More... | |
| void | remove_last_entry_in_vectors () |
| Delete the last entry in all of the data vectors. More... | |
| void | check_correct_vector_lengths () const |
| Confirm that all data vectors have the same length. Throw an error if they don't. More... | |
| bool | determine_rotamer_well_order (utility::vector1< std::map< core::Size, core::Size > > &rotamer_well_reordering, std::string const &filename) const |
| Determine the remapping for the indices of the rotamer wells read from disk to ensure that they have the order consistent with the Rosetta convention. More... | |
| bool | check_rotamer_well_order () const |
| This does a simple check of all of the rotamer well order, to determine whether it's consistent with the Rosetta convention. More... | |
| void | update_rotamer_well_order (utility::vector1< std::map< core::Size, core::Size > > const &rotamer_well_reordering) |
| Given a map defining a reordering of rotamer wells, reorder rotamer wells. More... | |
| void | symmetrize_library (std::string const &filename) |
| Given a rotamer library, symmetrize it. More... | |
| void | do_all_checks_and_corrections (std::string const &filename) |
| Performs a number of checks and corrections. More... | |
| bool | is_canonical_talaris_library (std::string const &filename) const |
| Given a filename, return true if this is a talaris library for a canonical amino acid, false otherwise. More... | |
| bool | is_canonical_beta_nov16_library (std::string const &filename) const |
| Given a filename, return true if this is a beta_nov16 library for a canonical amino acid, false otherwise. More... | |
| bool | is_old_canonical_dun02_library (std::string const &filename) const |
| Given a filename, return true if this is an old Dunbrack 2002 library for a canonical amino acid, false otherwise. More... | |
| bool | value_is_in_map (std::map< core::Size, core::Size > const &the_map, core::Size the_value) const |
| Given a Size->Size map, determine whether there exists a key that maps to a given value. More... | |
| void | hacky_parser_init_workaround () |
| This function forces the instantiation of virtual templated methods in the derived classes. Functions like this one are necessary when combining polymorphism and templates. Though these functions must be compiled, they need never be called. Do not call this function. More... | |
Private Attributes | |
| bool | read_file_was_called_ |
| Was the read_file() method called? More... | |
| core::Size | num_mainchain_torsions_ |
| Number of mainchain torsions upon which this rotamer library depends. More... | |
| core::Size | max_possible_chis_ |
| Max number of chis allowed. More... | |
| core::Size | max_possible_rotamers_ |
| The maximum number of possible rotamers. More... | |
| utility::vector1 < utility::vector1< core::Real > > | backbone_torsions_ |
| Backbone torsions for each rotamer. More... | |
| utility::vector1< core::Size > | counts_ |
| Counts for each rotamer. Not actually used. More... | |
| utility::vector1 < utility::vector1< core::Size > > | rotwells_ |
| Rotamer indices for each rotamer. Only used for warnings. More... | |
| utility::vector1< core::Real > | probabilities_ |
| Probabilities for each rotamer. Used in scoring. More... | |
| utility::vector1 < utility::vector1< core::Real > > | chimeans_ |
| The chimean values, which define the centres of each rotamer. More... | |
| utility::vector1 < utility::vector1< core::Real > > | chi_std_devs_ |
| The chi standard deviation values, which define the ramping of each chi well. More... | |
| bool | is_canonical_dun02_library_ |
| Is this library a canonical amino acid's Dunbrack2002 library? More... | |
| bool | correct_rotamer_well_order_on_read_ |
| Should the rotamer wells be auto-corrected? More... | |
| bool | symmetrize_rotamer_library_ |
| Should this rotamer library be symmetrized? More... | |
A helper class to assist in parsing rotamer libraries.
| core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::RotamericSingleResidueDunbrackLibraryParser | ( | core::Size const | num_mainchain_torsions, |
| core::Size const | max_possible_chis, | ||
| core::Size const | max_possible_rotamers, | ||
| bool const | correct_rotamer_well_order_on_read, | ||
| bool const | symmetrize_rotamer_library | ||
| ) |
Default constructor.
| [in] | num_mainchain_torsions | The number of mainchain torsions on which this rotamer library depends. |
| [in] | max_possible_chis | The maximum number of chis allowed in this rotamer library. This is the number of chi columns in the file (usually 4). |
| [in] | max_possible_rotamers | The maximum number of rotamers that this rotamer library can define. |
| [in] | correct_rotamer_well_order_on_read | Should rotamer wells be auto-sorted so that they're in order form least to greatest in the interval [0,360)? Note that this should not be necessary, so this defaults to false. |
| [in] | symmetrize_rotamer_library | If true, the rotamer library is symmetrized by averaging. Useful for peptoids with achiral sidechains. |
References max_possible_chis_, max_possible_rotamers_, and num_mainchain_torsions_.
| core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::RotamericSingleResidueDunbrackLibraryParser | ( | RotamericSingleResidueDunbrackLibraryParser const & | src | ) |
References max_possible_chis_, max_possible_rotamers_, and num_mainchain_torsions_.
|
override |
|
inline |
Calculate the product of elements in a fixedsizearray.
References core::chemical::element::N.
Referenced by configure_rotameric_single_residue_dunbrack_library().
|
private |
Confirm that all data vectors have the same length. Throw an error if they don't.
References backbone_torsions_, chi_std_devs_, chimeans_, counts_, probabilities_, and rotwells_.
Referenced by do_all_checks_and_corrections().
|
private |
When the first non-comment line is read from a rotamer file, check whether there's an extra column (signifying that this is a Shapovalov file, which has an extra column in the middle.)
References max_possible_chis_, and num_mainchain_torsions_.
Referenced by read_file().
|
private |
This does a simple check of all of the rotamer well order, to determine whether it's consistent with the Rosetta convention.
Rotamers should be in order from lowest to highest in the range [0, 360). Returns true if this is NOT the case, false otherwise.
References backbone_torsions_, chimeans_, and rotwells_.
Referenced by do_all_checks_and_corrections().
| void core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::clear_imporated_data | ( | ) |
Clear all of the data read from a file.
Also resets read_file_was_called_ to false.
References backbone_torsions_, chi_std_devs_, chimeans_, counts_, is_canonical_dun02_library_, max_possible_rotamers_, probabilities_, read_file_was_called_, and rotwells_.
Referenced by read_file().
| RotamericSingleResidueDunbrackLibraryParserOP core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::clone | ( | ) | const |
| void core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::configure_rotameric_single_residue_dunbrack_library | ( | RotamericSingleResidueDunbrackLibrary< T, N > & | library, |
| utility::fixedsizearray1< Size, N > const & | n_bb_bins | ||
| ) | const |
Based on the material read from the file and stored in this object, configure a dunbrack library.
read_file() must be called first.
| [in] | library | Pass in *this from a RotamericSingleResidueDunbrackLibrary member function. |
| [in] | n_bb_bins | Pass in N_BB_BINS. |
References backbone_torsions_, calc_product(), chi_std_devs_, chimeans_, core::pack::dunbrack::SingleResidueDunbrackLibrary::declare_all_existing_rotwells_encountered(), core::pack::dunbrack::DUNBRACK_MAX_SCTOR, core::pack::dunbrack::RotamericSingleResidueDunbrackLibrary< T, N >::get_bb_bins(), core::pack::dunbrack::SingleResidueDunbrackLibrary::mark_rotwell_exists(), core::chemical::element::N, core::pack::dunbrack::SingleResidueDunbrackLibrary::n_packed_rots(), core::pack::dunbrack::SingleResidueDunbrackLibrary::n_possible_rots(), core::pack::dunbrack::RotamericSingleResidueDunbrackLibrary< T, N >::packed_rotno_2_sorted_rotno(), probabilities_, read_file_was_called_, core::pack::dunbrack::RotamericSingleResidueDunbrackLibrary< T, N >::rotamers(), core::pack::dunbrack::SingleResidueDunbrackLibrary::rotwell_2_packed_rotno(), and rotwells_.
Referenced by hacky_parser_init_workaround(), and core::pack::dunbrack::RotamericSingleResidueDunbrackLibrary< T, N >::read_from_file().
|
private |
The legacy reader had a check for mainchain torsions equal to -180, in which case the last rotamer read was discarded. Maintaining that here.
References backbone_torsions_, num_mainchain_torsions_, and remove_last_entry_in_vectors().
Referenced by read_file().
|
private |
Determine the remapping for the indices of the rotamer wells read from disk to ensure that they have the order consistent with the Rosetta convention.
Rotamers should be in order from lowest to highest in the range [0, 360). Returns true if this is NOT the case, false otherwise. If true, the rotamer_well_reordering map (which is cleared by this operation) is populated with a remapping that sorts the rotamers properly.
References backbone_torsions_, chimeans_, rotwells_, core::pack::dunbrack::TR(), and value_is_in_map().
Referenced by do_all_checks_and_corrections().
|
private |
Performs a number of checks and corrections.
Calls check_correct_vector_lengths(), determine_rotamer_well_order(), check_rotamer_well_order(), update_rotamer_well_order(), and symmetrize_library() (for peptoids). Additional checks and corrections may be added in the future.
| [in] | filename | The name of the rotamer file currently being read. This is only used for error messages. |
References check_correct_vector_lengths(), check_rotamer_well_order(), correct_rotamer_well_order_on_read_, determine_rotamer_well_order(), is_canonical_beta_nov16_library(), is_canonical_dun02_library_, is_canonical_talaris_library(), is_old_canonical_dun02_library(), symmetrize_library(), symmetrize_rotamer_library_, core::pack::dunbrack::TR(), and update_rotamer_well_order().
Referenced by read_file().
|
private |
This function forces the instantiation of virtual templated methods in the derived classes. Functions like this one are necessary when combining polymorphism and templates. Though these functions must be compiled, they need never be called. Do not call this function.
THIS FUNCTION SHOULD NEVER BE CALLED!
References configure_rotameric_single_residue_dunbrack_library(), and core::chemical::ResidueType::make().
|
private |
Given a filename, return true if this is a beta_nov16 library for a canonical amino acid, false otherwise.
References protocols::abinitio::filename(), and protocols::hybridization::path.
Referenced by do_all_checks_and_corrections().
|
private |
Given a filename, return true if this is a talaris library for a canonical amino acid, false otherwise.
References protocols::abinitio::filename(), and protocols::hybridization::path.
Referenced by do_all_checks_and_corrections().
|
private |
Given a filename, return true if this is an old Dunbrack 2002 library for a canonical amino acid, false otherwise.
References protocols::abinitio::filename().
Referenced by do_all_checks_and_corrections().
| std::string core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::read_file | ( | utility::io::izstream & | infile, |
| bool | first_line_three_letter_code_already_read, | ||
| core::chemical::AA const | aa | ||
| ) |
Read an input stream to set up this object.
The RotamericSingleResidueDunbrackLibraryParser stores the information from the rotamer library in a very one-to-one format, and can subsequently be used to configure a RotamericSingleResidueDunbrackLibrary object (requiring some interpretation of the data).
References backbone_torsions_, BOGUS_CHI_STD_DEV, check_for_extra_column(), chi_std_devs_, chimeans_, clear_imporated_data(), correct_for_duplicated_mainchain_data(), counts_, do_all_checks_and_corrections(), is_canonical_dun02_library_, core::chemical::is_canonical_L_aa_or_gly(), max_possible_chis_, MIN_CHI_STD_DEV, MIN_PROBABILITY, core::chemical::name_from_aa(), num_mainchain_torsions_, probabilities_, protocols::simple_moves::bb_sampler::probability, read_file_was_called_, and rotwells_.
Referenced by core::pack::dunbrack::RotamericSingleResidueDunbrackLibrary< T, N >::read_from_file().
|
private |
Delete the last entry in all of the data vectors.
References backbone_torsions_, chi_std_devs_, chimeans_, counts_, probabilities_, and rotwells_.
Referenced by correct_for_duplicated_mainchain_data().
|
private |
Given a rotamer library, symmetrize it.
Called for peptoids with achiral side-chains.
| [in] | filename | The filename of this library, used for logging and error messages. |
References backbone_torsions_, chi_std_devs_, chimeans_, counts_, MIN_DELTA, probabilities_, protocols::noesy_assign::round(), symmetrize_rotamer_library_, and core::pack::dunbrack::TR().
Referenced by do_all_checks_and_corrections().
|
private |
Given a map defining a reordering of rotamer wells, reorder rotamer wells.
References rotwells_.
Referenced by do_all_checks_and_corrections().
|
private |
Given a Size->Size map, determine whether there exists a key that maps to a given value.
Referenced by determine_rotamer_well_order().
|
private |
Backbone torsions for each rotamer.
Referenced by check_correct_vector_lengths(), check_rotamer_well_order(), clear_imporated_data(), configure_rotameric_single_residue_dunbrack_library(), correct_for_duplicated_mainchain_data(), determine_rotamer_well_order(), read_file(), remove_last_entry_in_vectors(), and symmetrize_library().
|
private |
The chi standard deviation values, which define the ramping of each chi well.
Referenced by check_correct_vector_lengths(), clear_imporated_data(), configure_rotameric_single_residue_dunbrack_library(), read_file(), remove_last_entry_in_vectors(), and symmetrize_library().
|
private |
The chimean values, which define the centres of each rotamer.
Referenced by check_correct_vector_lengths(), check_rotamer_well_order(), clear_imporated_data(), configure_rotameric_single_residue_dunbrack_library(), determine_rotamer_well_order(), read_file(), remove_last_entry_in_vectors(), and symmetrize_library().
|
private |
Should the rotamer wells be auto-corrected?
Probably no longer necessary if Voronoi-based interpolation is used.
Referenced by do_all_checks_and_corrections().
|
private |
Counts for each rotamer. Not actually used.
Referenced by check_correct_vector_lengths(), clear_imporated_data(), read_file(), remove_last_entry_in_vectors(), and symmetrize_library().
|
private |
Is this library a canonical amino acid's Dunbrack2002 library?
If it is, we need to skip the correction step, since the canonical Dun02 library has wonky rotamer well orders that are corrected some other way.
Referenced by clear_imporated_data(), do_all_checks_and_corrections(), and read_file().
|
private |
Max number of chis allowed.
Referenced by check_for_extra_column(), read_file(), and RotamericSingleResidueDunbrackLibraryParser().
|
private |
The maximum number of possible rotamers.
Referenced by clear_imporated_data(), and RotamericSingleResidueDunbrackLibraryParser().
|
private |
Number of mainchain torsions upon which this rotamer library depends.
Referenced by check_for_extra_column(), correct_for_duplicated_mainchain_data(), read_file(), and RotamericSingleResidueDunbrackLibraryParser().
|
private |
Probabilities for each rotamer. Used in scoring.
Referenced by check_correct_vector_lengths(), clear_imporated_data(), configure_rotameric_single_residue_dunbrack_library(), read_file(), remove_last_entry_in_vectors(), and symmetrize_library().
|
private |
Was the read_file() method called?
Referenced by clear_imporated_data(), configure_rotameric_single_residue_dunbrack_library(), and read_file().
|
private |
Rotamer indices for each rotamer. Only used for warnings.
Referenced by check_correct_vector_lengths(), check_rotamer_well_order(), clear_imporated_data(), configure_rotameric_single_residue_dunbrack_library(), determine_rotamer_well_order(), read_file(), remove_last_entry_in_vectors(), and update_rotamer_well_order().
|
private |
Should this rotamer library be symmetrized?
Referenced by do_all_checks_and_corrections(), and symmetrize_library().
1.8.7