/** * Calculate the RMSD of two Atom arrays, already superposed. * * @param x * array of Atoms superposed to y * @param y * array of Atoms superposed to x * @return RMSD */ public static double rmsd(Atom[] x, Atom[] y) { return CalcPoint.rmsd(atomsToPoints(x), atomsToPoints(y)); }
private static final double getRmsd(Atom[] ca1, Atom[] ca2, int fragLen, int p1, int p2, Matrix m, Atom t) throws StructureException { double rmsd = 99.9; Atom[] catmp1 = getFragment(ca1, p1, fragLen,false); Atom[] catmp2 = getFragment(ca2, p2, fragLen,false); if ( catmp1 == null) { System.err.println("could not get fragment for ca1 " + p1 + " " + fragLen ); return rmsd; } if ( catmp2 == null) { System.err.println("could not get fragment for ca2 " + p2 + " " + fragLen ); return rmsd; } return SuperPositions.getRmsd(Calc.atomsToPoints(catmp1), Calc.atomsToPoints(catmp2)); }
public static Matrix getRotMax(AFPChain afpChain,Atom[] ca1,Atom[] ca2) throws StructureException{ Atom[] a1 = getAlignedAtoms1(afpChain,ca1); Atom[] a2 = getAlignedAtoms2(afpChain,ca2); Matrix4d trans = SuperPositions.superpose(Calc.atomsToPoints(a1), Calc.atomsToPoints(a2)); return Matrices.getRotationJAMA(trans); }
public static Atom getTranslation(AFPChain afpChain,Atom[] ca1,Atom[] ca2) throws StructureException{ Atom[] a1 = getAlignedAtoms1(afpChain,ca1); Atom[] a2 = getAlignedAtoms2(afpChain,ca2); Matrix4d trans = SuperPositions.superpose(Calc.atomsToPoints(a1), Calc.atomsToPoints(a2)); return Calc.getTranslationVector(trans); }
/** * Adds the i and j atoms and fills the grid, passing their bounds (array of size 6 with x,y,z minima and x,y,z maxima) * This way the bounds don't need to be recomputed. * Subsequent call to {@link #getIndicesContacts()} or {@link #getAtomContacts()} will produce the interatomic contacts. * @param iAtoms * @param icoordbounds * @param jAtoms * @param jcoordbounds */ public void addAtoms(Atom[] iAtoms, BoundingBox icoordbounds, Atom[] jAtoms, BoundingBox jcoordbounds) { this.iAtoms = Calc.atomsToPoints(iAtoms); this.iAtomObjects = iAtoms; if (icoordbounds!=null) { this.ibounds = icoordbounds; } else { this.ibounds = new BoundingBox(this.iAtoms); } this.jAtoms = Calc.atomsToPoints(jAtoms); this.jAtomObjects = jAtoms; if (jAtoms==iAtoms) { this.jbounds=ibounds; } else { if (jcoordbounds!=null) { this.jbounds = jcoordbounds; } else { this.jbounds = new BoundingBox(this.jAtoms); } } fillGrid(); }
/** * Adds a set of atoms, subsequent call to {@link #getIndicesContacts()} or {@link #getAtomContacts()} will produce the interatomic contacts. * The bounds calculated elsewhere can be passed, or if null they are computed. * @param atoms * @param bounds */ public void addAtoms(Atom[] atoms, BoundingBox bounds) { this.iAtoms = Calc.atomsToPoints(atoms); this.iAtomObjects = atoms; if (bounds!=null) { this.ibounds = bounds; } else { this.ibounds = new BoundingBox(iAtoms); } this.jAtoms = null; this.jAtomObjects = null; this.jbounds = null; fillGrid(); }
/** * Returns the transformation matrix corresponding to the alignment of * subunit matchings. * <p> * Utility method to cumulative calculate the alignment transformation. * * @param clusters * List of SubunitClusters * @param clusterSubunitMap * map from cluster id to subunit matching * @return transformation matrix * @throws StructureException */ private static Matrix4d getTransformForClusterSubunitMap( List<SubunitCluster> clusters, Map<Integer, Map<Integer, Integer>> clusterSubunitMap) throws StructureException { Pair<Atom[]> pair = getAlignedAtomsForClusterSubunitMap(clusters, clusterSubunitMap); return SuperPositions.superpose(Calc.atomsToPoints(pair.getFirst()), Calc.atomsToPoints(pair.getSecond())); } }
Matrix4d trans = SuperPositions.superpose(Calc.atomsToPoints(catmp1), Calc.atomsToPoints(catmp2));
clusters.stream(). flatMap(c -> c.getSubunits().stream()). map(r -> Calc.atomsToPoints(r.getRepresentativeAtoms())). collect(Collectors.toList());
/** * Constructs a new AsaCalculator. Subsequently call {@link #calculateAsas()} * or {@link #getGroupAsas()} to calculate the ASAs. * @param atoms an array of atoms not containing Hydrogen atoms * @param probe the probe size * @param nSpherePoints the number of points to be used in generating the spherical * dot-density, the more points the more accurate (and slower) calculation * @param nThreads the number of parallel threads to use for the calculation * @throws IllegalArgumentException if any atom in the array is a Hydrogen atom */ public AsaCalculator(Atom[] atoms, double probe, int nSpherePoints, int nThreads) { this.atoms = atoms; this.atomCoords = Calc.atomsToPoints(atoms); this.probe = probe; this.nThreads = nThreads; this.useSpatialHashingForNeighbors = DEFAULT_USE_SPATIAL_HASHING; for (Atom atom:atoms) { if (atom.getElement()==Element.H) throw new IllegalArgumentException("Can't calculate ASA for an array that contains Hydrogen atoms "); } // initialising the radii by looking them up through AtomRadii radii = new double[atoms.length]; for (int i=0;i<atoms.length;i++) { radii[i] = getRadius(atoms[i]); } initSpherePoints(nSpherePoints); }
/** * Return the rmsd of the CAs between the input pro and this protein, at * given positions. quite similar to transPdb but while that one transforms * the whole ca2, this one only works on the res1 and res2 positions. * * Modifies the coordinates in the second set of Atoms (pro). * * @return rmsd of CAs */ private static double calCaRmsd(Atom[] ca1, Atom[] pro, int resn, int[] res1, int[] res2) throws StructureException { Atom[] cod1 = getAtoms(ca1, res1, resn, false); Atom[] cod2 = getAtoms(pro, res2, resn, false); if (cod1.length == 0 || cod2.length == 0) { logger.info("length of atoms == 0!"); return 99; } Matrix4d transform = SuperPositions.superpose(Calc.atomsToPoints(cod1), Calc.atomsToPoints(cod2)); for (Atom a : cod2) Calc.transform(a.getGroup(), transform); return Calc.rmsd(cod1, cod2); }
Matrix4d trans = SuperPositions.superpose(Calc.atomsToPoints(tmp1), Calc.atomsToPoints(tmp2));
/** * Constructs a new AsaCalculator. Subsequently call {@link #calculateAsas()} * or {@link #getGroupAsas()} to calculate the ASAs * Only non-Hydrogen atoms are considered in the calculation. * @param structure the structure, all non-H atoms will be used * @param probe the probe size * @param nSpherePoints the number of points to be used in generating the spherical * dot-density, the more points the more accurate (and slower) calculation * @param nThreads the number of parallel threads to use for the calculation * @param hetAtoms if true HET residues are considered, if false they aren't, equivalent to * NACCESS' -h option * @see StructureTools#getAllNonHAtomArray */ public AsaCalculator(Structure structure, double probe, int nSpherePoints, int nThreads, boolean hetAtoms) { this.atoms = StructureTools.getAllNonHAtomArray(structure, hetAtoms); this.atomCoords = Calc.atomsToPoints(atoms); this.probe = probe; this.nThreads = nThreads; this.useSpatialHashingForNeighbors = DEFAULT_USE_SPATIAL_HASHING; // initialising the radii by looking them up through AtomRadii radii = new double[atomCoords.length]; for (int i=0;i<atomCoords.length;i++) { radii[i] = getRadius(atoms[i]); } initSpherePoints(nSpherePoints); }
Matrix4d trans = SuperPositions.superpose(Calc.atomsToPoints(ca1subset), Calc.atomsToPoints(ca2subset)); this.currentRotMatrix = Matrices.getRotationJAMA(trans); this.currentTranMatrix = Calc.getTranslationVector(trans);
/** superimpose and get rmsd * * @param pro1 * @param pro2 * @param strLen Number of atoms from pro1 and pro2 to use * @param storeTransform Store rotation and shift matrices locally * @return RMSD * @throws StructureException */ public double calc_rmsd(Atom[] pro1, Atom[] pro2, int strLen, boolean storeTransform) throws StructureException { Atom[] cod1 = getAtoms(pro1, strLen,false); Atom[] cod2 = getAtoms(pro2, strLen,true); Matrix4d trans = SuperPositions.superpose(Calc.atomsToPoints(cod1), Calc.atomsToPoints(cod2)); Matrix matrix = Matrices.getRotationJAMA(trans); Atom shift = Calc.getTranslationVector(trans); if ( storeTransform) { r = matrix; t = shift; } for (Atom a : cod2) Calc.transform(a.getGroup(), trans); return Calc.rmsd(cod1, cod2); }
if( ! grid.hasAnyContact(Calc.atomsToPoints(groupAtoms))) { continue;
Atom[] cod2 = getAtoms(pro2, strLen,true); Matrix4d trans = SuperPositions.superpose(Calc.atomsToPoints(cod1), Calc.atomsToPoints(cod2));
Matrix4d transform = SuperPositions.superpose(Calc.atomsToPoints(cod1), Calc.atomsToPoints(cod2));
Matrix4d trans = SuperPositions.superpose(Calc.atomsToPoints(ca1aligned), Calc.atomsToPoints(ca2aligned));
Matrix4d transform = svd.superpose(Calc.atomsToPoints(arr1), Calc.atomsToPoints(arr2)); Matrix rotMatrix = Matrices.getRotationJAMA(transform); Atom tranMatrix = getTranslationVector(transform);