Rosetta  2020.11
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
protocols::mean_field::AAMatrix Class Reference

#include <AAMatrix.hh>

Inheritance diagram for protocols::mean_field::AAMatrix:
Inheritance graph
[legend]

Public Member Functions

 AAMatrix ()
 Standard constructor. More...
 
 AAMatrix (std::istream &aa_matrix_file)
 Constructor to build AAMatrix from a file. More...
 
 AAMatrix (RotMatrix const &rm, protocols::mean_field::jagged_array< core::Real > em, core::Real temp)
 Constructs a AAMatrix from a RotMatrix (standard way of constructing AAMatrix) More...
 
 AAMatrix (AAMatrix const &object_to_copy)
 Copy constructor. More...
 
AAMatrixoperator= (AAMatrix const &object_to_copy)
 Assignment operator. More...
 
 ~AAMatrix () override
 Destructor. More...
 
utility::vector1< core::Realcosine_distance (AAMatrix const &aa_matrix) const
 calculates vector of cosine distances between vectors of this AAMatrix and a second AAMatrix More...
 
utility::vector1< core::Realfrob_distance (AAMatrix const &aa_matrix) const
 calculates vector of frob distances between vectors of this AAMatrix and a second AAMatrix More...
 
utility::vector1< core::Realave_abs_diff (AAMatrix const &aa_matrix) const
 calculates vector of average absolute differences between vectors of this AAMatrix and a second AAMatrix More...
 
void show (std::ostream &output=std::cout) const
 Generate string representation of AAMatrix for debugging purposes. More...
 
void dump_transfac (std::string const &filename) const
 outputs AA Matrix in transfac format for dumping purposes More...
 
bool empty () const
 returns true if all probabilities are 0 More...
 
utility::vector1< core::Size >
const & 
curr_aa () const
 returns vector of current amino acids at each position (if current rotamer is set for that position) More...
 
utility::vector1< AAProbcurr_aa_prob () const
 returns vector of probabilities of current amino acids at each position (if current rotamer is set for that position) More...
 
void build_aa_matrix (RotMatrix const &rm, protocols::mean_field::jagged_array< core::Real > em, core::Real temp)
 builds AAMatrix from RotMatrix rm using private method init More...
 
void build_aa_matrix (std::istream &aa_matrix_file)
 builds AAMatrix from transfac file using private method init More...
 
- Public Member Functions inherited from protocols::mean_field::jagged_array< AAProb >
 jagged_array (allocator_type const &alloc=allocator_type())
 Default constructor. More...
 
 jagged_array (jagged_array< AAProb > const &v)
 Copy constructor. More...
 
 jagged_array (utility::vector1< utility::vector1< AAProb, A > > const &v)
 Assignable copy constructor. More...
 
 jagged_array (size_type const num)
 Size constructor constructs an empty jagged_array of size num. More...
 
 jagged_array (size_type const num, utility::vector1< AAProb > const &vals)
 Size and vals constructor constructs a jagged_array of size num filled with copies of vals. More...
 
 jagged_array (utility::vector1< size_type > const &dims)
 Uniform value constructor. More...
 
 jagged_array (utility::vector1< size_type > const &dims, utility::vector1< AAProb > const &vals)
 Constructor that reserves size based on vector of size types, fills vectors with vals. More...
 
 jagged_array (InputIterator const beg, InputIterator const ending, allocator_type const &alloc=allocator_type())
 Iterator range constructor. More...
 
 ~jagged_array () override
 Destructor. More...
 
jagged_arrayoperator= (jagged_array< AAProb > const &v)
 Copy assignment. More...
 
jagged_arrayoperator= (utility::vector1< utility::vector1< AAProb, A > > const &v)
 Assignable copy assignment. More...
 
void assign (utility::vector1< size_type > const &dims)
 clears jagged_array and reserves size based on vector of size types More...
 
void assign (utility::vector1< size_type > const &dims, utility::vector1< AAProb > const &vals)
 clears jagged_array and reserves size based on vector of size types, fills vectors with vals More...
 
int index (AAProbconst &t) const
 Find the index of an element. If not found then return 0;. More...
 
bool has_value (AAProbconst &t) const
 Checks if element is present and returns bool depending whether present. More...
 
void show (std::ostream &output=std::cout) const
 shows a string representation of the jagged_array More...
 
void apply_func_to_all (typename func_T2< T_2 >::two_param_func func, T_2 operand)
 applies param *func to all values in the jagged_array (1-param func) More...
 
void apply_func_to_each_col (typename func_T2< T_2 >::two_param_func func, utility::vector1< T_2 > operands)
 applies param *func to all values in the jagged_array (2-param func) using column_dependent operand More...
 
void apply_func_to_each_elem (typename func_T2< T_2 >::two_param_func func, jagged_array< T_2 > operands)
 applies param *func to all values in the jagged_array (2-param func) using 2D-index dependent operand (i.e. matrix arithmetic) More...
 
void apply_func_to_each_elem (typename func_T2< T_2 >::three_param_func func, jagged_array< AAProb > operands, T_2 third_oper)
 applies param *func to all values in the jagged_array (3-param func) using 2D-index dependent operand and a third, general operand More...
 
utility::vector1< AAProbget_totals_columns () const
 returns vector1 of totals of columns of jagged_array More...
 
AAProb get_total () const
 returns total of all elements in jagged array More...
 
Size size_col (Size col) const
 returns size of specified column More...
 
Size max_size_col () const
 returns the maximum size of any columns More...
 
bool equal_size (jagged_array< AAProb > const &other) const
 checks if a second jagged_array is of equal size for all columns More...
 
bool equal_size (jagged_array< T_2 > const &other) const
 checks if a second jagged_array (of different type) is of equal size for all columns More...
 

Private Member Functions

void copy_data (AAMatrix &object_to_copy_to, AAMatrix const &object_to_copy_from)
 Copy all data members from <object_to_copy_from> to <object_to_copy_to>. More...
 
void init (protocols::mean_field::RotMatrix const &rm, protocols::mean_field::jagged_array< core::Real > em, core::Real temp)
 private method called by constructors to initialize the AAMatrix from a RotMatrix More...
 
void init (std::istream &aa_matrix_file)
 private method called by constructors to initialize the AAMatrix from a transfac file More...
 
utility::vector1< AAProbparse_aa_matrix_line (utility::vector1< std::string > const &tokens, utility::vector1< core::chemical::AA > const &aa_names)
 parse line of transfac file to add a vector of probabilities for one position to the AAMatrix More...
 
void parse_aa_line (utility::vector1< std::string > const &tokens, utility::vector1< core::chemical::AA > &aa_names)
 parse header (AA codes) line of the AAMatrix More...
 

Private Attributes

utility::vector1< core::Sizecurr_aa_
 

Friends

std::ostream & operator<< (std::ostream &output, AAMatrix const &object_to_output)
 Insertion operator (overloaded so that AAMatrix can be "printed" in PyRosetta). More...
 

Additional Inherited Members

- Public Types inherited from protocols::mean_field::jagged_array< AAProb >
typedef super::value_type value_type
 
typedef super::reference reference
 
typedef super::const_reference const_reference
 
typedef super::pointer pointer
 
typedef super::const_pointer const_pointer
 
typedef super::iterator iterator
 
typedef super::const_iterator const_iterator
 
typedef super::reverse_iterator reverse_iterator
 
typedef
super::const_reverse_iterator 
const_reverse_iterator
 
typedef super::size_type size_type
 
typedef super::difference_type difference_type
 
typedef super::allocator_type allocator_type
 
typedef super::index_type index_type
 
typedef super::ssize_type ssize_type
 
typedef super::Value Value
 
typedef super::Reference Reference
 
typedef super::ConstReference ConstReference
 
typedef super::Pointer Pointer
 
typedef super::ConstPointer ConstPointer
 
typedef super::Iterator Iterator
 
typedef super::ConstIterator ConstIterator
 
typedef super::ReverseIterator ReverseIterator
 
typedef super::ConstReverseIterator ConstReverseIterator
 
typedef super::Size Size
 
typedef super::Difference Difference
 
typedef super::Allocator Allocator
 
typedef super::Index Index
 
typedef super::SSize SSize
 

Detailed Description

Remarks

Constructor & Destructor Documentation

protocols::mean_field::AAMatrix::AAMatrix ( )

Standard constructor.

protocols::mean_field::AAMatrix::AAMatrix ( std::istream &  aa_matrix_file)

Constructor to build AAMatrix from a file.

Builds AAMatrix from a standard transfac file

References init().

protocols::mean_field::AAMatrix::AAMatrix ( RotMatrix const &  rm,
protocols::mean_field::jagged_array< core::Real em,
core::Real  temp 
)

Constructs a AAMatrix from a RotMatrix (standard way of constructing AAMatrix)

Builds AAMatrix from a RotMatrix using private method init

References init().

protocols::mean_field::AAMatrix::AAMatrix ( AAMatrix const &  object_to_copy)

Copy constructor.

References copy_data().

protocols::mean_field::AAMatrix::~AAMatrix ( )
overridedefault

Destructor.

Member Function Documentation

utility::vector1< Real > protocols::mean_field::AAMatrix::ave_abs_diff ( AAMatrix const &  obj) const

calculates vector of average absolute differences between vectors of this AAMatrix and a second AAMatrix

number of elements is the number of positions + 1. last element is the average abs diff between entire matrices

param [out] results - vector1 of Frobenius distances, calculated per-column and for the entire matrix.

Remarks
distance is calculated between corresponding columns, determined by pos() of the AAProbs in the columns
if there are no corresponding columns, returns empty vector1

References protocols::cluster::calibur::aa, protocols::mean_field::jagged_array< T, A >::assign(), empty(), protocols::mean_field::num_elements(), protocols::simple_moves::bb_sampler::probability, and protocols::hybridization::val.

Referenced by protocols::mean_field::GenMeanFieldMover::report_dist().

void protocols::mean_field::AAMatrix::build_aa_matrix ( RotMatrix const &  rm,
protocols::mean_field::jagged_array< core::Real em,
core::Real  temp 
)
inline

builds AAMatrix from RotMatrix rm using private method init

References init().

Referenced by protocols::mean_field::GenMeanFieldMover::read_aa_matrix().

void protocols::mean_field::AAMatrix::build_aa_matrix ( std::istream &  aa_matrix_file)
inline

builds AAMatrix from transfac file using private method init

References init().

void protocols::mean_field::AAMatrix::copy_data ( AAMatrix object_to_copy_to,
AAMatrix const &  object_to_copy_from 
)
private

Copy all data members from <object_to_copy_from> to <object_to_copy_to>.

References curr_aa_.

Referenced by AAMatrix(), and operator=().

utility::vector1< Real > protocols::mean_field::AAMatrix::cosine_distance ( AAMatrix const &  obj) const

calculates vector of cosine distances between vectors of this AAMatrix and a second AAMatrix

number of elements is the number of positions + 1. last element is the cosine distance between entire matrices

param [out] results - vector1 of cosine distances, calculated per-column and for the entire matrix.

Remarks
distance is calculated between corresponding columns, determined by pos() of the AAProbs in the columns
if there are no corresponding columns, returns empty vector1

References protocols::mean_field::jagged_array< T, A >::get_total(), protocols::mean_field::jagged_array< T, A >::get_totals_columns(), and protocols::simple_moves::bb_sampler::probability.

Referenced by protocols::mean_field::GenMeanFieldMover::report_dist().

utility::vector1< core::Size > const& protocols::mean_field::AAMatrix::curr_aa ( ) const
inline

returns vector of current amino acids at each position (if current rotamer is set for that position)

References curr_aa_.

utility::vector1< AAProb > protocols::mean_field::AAMatrix::curr_aa_prob ( ) const

returns vector of probabilities of current amino acids at each position (if current rotamer is set for that position)

returns vector with probabilities of the current amino acids based on curr_aa_ vector

References curr_aa_.

Referenced by show().

void protocols::mean_field::AAMatrix::dump_transfac ( std::string const &  filename) const

outputs AA Matrix in transfac format for dumping purposes

Parameters
[in]filename- specifies file for transfac output

output AAMatrix in transfac file format to file specified by filename

Error if filename cannot be opened

References protocols::cluster::calibur::aa, and core::chemical::oneletter_code_from_aa().

Referenced by protocols::mean_field::GenMeanFieldMover::report_aa_matrix().

bool protocols::mean_field::AAMatrix::empty ( ) const
utility::vector1< Real > protocols::mean_field::AAMatrix::frob_distance ( AAMatrix const &  obj) const

calculates vector of frob distances between vectors of this AAMatrix and a second AAMatrix

number of elements is the number of positions + 1. last element is the frob dist between entire matrices

param [out] results - vector1 of Frobenius distances, calculated per-column and for the entire matrix.

Remarks
distance is calculated between corresponding columns, determined by pos() of the AAProbs in the columns
if there are no corresponding columns, returns empty vector1

References protocols::cluster::calibur::aa, protocols::mean_field::jagged_array< T, A >::assign(), empty(), protocols::simple_moves::bb_sampler::probability, and protocols::hybridization::val.

Referenced by protocols::mean_field::GenMeanFieldMover::report_dist().

void protocols::mean_field::AAMatrix::init ( protocols::mean_field::RotMatrix const &  rm,
protocols::mean_field::jagged_array< core::Real em,
core::Real  temp 
)
private

private method called by constructors to initialize the AAMatrix from a RotMatrix

private method used to initialize AAMatrix as jagged_array of AAProbs from RotMatrix

called by constructors

also builds curr_aa_ vector

Parameters
[in]RotMatrix- used to initialize AAMatrix by summing over probabilities of all rotamers for each amino acid for each position

References protocols::cluster::calibur::aa, curr_aa_, protocols::mean_field::RotMatrix::curr_rot(), protocols::mean_field::RotMatrix::is_designed(), protocols::mean_field::RotMatrix::n_designed(), core::chemical::num_canonical_aas, protocols::simple_moves::bb_sampler::probability, and rot().

Referenced by AAMatrix(), and build_aa_matrix().

void protocols::mean_field::AAMatrix::init ( std::istream &  aa_matrix_file)
private

private method called by constructors to initialize the AAMatrix from a transfac file

private method used to initialize AAMatrix as jagged_array of AAProbs from input transfac file

called by constructors

curr_aa_ vector left empty

Parameters
[in]aa_matrix_file- transfac file

References curr_aa_, core::chemical::num_canonical_aas, parse_aa_line(), parse_aa_matrix_line(), and core::pack::task::tokenize_line().

AAMatrix & protocols::mean_field::AAMatrix::operator= ( AAMatrix const &  object_to_copy)

Assignment operator.

References copy_data().

void protocols::mean_field::AAMatrix::parse_aa_line ( utility::vector1< std::string > const &  tokens,
utility::vector1< core::chemical::AA > &  aa_names 
)
private

parse header (AA codes) line of the AAMatrix

parses header (2nd line) of transfac file into list of aa_names

necessary to determine which probability is which AA for subsequent lines

References core::chemical::aa_from_oneletter_code().

Referenced by init().

utility::vector1< AAProb > protocols::mean_field::AAMatrix::parse_aa_matrix_line ( utility::vector1< std::string > const &  tokens,
utility::vector1< core::chemical::AA > const &  aa_names 
)
private

parse line of transfac file to add a vector of probabilities for one position to the AAMatrix

parses line of transfac i.e. 200 0.5 0.2 0.3...

pushes back appropriate vector into AAMatrix

References protocols::cluster::calibur::aa, protocols::pack_daemon::error_message, and core::chemical::num_canonical_aas.

Referenced by init().

void protocols::mean_field::AAMatrix::show ( std::ostream &  output = std::cout) const

Generate string representation of AAMatrix for debugging purposes.

prints representation of AAMatrix using show() function of AAProbs

in the outputted table, each column represents the probabilities of amino acids at that position

if current amino acids are set, outputs a vector of current amino acids and their probability

References curr_aa_prob(), and protocols::mean_field::jagged_array< T, A >::show().

Referenced by protocols::mean_field::operator<<(), protocols::mean_field::GenMeanFieldMover::read_aa_matrix(), and protocols::mean_field::GenMeanFieldMover::report_aa_matrix().

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  output,
AAMatrix const &  object_to_output 
)
friend

Insertion operator (overloaded so that AAMatrix can be "printed" in PyRosetta).

Member Data Documentation

utility::vector1< core::Size > protocols::mean_field::AAMatrix::curr_aa_
private

Referenced by copy_data(), curr_aa(), curr_aa_prob(), and init().


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