congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Calc.getDistance
Code IndexAdd Tabnine to your IDE (free)

How to use
getDistance
method
in
org.biojava.nbio.structure.Calc

Best Java code snippets using org.biojava.nbio.structure.Calc.getDistance (Showing top 20 results out of 315)

origin: biojava/biojava

/**
 *
 * @param atom1 the first {@link Atom} in structure.
 * @param atom2 the second {@link Atom} in structure.
 * @return the distance between the two atoms in Angstrom.
 */
public static double getAtomDistance(Atom atom1, Atom atom2) {
  double distance;
  distance = Calc.getDistance(atom1, atom2);
  return distance;
}
origin: biojava/biojava

/**
 * Gets the distance between the two atoms of this bond.
 * <p>
 * This distance is calculated by {@link Calc#getDistance(Atom, Atom)}, but
 * this method will suppress the empty threat of a
 * {@link StructureException} that method makes.
 *
 * @return the distance between the two atoms of this bond.
 */
@Override
public double getLength() {
  return Calc.getDistance(atomA, atomB);
}
origin: biojava/biojava

/**
 * Get distances along diagonal k from coordinate array coords.
 *
 * @param atoms set of atoms to be used
 * @param k number of diagonal to be used
 */
public static double[] getDiagonalAtK (Atom[] atoms,int k) {
  int l = atoms.length;
  double[] dk = new double[(l-k)];
  for ( int i = 0 ; i< (l-k); i++){
    double dist = Calc.getDistance(atoms[i],atoms[i+k]);
    dk[i] = dist;
  }
  return dk;
}
origin: biojava/biojava

private void calMatrix() throws StructureException
{
  int     i, j;
  double  dis;
  for(i = 0; i < pro1Len; i ++)   {
    for(j = 0; j < pro2Len; j ++)   {
      dis = Calc.getDistance(cod1[i],cod2[j]);
      if(dis < Dc) {
        sij[i][j] = Dc - dis;
      }
      else  {
        sij[i][j] = 0;
      }
    }
  }
}
origin: biojava/biojava

/**
 * filter 1 for AFP extration: the distance of end-to-end
 * @param p1b
 * @param p1e
 * @param p2b
 * @param p2e
 * @return
 */
private static final double getEnd2EndDistance(Atom[] ca1, Atom[] ca2, int p1b, int p1e, int p2b, int p2e)
{
  double min = 99;
    double dist1 = Calc.getDistance(ca1[p1b], ca1[p1e]);
    double dist2 = Calc.getDistance(ca2[p2b], ca2[p2e]);
    min = dist1 - dist2;
  return Math.abs(min);
}
origin: biojava/biojava

/**
 * Get the distance from a point to the axis of rotation
 * @param point
 * @return The distance to the axis, or NaN if the RotationAxis is purely translational
 */
public double getProjectedDistance(Atom point) {
  Atom projected = getProjectedPoint(point);
  if( projected == null) {
    // translation only
    return Double.NaN;
  }
  return Calc.getDistance(point, projected);
}
origin: biojava/biojava

/** this is probably useless
 *
 * @param ca1subset
 * @param ca2subset
 * @return a double
 * @throws StructureException
 */
private double getDensity(Atom[] ca1subset, Atom[] ca2subset ) throws StructureException{
  Atom centroid1 =  Calc.getCentroid(ca1subset);
  Atom centroid2 = Calc.getCentroid(ca2subset);
  // get Average distance to centroid ...
  double d1 = 0;
  double d2 = 0;
  for ( int i = 0 ; i < ca1subset.length;i++){
    double dd1 = Calc.getDistance(centroid1, ca1subset[i]);
    double dd2 = Calc.getDistance(centroid2, ca2subset[i]);
    d1 += dd1;
    d2 += dd2;
  }
  double avd1 = d1 / ca1subset.length;
  double avd2 = d2 / ca2subset.length;
  return Math.min(avd1,avd2);
}
origin: pcingola/SnpEff

/**
 * Minimum distance between all atoms in two amino acids
 */
double distanceMin(AminoAcid aa1, AminoAcid aa2) {
  double distMin = Double.POSITIVE_INFINITY;
  for (Atom atom1 : aa1.getAtoms())
    for (Atom atom2 : aa2.getAtoms()) {
      double dist = Calc.getDistance(atom1, atom2);
      distMin = Math.min(distMin, dist);
    }
  return distMin;
}
origin: biojava/biojava

private static boolean hasMetalBond(Atom a1, Atom a2, MetalBondDistance definition) {
  double distance = Calc.getDistance(a1,a2);
  Float min = definition.getLowerLimit();
  Float max = definition.getUpperLimit();
  return ( min < distance && max > distance);
}
origin: biojava/biojava

public boolean angleCheckOk(FragmentPair a, FragmentPair b, float distcutoff){
  double dist = -999;
  Atom v1 = a.getUnitv();
  Atom v2 = b.getUnitv();
  dist = Calc.getDistance(v1,v2);
  return dist <= distcutoff;
}
origin: biojava/biojava

private boolean distanceCheckOk(FragmentPair a, FragmentPair b, float fragCompatDist){
  double dd ;
  Atom c1i = a.getCenter1();
  Atom c1j = b.getCenter1();
  Atom c2i = a.getCenter2();
  Atom c2j = b.getCenter2();
  dd = Calc.getDistance(c1i,c1j) - Calc.getDistance(c2i,c2j);
  if ( dd < 0) dd = -dd;
  return dd <= fragCompatDist;
}
origin: biojava/biojava

double distance;
distance = Calc.getDistance(linkage[0], linkage[1]);
origin: biojava/biojava

public static Matrix getDistanceMatrix(Atom[] ca1, Atom[]ca2){
  int r = ca1.length;
  int c = ca2.length;
  Matrix out = new Matrix(r,c);
  for (int i=0; i<r; i++) {
    Atom a1 = ca1[i];
    for (int j=0;j<c;j++){
      Atom b1 = ca2[j];
      double d = Calc.getDistance(a1,b1);
      out.set(i,j,d);
    }
  }
  return out;
}
origin: biojava/biojava

/**
 * Matrix of all distances between two sets of Atoms. Does not
 * superimpose or modify the Atoms.
 *
 * @param ca1
 * @param ca2
 * @return a Matrix
 */
public static Matrix getDistanceMatrix(Atom[] ca1, Atom[] ca2){
  int r = ca1.length;
  int c = ca2.length;
  Matrix out = new Matrix(r,c);
  for (int i=0; i<r; i++) {
    Atom a1 = ca1[i];
    for (int j=0;j<c;j++){
      Atom b1 = ca2[j];
      double d = Calc.getDistance(a1,b1);
      out.set(i,j,d);
    }
  }
  return out;
}
origin: biojava/biojava

/**
 * Test if two amino acids are connected, i.e. if the distance from C to N <
 * 2.5 Angstrom.
 *
 * If one of the AminoAcids has an atom missing, returns false.
 *
 * @param a
 *            an AminoAcid object
 * @param b
 *            an AminoAcid object
 * @return true if ...
 */
public static final boolean isConnected(AminoAcid a, AminoAcid b) {
  Atom C = null ;
  Atom N = null;
  C = a.getC();
  N = b.getN();
  if ( C == null || N == null)
    return false;
  // one could also check if the CA atoms are < 4 A...
  double distance = getDistance(C,N);
  return distance < 2.5;
}
origin: biojava/biojava

private void formNucleotideBonds() {
  for (int modelInd=0; modelInd<structure.nrModels(); modelInd++){
    for (Chain chain : structure.getChains(modelInd)) {
      List<Group> groups = chain.getSeqResGroups();
      for (int i = 0; i < groups.size() - 1; i++) {
        if (!(groups.get(i) instanceof NucleotideImpl)
            || !(groups.get(i + 1) instanceof NucleotideImpl))
          continue;
        NucleotideImpl tail = (NucleotideImpl) groups.get(i);
        NucleotideImpl head = (NucleotideImpl) groups.get(i + 1);
        // atoms with no residue number don't have atom information
        if (tail.getResidueNumber() == null
            || head.getResidueNumber() == null) {
          continue;
        }
        Atom phosphorous = head.getP();
        Atom oThreePrime = tail.getO3Prime();
        if (phosphorous == null || oThreePrime == null) {
          continue;
        }
        if (Calc.getDistance(phosphorous, oThreePrime) < MAX_NUCLEOTIDE_BOND_LENGTH) {
          new BondImpl(phosphorous, oThreePrime, 1);
        }
      }
    }
  }
}
origin: biojava/biojava

private static Matrix getDisTable(int maxlen, Atom[]ca)
{
  int length = ca.length;
  Matrix dis = new Matrix(length,length);
  int     i, j;
  for(i = 0; i < length; i ++)    {
    dis.set(i,i,0);
    for(j = i + 1;( j < length) && (j <= i + maxlen); j ++)     {
      dis.set(i,j,0);
      double val = dis.get(i,j) + (Calc.getDistance(ca[i],ca[j])) * (Calc.getDistance(ca[i],ca[j]));
      dis.set(i,j,val);
      dis.set(i,j,Math.sqrt(dis.get(i,j)));
      dis.set(j,i,dis.get(i,j));
    }
  }
  return dis;
}
origin: biojava/biojava

if (Calc.getDistance(carboxylC, aminoN) < MAX_PEPTIDE_BOND_LENGTH) {
  new BondImpl(carboxylC, aminoN, 1);
origin: biojava/biojava

private static Atom calcSimple_H(Atom c, Atom o, Atom n)  {
  Atom h = Calc.subtract(c,o);
  double dist = Calc.getDistance(o,c);
  //System.out.println(dist);
  double x = n.getX() + h.getX() / dist;
  double y = n.getY() + h.getY() / dist;
  double z = n.getZ() + h.getZ() / dist;
  h.setX(x);
  h.setY(y);
  h.setZ(z);
  h.setName("H");
  return h;
}
origin: biojava/biojava

Atom N = groups[index+1].getN();
if (Calc.getDistance(C, N) > MAX_PEPTIDE_BOND_LENGTH){
  bonded = false;
  break;
org.biojava.nbio.structureCalcgetDistance

Javadoc

calculate distance between two atoms.

Popular methods of Calc

  • rotate
  • shift
    Shift an array of atoms at once.
  • add
    add two atoms ( a + b).
  • amount
    Gets the length of the vector (2-norm)
  • angle
    Gets the angle between two vectors
  • atomsToPoints
    Convert an array of atoms into an array of vecmath points
  • calcRotationAngleInDegrees
    Calculates the angle from centerPt to targetPt in degrees. The return should range from [0,360), rot
  • centerAtoms
    Center the atoms at the Centroid, if the centroid is already know.
  • centerOfMass
    Returns the center of mass of the set of atoms. Atomic masses of the Atoms are used.
  • createVirtualCBAtom
    creates a virtual C-beta atom. this might be needed when working with GLY thanks to Peter Lackner fo
  • getCenterVector
    Returns the Vector that needs to be applied to shift a set of atoms to the Centroid, if the centroid
  • getCentroid
    Returns the centroid of the set of atoms.
  • getCenterVector,
  • getCentroid,
  • getDistanceFast,
  • getTMScore,
  • getTransformation,
  • getTranslationVector,
  • getZYZEuler,
  • invert,
  • isConnected

Popular in Java

  • Start an intent from android
  • scheduleAtFixedRate (Timer)
  • getSystemService (Context)
  • onCreateOptionsMenu (Activity)
  • Kernel (java.awt.image)
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now