Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser Class Reference

A helper class to assist in parsing rotamer libraries. More...

#include <RotamericSingleResidueDunbrackLibraryParser.hh>

Inheritance diagram for core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser:
Inheritance graph
[legend]

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::Sizecounts_
 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::Realprobabilities_
 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...
 

Detailed Description

A helper class to assist in parsing rotamer libraries.

Author
Vikram K. Mulligan (vmull.nosp@m.ig@u.nosp@m.w.edu).

Constructor & Destructor Documentation

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.

Parameters
[in]num_mainchain_torsionsThe number of mainchain torsions on which this rotamer library depends.
[in]max_possible_chisThe maximum number of chis allowed in this rotamer library. This is the number of chi columns in the file (usually 4).
[in]max_possible_rotamersThe maximum number of rotamers that this rotamer library can define.
[in]correct_rotamer_well_order_on_readShould 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_libraryIf 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)
core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::~RotamericSingleResidueDunbrackLibraryParser ( )
override

Member Function Documentation

template<Size N>
Size core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::calc_product ( utility::fixedsizearray1< Size, N >  factors) const
inline

Calculate the product of elements in a fixedsizearray.

References core::chemical::element::N.

Referenced by configure_rotameric_single_residue_dunbrack_library().

void core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::check_correct_vector_lengths ( ) const
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().

bool core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::check_for_extra_column ( utility::io::izstream &  infile,
bool const  first_line_three_letter_code_already_read 
) const
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.)

Author
Vikram K. Mulligan, Baker laboratory (vmull.nosp@m.ig@u.nosp@m.w.edu)

References max_possible_chis_, and num_mainchain_torsions_.

Referenced by read_file().

bool core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::check_rotamer_well_order ( ) const
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.

Note
This checks ALL backbone bins.

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
template<core::Size T, core::Size N>
void core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::configure_rotameric_single_residue_dunbrack_library ( RotamericSingleResidueDunbrackLibrary< T, N > &  library,
utility::fixedsizearray1< Size, N > const &  n_bb_bins 
) const
bool core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::correct_for_duplicated_mainchain_data ( )
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.

Returns
Returns true for correction applied (i.e. last rotamer deleted), false otherwise.

References backbone_torsions_, num_mainchain_torsions_, and remove_last_entry_in_vectors().

Referenced by read_file().

bool core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::determine_rotamer_well_order ( utility::vector1< std::map< core::Size, core::Size > > &  rotamer_well_reordering,
std::string const &  filename 
) const
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.

Note
This uses the first backbone bin to determine the reordering. After applying this to all rotamer wells, it is necessary to check that no further reordering is needed. The filename parameter is only used for error messages.

References backbone_torsions_, chimeans_, rotwells_, core::pack::dunbrack::TR(), and value_is_in_map().

Referenced by do_all_checks_and_corrections().

void core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::do_all_checks_and_corrections ( std::string const &  filename)
private
void core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::hacky_parser_init_workaround ( )
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().

bool core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::is_canonical_beta_nov16_library ( std::string const &  filename) const
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().

bool core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::is_canonical_talaris_library ( std::string const &  filename) const
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().

bool core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::is_old_canonical_dun02_library ( std::string const &  filename) const
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).

Note
We might be starting the read in the middle of the file, and the three-letter code from the first line might already have been read.
Returns
The name of the next amino acid specified in the input stream, or alternatively an empty string if EOF is reached.

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().

void core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::remove_last_entry_in_vectors ( )
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().

void core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::symmetrize_library ( std::string const &  filename)
private

Given a rotamer library, symmetrize it.

Called for peptoids with achiral side-chains.

Parameters
[in]filenameThe 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().

void core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::update_rotamer_well_order ( utility::vector1< std::map< core::Size, core::Size > > const &  rotamer_well_reordering)
private

Given a map defining a reordering of rotamer wells, reorder rotamer wells.

References rotwells_.

Referenced by do_all_checks_and_corrections().

bool core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::value_is_in_map ( std::map< core::Size, core::Size > const &  the_map,
core::Size  the_value 
) const
private

Given a Size->Size map, determine whether there exists a key that maps to a given value.

Referenced by determine_rotamer_well_order().

Member Data Documentation

utility::vector1< utility::vector1< core::Real > > core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::backbone_torsions_
private
utility::vector1< utility::vector1 < core::Real > > core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::chi_std_devs_
private
utility::vector1< utility::vector1 < core::Real > > core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::chimeans_
private
bool core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::correct_rotamer_well_order_on_read_
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().

utility::vector1< core::Size > core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::counts_
private
bool core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::is_canonical_dun02_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().

core::Size core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::max_possible_chis_
private
core::Size core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::max_possible_rotamers_
private

The maximum number of possible rotamers.

Referenced by clear_imporated_data(), and RotamericSingleResidueDunbrackLibraryParser().

core::Size core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::num_mainchain_torsions_
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().

utility::vector1< core::Real > core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::probabilities_
private
bool core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::read_file_was_called_
private
utility::vector1< utility::vector1 < core::Size > > core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::rotwells_
private
bool core::pack::dunbrack::RotamericSingleResidueDunbrackLibraryParser::symmetrize_rotamer_library_
private

Should this rotamer library be symmetrized?

Referenced by do_all_checks_and_corrections(), and symmetrize_library().


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