public class Calc extends Object
Currently the coordinates of an Atom are stored as an array of size 3
(double[3]). It would be more powerful to use Point3d from javax.vecmath.
Overloaded methods for Point3d operations exist in the CalcPoint
Class.
Constructor and Description |
---|
Calc() |
Modifier and Type | Method and Description |
---|---|
static Atom |
add(Atom a,
Atom b)
add two atoms ( a + b).
|
static double |
amount(Atom a)
Gets the length of the vector (2-norm)
|
static double |
angle(Atom a,
Atom b)
Gets the angle between two vectors
|
static javax.vecmath.Point3d[] |
atomsToPoints(Atom[] atoms)
Convert an array of atoms into an array of vecmath points
|
static List<javax.vecmath.Point3d> |
atomsToPoints(Collection<Atom> atoms)
Convert an array of atoms into an array of vecmath points
|
static double |
calcRotationAngleInDegrees(Atom centerPt,
Atom targetPt)
Calculates the angle from centerPt to targetPt in degrees.
|
static Atom[] |
centerAtoms(Atom[] atomSet)
Center the atoms at the Centroid.
|
static Atom[] |
centerAtoms(Atom[] atomSet,
Atom centroid)
Center the atoms at the Centroid, if the centroid is already know.
|
static Atom |
centerOfMass(Atom[] points)
Returns the center of mass of the set of atoms.
|
static Atom |
createVirtualCBAtom(AminoAcid amino)
creates a virtual C-beta atom. this might be needed when working with GLY
thanks to Peter Lackner for a python template of this method.
|
static Atom |
getCenterVector(Atom[] atomSet)
Returns the Vector that needs to be applied to shift a set of atoms to
the Centroid.
|
static Atom |
getCenterVector(Atom[] atomSet,
Atom centroid)
Returns the Vector that needs to be applied to shift a set of atoms to
the Centroid, if the centroid is already known
|
static Atom |
getCentroid(Atom[] atomSet)
Returns the centroid of the set of atoms.
|
static double |
getDistance(Atom a,
Atom b)
calculate distance between two atoms.
|
static double |
getDistanceFast(Atom a,
Atom b)
Will calculate the square of distances between two atoms.
|
static double |
getPhi(AminoAcid a,
AminoAcid b)
Calculate the phi angle.
|
static double |
getPsi(AminoAcid a,
AminoAcid b)
Calculate the psi angle.
|
static double |
getTMScore(Atom[] atomSet1,
Atom[] atomSet2,
int len1,
int len2)
Calculate the TM-Score for the superposition.
|
static double |
getTMScore(Atom[] atomSet1,
Atom[] atomSet2,
int len1,
int len2,
boolean normalizeMin)
Calculate the TM-Score for the superposition.
|
static javax.vecmath.Matrix4d |
getTransformation(Matrix rot,
Atom trans)
Convert JAMA rotation and translation to a Vecmath transformation matrix.
|
static Atom |
getTranslationVector(javax.vecmath.Matrix4d transform)
Extract the translational vector as an Atom of a transformation matrix.
|
static double[] |
getXYZEuler(Matrix m)
Convert a rotation Matrix to Euler angles.
|
static double[] |
getZYZEuler(Matrix m)
Gets euler angles for a matrix given in ZYZ convention.
|
static Atom |
invert(Atom a) |
static boolean |
isConnected(AminoAcid a,
AminoAcid b)
Test if two amino acids are connected, i.e. if the distance from C to N <
2.5 Angstrom.
|
static void |
main(String[] args) |
static Matrix |
matrixFromEuler(double heading,
double attitude,
double bank)
This conversion uses NASA standard aeroplane conventions as described on
page:
http://www.euclideanspace.com/maths/geometry/rotations/euler/index.htm
Coordinate System: right hand Positive angle: right hand Order of euler
angles: heading first, then attitude, then bank. matrix row column
ordering: [m00 m01 m02] [m10 m11 m12] [m20 m21 m22]
|
static void |
plus(Structure s,
Matrix matrix)
calculate structure + Matrix coodinates ...
|
static double |
rmsd(Atom[] x,
Atom[] y)
Calculate the RMSD of two Atom arrays, already superposed.
|
static void |
rotate(Atom[] ca,
Matrix matrix) |
static void |
rotate(Atom atom,
double[][] m)
Rotate a single Atom aroud a rotation matrix.
|
static void |
rotate(Atom atom,
Matrix m)
Rotate an Atom around a Matrix object.
|
static void |
rotate(Group group,
double[][] rotationmatrix)
Rotate a Group.
|
static void |
rotate(Group group,
Matrix m)
Rotate a group object.
|
static void |
rotate(Structure structure,
double[][] rotationmatrix)
Rotate a structure.
|
static void |
rotate(Structure structure,
Matrix m)
Rotate a structure object.
|
static double |
scalarProduct(Atom a,
Atom b)
Scalar product (dot product).
|
static Atom |
scale(Atom a,
double s)
Multiply elements of a by s
|
static Atom |
scaleAdd(double s,
Atom x,
Atom b)
Perform linear transformation s*X+B, and store the result in b
|
static Atom |
scaleEquals(Atom a,
double s)
Multiply elements of a by s (in place)
|
static void |
shift(Atom[] ca,
Atom b)
Shift an array of atoms at once.
|
static void |
shift(Atom a,
Atom b)
Shift a vector.
|
static void |
shift(Group group,
Atom a)
Shift a Group with a vector.
|
static void |
shift(Structure structure,
Atom a)
shift a structure with a vector.
|
static Atom |
subtract(Atom a,
Atom b)
subtract two atoms ( a - b).
|
static double |
torsionAngle(Atom a,
Atom b,
Atom c,
Atom d)
Calculate the torsion angle, i.e. the angle between the normal vectors of
the two plains a-b-c and b-c-d.
|
static void |
transform(Atom[] ca,
javax.vecmath.Matrix4d t)
Transform an array of atoms at once.
|
static void |
transform(Atom atom,
javax.vecmath.Matrix4d m)
Transforms an atom object, given a Matrix4d (i.e. the vecmath library
double-precision 4x4 rotation+translation matrix).
|
static void |
transform(Chain chain,
javax.vecmath.Matrix4d m)
Transforms a chain object, given a Matrix4d (i.e. the vecmath library
double-precision 4x4 rotation+translation matrix).
|
static void |
transform(Group group,
javax.vecmath.Matrix4d m)
Transforms a group object, given a Matrix4d (i.e. the vecmath library
double-precision 4x4 rotation+translation matrix).
|
static void |
transform(Structure structure,
javax.vecmath.Matrix4d m)
Transforms a structure object, given a Matrix4d (i.e. the vecmath library
double-precision 4x4 rotation+translation matrix).
|
static void |
translate(Atom atom,
javax.vecmath.Vector3d v)
Translates an atom object, given a Vector3d (i.e. the vecmath library
double-precision 3-d vector)
|
static void |
translate(Chain chain,
javax.vecmath.Vector3d v)
Translates a chain object, given a Vector3d (i.e. the vecmath library
double-precision 3-d vector)
|
static void |
translate(Group group,
javax.vecmath.Vector3d v)
Translates a group object, given a Vector3d (i.e. the vecmath library
double-precision 3-d vector)
|
static void |
translate(Structure structure,
javax.vecmath.Vector3d v)
Translates a Structure object, given a Vector3d (i.e. the vecmath library
double-precision 3-d vector)
|
static Atom |
unitVector(Atom a)
Returns the unit vector of vector a .
|
static Atom |
vectorProduct(Atom a,
Atom b)
Vector product (cross product).
|
public Calc()
public static final double getDistance(Atom a, Atom b)
a
- an Atom objectb
- an Atom objectpublic static double getDistanceFast(Atom a, Atom b)
a
- an Atom objectb
- an Atom objectpublic static final Atom add(Atom a, Atom b)
a
- an Atom objectb
- an Atom objectpublic static final Atom subtract(Atom a, Atom b)
a
- an Atom objectb
- an Atom objectpublic static final Atom vectorProduct(Atom a, Atom b)
a
- an Atom objectb
- an Atom objectpublic static final double scalarProduct(Atom a, Atom b)
a
- an Atom objectb
- an Atom objectpublic static final double amount(Atom a)
a
- an Atom objectpublic static final double angle(Atom a, Atom b)
a
- an Atom objectb
- an Atom objectpublic static final Atom unitVector(Atom a)
a
- an Atom objectpublic static final double torsionAngle(Atom a, Atom b, Atom c, Atom d)
a
- an Atom objectb
- an Atom objectc
- an Atom objectd
- an Atom objectpublic static final double getPhi(AminoAcid a, AminoAcid b) throws StructureException
a
- an AminoAcid objectb
- an AminoAcid objectStructureException
- if aminoacids not connected or if any of the 4 needed atoms
missingpublic static final double getPsi(AminoAcid a, AminoAcid b) throws StructureException
a
- an AminoAcid objectb
- an AminoAcid objectStructureException
- if aminoacids not connected or if any of the 4 needed atoms
missingpublic static final boolean isConnected(AminoAcid a, AminoAcid b)
a
- an AminoAcid objectb
- an AminoAcid objectpublic static final void rotate(Atom atom, double[][] m)
atom
- atom to be rotatedm
- a rotation matrix represented as a double[3][3] arraypublic static final void rotate(Structure structure, double[][] rotationmatrix) throws StructureException
structure
- a Structure objectrotationmatrix
- an array (3x3) of double representing the rotation matrix.StructureException
- ...public static final void rotate(Group group, double[][] rotationmatrix) throws StructureException
group
- a group objectrotationmatrix
- an array (3x3) of double representing the rotation matrix.StructureException
- ...public static final void rotate(Atom atom, Matrix m)
atom
- atom to be rotatedm
- rotation matrix to be applied to the atompublic static final void rotate(Group group, Matrix m)
group
- a group to be rotatedm
- a Matrix object representing the rotation matrixpublic static final void rotate(Structure structure, Matrix m)
structure
- the structure to be rotatedm
- rotation matrix to be appliedpublic static void transform(Atom[] ca, javax.vecmath.Matrix4d t)
ca
- array of Atoms to shiftt
- transformation Matrix4dpublic static final void transform(Atom atom, javax.vecmath.Matrix4d m)
atom
- m
- public static final void transform(Group group, javax.vecmath.Matrix4d m)
group
- m
- public static final void transform(Structure structure, javax.vecmath.Matrix4d m)
structure
- m
- public static final void transform(Chain chain, javax.vecmath.Matrix4d m)
chain
- m
- public static final void translate(Atom atom, javax.vecmath.Vector3d v)
atom
- v
- public static final void translate(Group group, javax.vecmath.Vector3d v)
group
- v
- public static final void translate(Chain chain, javax.vecmath.Vector3d v)
chain
- v
- public static final void translate(Structure structure, javax.vecmath.Vector3d v)
structure
- v
- public static final void plus(Structure s, Matrix matrix)
s
- the structure to operate onmatrix
- a Matrix objectpublic static final void shift(Structure structure, Atom a)
structure
- a Structure objecta
- an Atom object representing a shift vectorpublic static final void shift(Atom a, Atom b)
a
- vector ab
- vector bpublic static final void shift(Group group, Atom a)
group
- a group objecta
- an Atom object representing a shift vectorpublic static final Atom getCentroid(Atom[] atomSet)
atomSet
- a set of Atomspublic static Atom centerOfMass(Atom[] points)
points
- a set of Atomspublic static Atom scaleEquals(Atom a, double s)
a
- s
- public static Atom scale(Atom a, double s)
a
- s
- public static Atom scaleAdd(double s, Atom x, Atom b)
s
- Amount to scale xx
- Input coordinateb
- Vector to translate (will be modified)public static final Atom getCenterVector(Atom[] atomSet)
atomSet
- array of Atomspublic static final Atom getCenterVector(Atom[] atomSet, Atom centroid)
atomSet
- array of Atomspublic static final Atom[] centerAtoms(Atom[] atomSet) throws StructureException
atomSet
- a set of AtomsStructureException
public static final Atom[] centerAtoms(Atom[] atomSet, Atom centroid) throws StructureException
atomSet
- a set of AtomsStructureException
public static final Atom createVirtualCBAtom(AminoAcid amino) throws StructureException
amino
- the amino acid for which a "virtual" CB atom should be
calculatedStructureException
public static final double[] getZYZEuler(Matrix m)
m
- the rotation matrixpublic static final double[] getXYZEuler(Matrix m)
m
- the rotation matrixpublic static final Matrix matrixFromEuler(double heading, double attitude, double bank)
heading
- in radiansattitude
- in radiansbank
- in radianspublic static double calcRotationAngleInDegrees(Atom centerPt, Atom targetPt)
centerPt
- Point we are rotating around.targetPt
- Point we want to calculate the angle to.public static void shift(Atom[] ca, Atom b)
ca
- array of Atoms to shiftb
- reference Atom vectorpublic static javax.vecmath.Matrix4d getTransformation(Matrix rot, Atom trans)
rot
- 3x3 Rotation matrixtrans
- 3x1 translation vector in Atom coordinatespublic static Atom getTranslationVector(javax.vecmath.Matrix4d transform)
transform
- Matrix4dpublic static javax.vecmath.Point3d[] atomsToPoints(Atom[] atoms)
atoms
- list of atomspublic static List<javax.vecmath.Point3d> atomsToPoints(Collection<Atom> atoms)
atoms
- list of atomspublic static double rmsd(Atom[] x, Atom[] y)
x
- array of Atoms superposed to yy
- array of Atoms superposed to xpublic static double getTMScore(Atom[] atomSet1, Atom[] atomSet2, int len1, int len2) throws StructureException
min\{len1,len2\}
).
Atom sets must be pre-rotated.
Citation:
Zhang Y and Skolnick J (2004). "Scoring function for automated
assessment of protein structure template quality". Proteins 57: 702 -
710.
atomSet1
- atom array 1atomSet2
- atom array 2len1
- The full length of the protein supplying atomSet1len2
- The full length of the protein supplying atomSet2StructureException
public static double getTMScore(Atom[] atomSet1, Atom[] atomSet2, int len1, int len2, boolean normalizeMin) throws StructureException
Citation:
Zhang Y and Skolnick J (2004). "Scoring function for automated
assessment of protein structure template quality". Proteins 57: 702 -
710.
atomSet1
- atom array 1atomSet2
- atom array 2len1
- The full length of the protein supplying atomSet1len2
- The full length of the protein supplying atomSet2normalizeMin
- Whether to normalize by the minimum-length structure,
that is, min\{len1,len2\}
. If false, normalized by the max\{len1,len2\}
).StructureException
Copyright © 2000–2019 BioJava. All rights reserved.