pcsTools
index


 
################################################################################
# Methods for dealing with PCS data
#
# These methods come from PyParaTools: http://comp-bio.anu.edu.au/mscook/PPT/

# This code was written by Mitchell Stanton-Cook while a PhD student
# in Dr Thomas Huber Lab. No warranty, support or guarantee of correctness 
# is provided. Bugs are likely.
#
# If you find this code useful please acknowledge me.

# DO NOT REMOVE THIS MESSAGE
#
# Mitchell Stanton-Cook (m.stantoncook@gmail.com)
################################################################################

 
Functions
       
EulerFromZYZRot(rotMat)
Return the 3 Euler angles (A, B, G) in ZYZ from a given rotation matrix.
PCS1M1S(p0, meas, x, y, z)
Optimize for the X-tensor given a single model
RotX90()
Returns the rotation matrix for a 90 degree rotation about X.
RotY90()
Returns the rotation matrix for a 90 degree rotation about Y.
RotZ90()
Returns the rotation matrix for a 90 degree rotation about Z.
ToUTR(Ax, Rh, a, b, g)
Reconfigure a X-tensor into Unique Tensor Rep
XTensorFit(init, meas, x, y, z, tol=1e-08)
Fit the X-tensor by non-linear leastsquares optimization
 
init = mx, my, mz, Ax, Rh, A, B, G
ZYZRot(A, B, G)
Returns a ZYZ rotation matrix when given 3 Euler angles (in degrees).
acos(x, /)
Return the arc cosine (measured in radians) of x.
 
The result is between 0 and pi.
asin(x, /)
Return the arc sine (measured in radians) of x.
 
The result is between -pi/2 and pi/2.
buildAxes(tp)
calcXTensor(vTensor, expts=0, coords=None, weights=None, maxDisplacement=15, tol=1e-08)
Calculate and return the deltachi-tensor using non-linear least-squares
optimization procedure.
 
As side effects, the varTensor.VarTensor and paramagnetic center are
set to the calculated values.
 
This routine requires that the first atom selection for each
restraint (excluding dummy pseudo atom restraints) be the
paramagnetic center.
 
This is a modified version of varTensorTools.calcTensor.
 
This function returns a list of :
 
   [x1, y1, z1, nAx, nRh, na, nb, ng]
 
where x1,y1,z1 are the position of the paramagnetic center, nAx and nRh
are the axial and rhombic components of the tensor and na, nb, and ng give
Euler angles (in degrees).
 
Optional arguments are:
  expts - a list of PCS terms to be used in the calculation. By default,
          all experiments associated with the vTensor argument are used.
  coords - an alternate set of ensemble coordinates. By default the 
           current coordinates are used. Note that this is a list of lists
           of atomic coordinates.
  weights - weights associated with the coordinate sets specified by
            the coords argument. By default, the weights are uniform.
  maxDisplacement - the maximum allowed displacement of the paramagnetic 
                    center. A larger displacement will cause the 
                    calculation to fail.
  tol             - tolerance associated with a converged fit.
 
author: Mitchell Jon Stanton-Cook (m.stantoncook@gmail.com)
correctAngle(cosv, sinv)
Return an angle in correct quadrant given a cosine and sine of the angle.
cos(x, /)
Return the cosine of x (measured in radians).
degrees(x, /)
Convert angle x from radians to degrees.
exit(status=None, /)
Exit the interpreter by raising SystemExit(status).
 
If the status is omitted or None, it defaults to zero (i.e., success).
If the status is an integer, it will be used as the system exit status.
If it is another kind of object, it will be printed and the system
exit status will be one (i.e., failure).
getTagResidSels(pcs)
Generate a list of atomSel.AtomSels for each unique tag residue. This
can be used to conveniently configure selection pairs for non-bonded
interactions.
 
Here it is assumed that the paramagnetic center(s) are specified by the
``a'' member(s) of each restraint's selPairs member.
 
This function returns a named tuple with sels and union members, with the
second argument the union of the list.
radians(x, /)
Convert angle x from degrees to radians.
sin(x, /)
Return the sine of x (measured in radians).
spaceSeparatedToRestraint(inString, paraSel, atomName='HN', residCol=0, pcsCol=1, errCol=None, defaultErr=0.1, segid=None)
Convert string restraint table (inString) consisting of columns
for resid and pcs values to an Xplor-NIH readable restraint
table. Column numbers start with 0.  paraSel is an atom selection
specifying the paramagnetic center.

 
Data
        pi = 3.141592653589793