Search in sources :

Example 6 with Atom

use of de.bioforscher.jstructure.model.structure.Atom in project jstructure by JonStargaryen.

the class AccessibleSurfaceAreaCalculator method calcSingleAsa.

/**
     * Calculates the accessible surface area (ASA) of an individual atom.
     * @param atom the atom to processUniProtId
     * @return this atom's ASA
     */
private double calcSingleAsa(Atom atom, List<Atom> nonHydrogenAtoms) {
    List<Atom> neighborAtoms = findNeighbors(atom, nonHydrogenAtoms);
    double radius = probeSize + atom.getFeatureContainer().getFeature(AtomRadius.class).getRadius();
    int accessiblePoints = 0;
    for (double[] point : spherePoints) {
        boolean isAccessible = true;
        double[] testPoint = LinearAlgebra.on(point).multiply(radius).add(atom.getCoordinates()).getValue();
        for (Atom neighborAtom : neighborAtoms) {
            double neighborAtomRadius = neighborAtom.getFeatureContainer().getFeature(AtomRadius.class).getRadius() + probeSize;
            double differenceSquared = LinearAlgebra.on(testPoint).distanceFast(neighborAtom.getCoordinates());
            if (differenceSquared < neighborAtomRadius * neighborAtomRadius) {
                isAccessible = false;
                break;
            }
        }
        if (isAccessible) {
            accessiblePoints++;
        }
    }
    return cons * accessiblePoints * radius * radius;
}
Also used : Atom(de.bioforscher.jstructure.model.structure.Atom)

Example 7 with Atom

use of de.bioforscher.jstructure.model.structure.Atom in project jstructure by JonStargaryen.

the class AtomLinearAlgebraTest method transform.

@Test
public void transform() throws Exception {
    // example from http://stackoverflow.com/questions/34050929/3d-point-rotation-algorithm
    double[] point = { 1, 0, 0 };
    final double[] expectedPoint = { 0, -1, 0 };
    System.out.printf("rotating %s by -90 degree yields ", Arrays.toString(point));
    // describes a rotation by 90°
    double[][] rotation = { { 0, -1, 0 }, { 1, 0, 0 }, { 0, 0, 1 } };
    Transformation transformation = new Transformation(rotation);
    Atom atom = new Atom(point);
    transformation.transformCoordinates(atom);
    System.out.println(Arrays.toString(atom.getCoordinates()));
    Assert.assertArrayEquals(expectedPoint, atom.getCoordinates(), 0.0);
    double[] point2 = { 3, 0, 0 };
    final double[] expectedPoint2 = { -2, -3, 0 };
    double[] translation2 = { -2, 0, 0 };
    System.out.printf("translating %s by 2 length units toward origin and rotating it by -90 degree yields ", Arrays.toString(point2));
    // describes a rotation by 90°
    double[][] rotation2 = { { 0, -1, 0 }, { 1, 0, 0 }, { 0, 0, 1 } };
    Transformation transformation2 = new Transformation(translation2, rotation2);
    Atom atom2 = new Atom(point2);
    transformation2.transformCoordinates(atom2);
    System.out.println(Arrays.toString(atom2.getCoordinates()));
    Assert.assertArrayEquals(expectedPoint2, atom2.getCoordinates(), 0.0);
}
Also used : Atom(de.bioforscher.jstructure.model.structure.Atom) Test(org.junit.Test)

Aggregations

Atom (de.bioforscher.jstructure.model.structure.Atom)7 AminoAcid (de.bioforscher.jstructure.model.structure.aminoacid.AminoAcid)3 Group (de.bioforscher.jstructure.model.structure.Group)2 Protein (de.bioforscher.jstructure.model.structure.Protein)2 ProteinParser (de.bioforscher.jstructure.parser.ProteinParser)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Test (org.junit.Test)2 SVDSuperimposer (de.bioforscher.jstructure.alignment.SVDSuperimposer)1 ComputationException (de.bioforscher.jstructure.feature.ComputationException)1 AbstractFeatureProvider (de.bioforscher.jstructure.model.feature.AbstractFeatureProvider)1 FeatureProvider (de.bioforscher.jstructure.model.feature.FeatureProvider)1 Chain (de.bioforscher.jstructure.model.structure.Chain)1 Arginine (de.bioforscher.jstructure.model.structure.aminoacid.Arginine)1 Phenylalanine (de.bioforscher.jstructure.model.structure.aminoacid.Phenylalanine)1 AtomContainer (de.bioforscher.jstructure.model.structure.container.AtomContainer)1 GroupContainer (de.bioforscher.jstructure.model.structure.container.GroupContainer)1 ProteinIdentifier (de.bioforscher.jstructure.model.structure.identifier.ProteinIdentifier)1 SelectionException (de.bioforscher.jstructure.model.structure.selection.SelectionException)1 BufferedReader (java.io.BufferedReader)1