![]() |
Rosetta Utilities
2015.09
|
Classes | |
class | RmsData |
RmsData is a class intended to replace the global rms_obj namespace from rosetta++. Initial implementation is with a singleton design pattern to mimic a global namespace from rosetta++. More... | |
Functions | |
void | maxsub (int &nsup, FArray1A_double xe, FArray1A_double xp, double &rms, double &psi, int &nali, double &zscore, double &evalue, double &score, double rmstol, double distance_tolerance) |
identify the largest subset of CA atoms of a model that superimposes "well" (under certain rms cutoff) over the experimental structure More... | |
double | erfcc (double x) |
void | COMAS (FArray1A_double C, FArray1A_double WT, int NAT, double &XC, double &YC, double &ZC) |
void | COMAS (FArray1A< double > C, FArray1A< double > WT, int NAT, double &XC, double &YC, double &ZC) |
numeric::Real | calc_rms (utility::vector1< xyzVector< Real > > p1_coords, utility::vector1< xyzVector< Real > > p2_coords) |
numeric::Real | rms_wrapper_slow_and_correct (int natoms, FArray2D< numeric::Real > p1a, FArray2D< numeric::Real > p2a) |
bool | close_enough (numeric::Real val1, numeric::Real val2, numeric::Real TOL=1e-5) |
bool | is_identity_matrix (ObjexxFCL::FArray2D< numeric::Real > uu) |
numeric::Real | rms_wrapper (int natoms, FArray2D< numeric::Real > p1a, FArray2D< numeric::Real > p2a) |
void | calc_rms_fast (float &rms_out, FArray2A< numeric::Real > xx, FArray2A< numeric::Real > yy, FArray1A< numeric::Real > ww, int npoints, numeric::Real ctx) |
companion function for findUU ( it is optional ) computes the minimum RMS deviation beteen XX and YY as though it rotated the arrays, without actually rotating them. More... | |
void | findUU (FArray2< numeric::Real > &XX, FArray2< numeric::Real > &YY, FArray1< numeric::Real > const &WW, int Npoints, FArray2< numeric::Real > &UU, numeric::Real &sigma3) |
intended to rotate one protein xyz array onto another one such that the point-by-point rms is minimized. More... | |
void | findUU (utility::vector1< numeric::xyzVector< numeric::Real > > &XX, utility::vector1< numeric::xyzVector< numeric::Real > > &YY, utility::vector1< numeric::Real > const &WW, int Npoints, numeric::xyzMatrix< numeric::Real > &UU, numeric::Real &sigma3) |
This is a helper function for using the above implementation of findUU. There is some cost to the conversion but everything else is probably slower and also you don't have to use FArrays everywhere. More... | |
void | BlankMatrixMult (FArray2A< numeric::Real > A, int n, int np, int transposeA, FArray2A< numeric::Real > B, int m, int transposeB, FArray2A< numeric::Real > AxB_out) |
void | MatrixMult (FArray2A< numeric::Real > A, int n, int np, int transposeA, FArray2A< numeric::Real > B, int m, int transposeB, FArray2A< numeric::Real > AxB_out) |
void | fixEigenvector (FArray2A< numeric::Real > m_v) |
void | rmsfitca2 (int npoints, ObjexxFCL::FArray2A< double > xx, ObjexxFCL::FArray2A< double > yy, ObjexxFCL::FArray1A< double > ww, int natsel, double &esq) |
computes the rms between two weighted point vectors. More... | |
void | rmsfitca3 (int npoints, ObjexxFCL::FArray2A< double > xx0, ObjexxFCL::FArray2A< double > xx, ObjexxFCL::FArray2A< double > yy0, ObjexxFCL::FArray2A< double > yy, double &esq) |
double | det3 (FArray2A< double > m) |
void | rsym_eigenval (ObjexxFCL::FArray2A< double > m, ObjexxFCL::FArray1A< double > ev) |
computes the eigen values of a real symmetric 3x3 matrix More... | |
void | rsym_rotation (ObjexxFCL::FArray2A< double > mm, ObjexxFCL::FArray2A< double > m, ObjexxFCL::FArray1A< double > ev, ObjexxFCL::FArray2A< double > rot) |
finds a (proper) rotation matrix that minimizes the rms. More... | |
void | rsym_evector (ObjexxFCL::FArray2A< double > m, ObjexxFCL::FArray1A< double > ev, ObjexxFCL::FArray2A< double > mvec) |
Author: charlie strauss (cems) 2001 given original matrix plus its eigen values compute the eigen vectors. USAGE notice: for computing min rms rotations be sure to call this with the lowest eigen value in Ev(3). More... | |
numeric::Real | rms_wrapper (int natoms, ObjexxFCL::FArray2D< numeric::Real > p1a, ObjexxFCL::FArray2D< numeric::Real > p2a) |
numeric::Real | rms_wrapper_slow_and_correct (int natoms, ObjexxFCL::FArray2D< numeric::Real > p1a, ObjexxFCL::FArray2D< numeric::Real > p2a) |
void | BlankMatrixMult (ObjexxFCL::FArray2A< numeric::Real > A, int n, int np, int transposeA, ObjexxFCL::FArray2A< numeric::Real > B, int m, int transposeB, ObjexxFCL::FArray2A< numeric::Real > AxB_out) |
void | MatrixMult (ObjexxFCL::FArray2A< numeric::Real > A, int n, int np, int transposeA, ObjexxFCL::FArray2A< numeric::Real > B, int m, int transposeB, ObjexxFCL::FArray2A< numeric::Real > AxB_out) |
void | fixEigenvector (ObjexxFCL::FArray2A< numeric::Real > m_v) |
void | calc_rms_fast (float &rms_out, ObjexxFCL::FArray2A< numeric::Real > xx, ObjexxFCL::FArray2A< numeric::Real > yy, ObjexxFCL::FArray1A< numeric::Real > ww, int npoints, numeric::Real ctx) |
void | findUU (ObjexxFCL::FArray2< numeric::Real > &XX, ObjexxFCL::FArray2< numeric::Real > &YY, ObjexxFCL::FArray1< numeric::Real > const &WW, int Npoints, ObjexxFCL::FArray2< numeric::Real > &UU, numeric::Real &sigma3) |
double | det3 (ObjexxFCL::FArray2A< double > m) |
determinant of a 3x3 matrix More... | |
void numeric::model_quality::BlankMatrixMult | ( | ObjexxFCL::FArray2A< numeric::Real > | A, |
int | n, | ||
int | np, | ||
int | transposeA, | ||
ObjexxFCL::FArray2A< numeric::Real > | B, | ||
int | m, | ||
int | transposeB, | ||
ObjexxFCL::FArray2A< numeric::Real > | AxB_out | ||
) |
void numeric::model_quality::BlankMatrixMult | ( | FArray2A< numeric::Real > | A, |
int | n, | ||
int | np, | ||
int | transposeA, | ||
FArray2A< numeric::Real > | B, | ||
int | m, | ||
int | transposeB, | ||
FArray2A< numeric::Real > | AxB_out | ||
) |
BlankMatrixMult
A | - [in/out]? - |
n | - [in/out]? - |
np | - [in/out]? - |
transposeA | - [in/out]? - |
B | - [in/out]? - |
m | - [in/out]? - |
transposeB | - [in/out]? - |
AxB_out | - [in/out]? - |
References MatrixMult().
Referenced by findUU().
numeric::Real numeric::model_quality::calc_rms | ( | utility::vector1< xyzVector< Real > > | p1_coords, |
utility::vector1< xyzVector< Real > > | p2_coords | ||
) |
References rms_wrapper().
void numeric::model_quality::calc_rms_fast | ( | float & | rms_out, |
ObjexxFCL::FArray2A< numeric::Real > | xx, | ||
ObjexxFCL::FArray2A< numeric::Real > | yy, | ||
ObjexxFCL::FArray1A< numeric::Real > | ww, | ||
int | npoints, | ||
numeric::Real | ctx | ||
) |
void numeric::model_quality::calc_rms_fast | ( | float & | rms_out, |
FArray2A< numeric::Real > | xx, | ||
FArray2A< numeric::Real > | yy, | ||
FArray1A< numeric::Real > | ww, | ||
int | npoints, | ||
numeric::Real | ctx | ||
) |
companion function for findUU ( it is optional ) computes the minimum RMS deviation beteen XX and YY as though it rotated the arrays, without actually rotating them.
calc_rms_fast
rms_out | [in/out]? - the real-valued output value of the rms deviation |
XX | - [in/out]? - first set of points representing xyz coordinates |
YY | - [in/out]? - second set of points representing xyz coordinates |
WW | - [in/out]? - relative weight for each point |
npoints | - [in/out]? - number of points |
ctx | - [in/out]? - magic number computed during find UU that is needed for this calculation |
Referenced by rms_wrapper().
bool numeric::model_quality::close_enough | ( | numeric::Real | val1, |
numeric::Real | val2, | ||
numeric::Real | TOL = 1e-5 |
||
) |
Referenced by is_identity_matrix().
void numeric::model_quality::COMAS | ( | FArray1A< double > | C, |
FArray1A< double > | WT, | ||
int | NAT, | ||
double & | XC, | ||
double & | YC, | ||
double & | ZC | ||
) |
COMAS
C | - [in/out]? - |
WT | - [in/out]? - |
NAT | - [in/out]? - |
XC | - [in/out]? - |
YC | - [in/out]? - |
ZC | - [in/out]? - |
void numeric::model_quality::COMAS | ( | FArray1A_double | C, |
FArray1A_double | WT, | ||
int | NAT, | ||
double & | XC, | ||
double & | YC, | ||
double & | ZC | ||
) |
COMAS
C | - [in/out]? - |
WT | - [in/out]? - |
NAT | - [in/out]? - |
XC | - [in/out]? - |
YC | - [in/out]? - |
ZC | - [in/out]? - |
References C.
Referenced by rmsfitca2().
determinant of a 3x3 matrix
det3
m | - [in/out]? - |
Referenced by rmsfitca2(), and rmsfitca3().
erfcc
x | - [in/out]? - |
References numeric::crick_equations::z().
Referenced by maxsub().
void numeric::model_quality::findUU | ( | ObjexxFCL::FArray2< numeric::Real > & | XX, |
ObjexxFCL::FArray2< numeric::Real > & | YY, | ||
ObjexxFCL::FArray1< numeric::Real > const & | WW, | ||
int | Npoints, | ||
ObjexxFCL::FArray2< numeric::Real > & | UU, | ||
numeric::Real & | sigma3 | ||
) |
void numeric::model_quality::findUU | ( | FArray2< numeric::Real > & | XX, |
FArray2< numeric::Real > & | YY, | ||
FArray1< numeric::Real > const & | WW, | ||
int | Npoints, | ||
FArray2< numeric::Real > & | UU, | ||
numeric::Real & | sigma3 | ||
) |
intended to rotate one protein xyz array onto another one such that the point-by-point rms is minimized.
findUU
switched order of array subscripts so that can use logical array sizes XX and YY are lists of Npoints XYZ vectors (3xNpoint matrix) to be co-aligned these matrices are returned slightly modified: they are translated so their origins are at the center of mass (see Weights below ). WW is the weight or importance of each point (weighted RMS) vector of size Npoints The center of mass is figured including this variable. UU is a 3x3 symmetric orthonornal rotation matrix that will rotate YY onto XX such that the weighted RMS distance is minimized.
[in] | XX | - in - XX,YY are 2D arrays of x,y,z position of each atom |
[in] | YY | - in - |
[in] | WW | - in - a weight matrix for the points |
[in] | Npoints | - in - the number of XYZ points (need not be physical array size) |
[out] | UU | - out - 3x3 rotation matrix. |
[out] | sigma3 | - out - TO BE PASSED TO OPTIONAL FAST_RMS CALC ROUTINE. |
CAVEATS: 1) it is CRITICAL that the first physical dimension of XX and YY is 3
2) an iterative approx algorithm computes the diagonalization of a 3x3 matrix. if this program needs a speed up this could be made into an analytic but uggggly diagonalization function.
References BlankMatrixMult(), numeric::eigenvector_jacobi(), and fixEigenvector().
Referenced by findUU(), and rms_wrapper().
void numeric::model_quality::findUU | ( | utility::vector1< numeric::xyzVector< numeric::Real > > & | XX, |
utility::vector1< numeric::xyzVector< numeric::Real > > & | YY, | ||
utility::vector1< numeric::Real > const & | WW, | ||
int | Npoints, | ||
numeric::xyzMatrix< numeric::Real > & | UU, | ||
numeric::Real & | sigma3 | ||
) |
This is a helper function for using the above implementation of findUU. There is some cost to the conversion but everything else is probably slower and also you don't have to use FArrays everywhere.
References numeric::FArray_to_vector_of_xyzvectors(), numeric::FArray_to_xyzmatrix(), and findUU().
void numeric::model_quality::fixEigenvector | ( | ObjexxFCL::FArray2A< numeric::Real > | m_v | ) |
void numeric::model_quality::fixEigenvector | ( | FArray2A< numeric::Real > | m_v | ) |
fixEigenvector
m_v | - [in/out]? - |
References numeric::kinematic_closure::norm().
Referenced by findUU().
bool numeric::model_quality::is_identity_matrix | ( | ObjexxFCL::FArray2D< numeric::Real > | uu | ) |
References close_enough().
Referenced by rms_wrapper().
void numeric::model_quality::MatrixMult | ( | ObjexxFCL::FArray2A< numeric::Real > | A, |
int | n, | ||
int | np, | ||
int | transposeA, | ||
ObjexxFCL::FArray2A< numeric::Real > | B, | ||
int | m, | ||
int | transposeB, | ||
ObjexxFCL::FArray2A< numeric::Real > | AxB_out | ||
) |
void numeric::model_quality::MatrixMult | ( | FArray2A< numeric::Real > | A, |
int | n, | ||
int | np, | ||
int | transposeA, | ||
FArray2A< numeric::Real > | B, | ||
int | m, | ||
int | transposeB, | ||
FArray2A< numeric::Real > | AxB_out | ||
) |
MatrixMult
A | - [in/out]? - |
n | - [in/out]? - |
np | - [in/out]? - |
transposeA | - [in/out]? - |
B | - [in/out]? - |
m | - [in/out]? - |
transposeB | - [in/out]? - |
AxB_out | - [in/out]? - |
this function does SUMS to the old value of AxB_out... you might want to call BlankMatrixMult instead (see above) 4/30/01 jjg
this function works on numeric::Real values float version below. jjg
Referenced by BlankMatrixMult().
void numeric::model_quality::maxsub | ( | int & | nsup, |
FArray1A_double | xe, | ||
FArray1A_double | xp, | ||
double & | rms, | ||
double & | psi, | ||
int & | nali, | ||
double & | zscore, | ||
double & | evalue, | ||
double & | score, | ||
double | rmstol, | ||
double | distance_tolerance | ||
) |
identify the largest subset of CA atoms of a model that superimposes "well" (under certain rms cutoff) over the experimental structure
maxsub_native
x | - [in/out]? - |
nali | - [in/out]? - |
rms | - [in/out]? - |
logeval | - [in/out]? - |
this function was adapted and improved by cem strauss from an original template provided by angel ortiz. Here applies a modification of Dani Fischer's heuristic algorithm for finding the largest subset of residues for superimposition within a threshold. The part that restraints the secondary structure matching needs to be changed. At this point, the algorithm works as follows: first, the residue assignment is done on the basis of the global secondary structure similarity. Then, with this assignment for residue pairs, the heuristic procedure of Fisher is used. A seed segment of 7 CA atoms was first superimposed onto the reference structure, then the neighbor radius is gradually increased (up to "distance_tolerance"):to include more CA atoms within the range "t" to do a new superimposition, if the aligned rms is below the rms cutoff "rmstol" the new alignment is accepted. This proceduare is repeated for every 7-residue seed segment along the sequence until the largest subset of atoms which can yield an aligned rms below is found."nsup" is the total number of CA atoms in the model, xe and xp are coordinates of native and model respectively. "rms" is the final aligned rms based on the identified subset of atoms, "nali" is the number of aligned atoms in the subset and "psi" is the ratio of nali/nsup; The rest scores are metrics for quality of the alignment. Note that if no suitable alignment can be found given the input rms cutoff, the rms of overall structure alignment is returned and "nali" is set to zero. -- chu 2009/10
nsup | - [in/out]? - |
xe | - [in/out]? - |
xp | - [in/out]? - |
rms | - [in/out]? - |
psi | - [in/out]? - |
nali | - [in/out]? - |
zscore | - [in/out]? - |
evalue | - [in/out]? - |
score | - [in/out]? - |
References numeric::model_quality::RmsData::add_rms(), numeric::model_quality::RmsData::clear_rms(), erfcc(), numeric::model_quality::RmsData::instance(), rmsfitca2(), rmsfitca3(), and numeric::square().
numeric::Real numeric::model_quality::rms_wrapper | ( | int | natoms, |
ObjexxFCL::FArray2D< numeric::Real > | p1a, | ||
ObjexxFCL::FArray2D< numeric::Real > | p2a | ||
) |
numeric::Real numeric::model_quality::rms_wrapper | ( | int | natoms, |
FArray2D< numeric::Real > | p1a, | ||
FArray2D< numeric::Real > | p2a | ||
) |
References calc_rms_fast(), findUU(), and is_identity_matrix().
Referenced by calc_rms().
numeric::Real numeric::model_quality::rms_wrapper_slow_and_correct | ( | int | natoms, |
ObjexxFCL::FArray2D< numeric::Real > | p1a, | ||
ObjexxFCL::FArray2D< numeric::Real > | p2a | ||
) |
numeric::Real numeric::model_quality::rms_wrapper_slow_and_correct | ( | int | natoms, |
FArray2D< numeric::Real > | p1a, | ||
FArray2D< numeric::Real > | p2a | ||
) |
References rmsfitca2().
void numeric::model_quality::rmsfitca2 | ( | int | npoints, |
ObjexxFCL::FArray2A< double > | xx, | ||
ObjexxFCL::FArray2A< double > | yy, | ||
ObjexxFCL::FArray1A< double > | ww, | ||
int | natsel, | ||
double & | esq | ||
) |
computes the rms between two weighted point vectors.
rmsfitca2
most of this is double for good reasons. first there are some large differences of small numbers. and second the rsymm_eignen() function can internally have numbers larger than the largest double number. (you could do some fancy foot work to rescale things if you really had a problem with this.)
npoints | - [in/out]? - |
xx | - [in/out]? - |
yy | - [in/out]? - |
ww | - [in/out]? - |
natsel | - [in/out]? - |
esq | - [in/out]? - |
References COMAS(), det3(), rsym_eigenval(), rsym_rotation(), and numeric::sign_transfered().
Referenced by maxsub(), and rms_wrapper_slow_and_correct().
void numeric::model_quality::rmsfitca3 | ( | int | npoints, |
ObjexxFCL::FArray2A< double > | xx0, | ||
ObjexxFCL::FArray2A< double > | xx, | ||
ObjexxFCL::FArray2A< double > | yy0, | ||
ObjexxFCL::FArray2A< double > | yy, | ||
double & | esq | ||
) |
rmsfitca3
most of this is double for good reasons. first there are some large differences of small numbers. second the rsymm_eignen() function can internally have numbers larger than the largest double number. (you could do some fancy foot work to rescale m_moment if you really had a problem with this.)
npoints | - [in/out]? - |
xx0 | - [in/out]? - |
xx | - [in/out]? - |
yy0 | - [in/out]? - |
yy | - [in/out]? - |
esq | - [in/out]? - |
References numeric::model_quality::RmsData::count(), det3(), numeric::model_quality::RmsData::instance(), rsym_eigenval(), rsym_rotation(), numeric::sign_transfered(), numeric::model_quality::RmsData::xm(), numeric::model_quality::RmsData::xre(), numeric::model_quality::RmsData::xrp(), numeric::model_quality::RmsData::xse(), and numeric::model_quality::RmsData::xsp().
Referenced by maxsub().
void numeric::model_quality::rsym_eigenval | ( | ObjexxFCL::FArray2A< double > | m, |
ObjexxFCL::FArray1A< double > | ev | ||
) |
computes the eigen values of a real symmetric 3x3 matrix
rsym_eigenval
m | - [in/out]? - |
ev | - [in/out]? - |
References max(), and numeric::kinematic_closure::norm().
Referenced by rmsfitca2(), and rmsfitca3().
void numeric::model_quality::rsym_evector | ( | ObjexxFCL::FArray2A< double > | m, |
ObjexxFCL::FArray1A< double > | ev, | ||
ObjexxFCL::FArray2A< double > | mvec | ||
) |
Author: charlie strauss (cems) 2001 given original matrix plus its eigen values compute the eigen vectors. USAGE notice: for computing min rms rotations be sure to call this with the lowest eigen value in Ev(3).
rsym_evector
The minimal factorization of the eigenvector problem I have derived below has a puzzling or, rather, interesting assymetry. Namely, it doesn't matter what either ZZ=M(3,3) is or what Ev(3) is! One reason for this is that of course all we need to know is contained in the M matrix in the firstplace, so the eigen values overdetermine the problem We are just exploiting the redundant info in the eigen values to hasten the solution. What I dont know is if infact there exists any symmetic form using the eigen values.
we deliberately introduce another assymetry for numerical stability, and to force proper rotations (since eigen vectors are not unique within a sign change). first, we explicitly numerically norm the vectors to 1 rather than assuming the algebra will do it with enough accuracy. ( and its faster to boot!) second, we explicitly compute the third vector as being the cross product of the previous two rather than using the M matrix and third eigen value. If you arrange the eigen values so that the third eigen value is the lowest then this guarantees a stable result under the case of either very small eigen value or degenerate eigen values. this norm, and ignoring the third eigen value also gaurentee us the even if the eigen vectors are not perfectly accurate that, at least, the matrix that results is a pure orthonormal rotation matrix, which for most applications is the most important form of accuracy.
m | - [in/out]? - |
ev | - [in/out]? - |
mvec | - [in/out]? - |
References utility::io::oc::cerr.
Referenced by rsym_rotation().
void numeric::model_quality::rsym_rotation | ( | ObjexxFCL::FArray2A< double > | mm, |
ObjexxFCL::FArray2A< double > | m, | ||
ObjexxFCL::FArray1A< double > | ev, | ||
ObjexxFCL::FArray2A< double > | rot | ||
) |
finds a (proper) rotation matrix that minimizes the rms.
rsym_rotation
for best results the third eigen value should be the smallest eigen value!
mm | - [in/out]? - |
m | - [in/out]? - |
ev | - [in/out]? - |
rot | - [in/out]? - |
References numeric::kinematic_closure::norm(), and rsym_evector().
Referenced by rmsfitca2(), and rmsfitca3().