torsionTools
index


 
Tools for manipulating torsion angles

 
Classes
       
builtins.object
RotomericStats

 
class RotomericStats(builtins.object)
    RotomericStats(selection='all')
 

 
  Methods defined here:
RotomericStates(s, atomCoordList)
__init__(s, selection='all')
A class to analyze the rotomeric states of a given ensemble
-----dictionarie used in the class----------
torStatCnt  :dict of the form X[UID][State]=count
             where X[UID] is a dictionary
             and X[UID][State] another dictionary
RotAngleName:dict of the from X[UID]=angleName which is a List of tuple
             of the form [('CHI1',('N', 'CA', 'CB', 'OG')),
                          ('CHI2',('CA','CB', 'OG', 'HG'))]
torStateIndex:dict of the form X[UID][State]=Index which is a
              list of integers that stores the structure index
              value in the atomCoordinates List.
scTorsionAtoms: a dict of the form
               X['SER'] = [('CHI1',('N', 'CA', 'CB', 'OG')),
                           ('CHI2',('CA','CB', 'OG', 'HG'))]
binAngle(s, uid, resType, taName, val)
creates a dict named angleBins
angleBins[uid][torsionangleName] : contains the angle value 
         corresponding to the torsionangleName
binAngleState(s, index)
creates two dict:
   torStateCnt: dict of the form X[UID][State]=count
                where X[UID] is a dictionary
                and X[UID][State] another dictionary
   torStateIndx:dict of the form X[UID][State]=Index which is a
                list of integers that stores the structure index
                value in the atomCoordinates List.
binAngles(s, angleFilename=None)
Takes in a set of pdb filename and analyze the
rotomerics state of each pdb file. The result is
written in the file name [filename].angles
circularStat(self, angleList)
Given a list of angle values (in degrees) return tuple of 
(ave,dev,minVal,maxVal), which are angle values in degrees. The
values minVal and maxVal correspond to the minimum and maximum
values in the input list, which wrap at 180 degrees, and are 
only meaningful for angle values which are in a small range.
 
Added by Robin A Thottungal
Calculates the average of Circular Data(in this case angles)
Reference Book: Statistical analysis of circular data by
N. I. Fisher [ISBN:0521350182]
getAngles(s, resType, resid, segid)
Given a residue, the method returns the rotomerics state
definition for the residue.
getBin(s, resType, taname, val)
Given the residue type and torsion angle name, the method finds out
the states in which the torsion angle can exit and return the angle
that is closest to the val.
getBranch(s, theta1, theta2)
return the branch number n such that n*2*PI+theta1-theta2 is
minimal
linearAverage(s, angleList)
# linearAverage / linearDeviation does not give correct answer
# for circular data always. Use circularStat() instead..
linearDeviation(s, angleList)

Data descriptors defined here:
__dict__

 
dictionary for instance variables (if defined)
__weakref__

 
list of weak references to the object (if defined)

 
Functions
       
CStat(l)
Added by Robin A Thottungal
Calculates the average of Circular Data(in this case angles)
Reference Book: Statistical analysis of circular data by
                N. I. Fisher [ISBN:0521350182]
RotomericStates(atomCoordList)
atan(x, /)
Return the arc tangent (measured in radians) of x.
 
The result is between -pi/2 and pi/2.
average(l)
binAngle(uid, resType, taName, val)
binAngleState(index)
binAngles(filename)
cos(x, /)
Return the cosine of x (measured in radians).
deviation(l)
genXplorRestraint(name, residueNum, value=None, width=0, segmentName=None, checkAtoms=False, comment=None)
Generate one XPLOR torsion angle CDIH restraint, given its name,
a residue number, the value and width. A value of None specifies that
the value is read from the currently loaded structure, otherwise it is 
the corresponding torsion angle value in degrees. The segment name
may also optionally be specified.
 
Supported names are currently 'phi', 'psi' and 'omega. Capitalization is 
ignored. The omega angle corresponds to the peptide bond between residues
numbered residueNum and residueNum+1.
 
The return value is the restraint string, or an empy string, if one or more
of the specified atoms is missing. The checkAtoms argument can be used to 
treat the case of missing atoms- if is set to 
True, an exception will be thrown in the case of missing atoms, while 
setting this parameter to "NoException" will simply return an empty string.
 
If the comment argument is specified, the specified string is written 
at the end of the last line of the restraint, preceeding by the string
' ! '.
getAngles(resType, resid, segid)
getBin(resType, taname, val)
getBranch(theta1, theta2)
return the branch number n such that n*2*PI+theta1-theta2 is
minimal
getIndex()
getRotomericStateNames()
getRotomericStates()
getangleBins()
getscTorsionAtoms(resname)
log(...)
log(x, [base=math.e])
Return the logarithm of x to the given base.
 
If the base not specified, returns the natural logarithm (base e) of x.
pow(x, y, /)
Return x**y (x to the power of y).
ramaNumber(phi, psi, sigma=100000)
Return the Ramachandran Number
 
The arguments phi and psi should be in units of degrees, and within the
the range -180..180 degrees.
 
sigma is a resolution parameter in inverse degrees.    
 
Reference:
 Ranjan V. Mannige, Joyjit Kundu, Stephen Whitelam, "The Ramachandran
Number: An Order Parameter for Protein Geometry,"
PLOS ONE | DOI:10.1371/journal.pone.0160023
setTorsions(angles=[], selection='all', ivm=None, verbose=False, simulation=0)
Set selected torsion angles to specified values.
 
angles is a list of one or more tuples of the form (sel, val), where val is
the desired dihedral value (in degrees) and sel is a four-membered tuple,
each member a selection string identifying one of the four atoms involved
in the torsion angle.  
 
The optional ivm argument specifies an ivm.IVM object referred to for
torsion angle definitions; if omitted, an ivm.IVM object is created to
allow all standard torsion angles.  One would create an IVM object
externally primarily for optimization purposes.
 
This function will set all torsion angles specified by the angles list that
are additionally included in the argument selection (a selection string).
 
The simulation argument can be used to specify a simulation.Simulation
other than the current one.
setTorsionsFromTable(table, verbose=False, selection='all')
Set dihedral angles to the nominal values specified by table.
 
The input table specifies the dihedral angles to be modified and the target
values (the function torsionTools.setTorsion() sets the new angles).
table contains XPLOR RESTraints DIHEdral statements of the type associated with the
CDIH term.
table can be:
   1) a string with such statements
   2) a string with the name of a file containing the statements
   3) a sequence with any combination of the above two
 
A sub-selection of atoms can be specified using the selection argument.
sin(x, /)
Return the sine of x (measured in radians).
sqrt(x, /)
Return the square root of x.

 
Data
        RotAngleName = {}
angleBins = {}
argv = ['/home/schwitrs/bzr-repo/xplor-python3/bin/xplor', 'xplorDoc', '-w', 'xplor', 'ivm', 'monteCarlo', 'trace', 'trajFile', 'selectLogic', 'selectTools', 'xplorInit', 'vmdInter', 'checkWrap', 'hybridMC', 'atomAction', 'potCosAngleRatio', 'rdcPotTools', 'simulationTools', 'shapePotTools', 'pck2xplor', ...]
binData = {'ASN_CHI2': (('0', 0), ('180', 180)), 'ASP_CHI2': (('0', 0), ('180', 180)), 'GLN_CHI3': (('0', 0), ('180', 180)), 'GLU_CHI3': (('0', 0), ('180', 180)), 'HIS_CHI2': (('+90', 90), ('-90', -90)), 'PHE_CHI2': (('+90', 90), ('-90', -90)), 'TRP_CHI2': (('+90', 90), ('-90', -90)), 'TYR_CHI2': (('+90', 90), ('-90', -90))}
pi = 3.141592653589793
scTorsionAtoms = {'ALA': [], 'ARG': [('CHI1', ('N', 'CA', 'CB', 'CG')), ('CHI2', ('CA', 'CB', 'CG', 'CD')), ('CHI3', ('CB', 'CG', 'CD', 'NE')), ('CHI4', ('CG', 'CD', 'NE', 'CZ'))], 'ASN': [('CHI1', ('N', 'CA', 'CB', 'CG')), ('CHI2', ('CA', 'CB', 'CG', 'OD1'))], 'ASP': [('CHI1', ('N', 'CA', 'CB', 'CG')), ('CHI2', ('CA', 'CB', 'CG', 'OD1'))], 'CYS': [('CHI1', ('N', 'CA', 'CB', 'SG'))], 'GLN': [('CHI1', ('N', 'CA', 'CB', 'CG')), ('CHI2', ('CA', 'CB', 'CG', 'CD')), ('CHI3', ('CB', 'CG', 'CD', 'OE1'))], 'GLU': [('CHI1', ('N', 'CA', 'CB', 'CG')), ('CHI2', ('CA', 'CB', 'CG', 'CD')), ('CHI3', ('CB', 'CG', 'CD', 'OE1'))], 'GLY': [], 'HIS': [('CHI1', ('N', 'CA', 'CB', 'CG')), ('CHI2', ('CA', 'CB', 'CG', 'ND1'))], 'ILE': [('CHI1', ('N', 'CA', 'CB', 'CG1')), ('CHI21', ('CA', 'CB', 'CG1', 'CD1'))], ...}
torStateCnt = {}
torStateIndx = {}