Search in sources :

Example 6 with Atom

use of org.biojava.bio.structure.Atom in project ffx by mjschnie.

the class PDBFileMatcher method getMatchingAtom.

/**
 * Searches for atom1's match in atoms2; first checks for an equivalent
 * atom, then performs a search over all atoms in atoms2.
 *
 * @param atom1 An Atom.
 * @param atoms2 An Atom[] to search.
 * @return atom1's match in atom2.
 * @throws IllegalArgumentException If no match could be found.
 */
private Atom getMatchingAtom(Atom atom1, Atom[] atoms2) throws IllegalArgumentException {
    Atom atom2 = atoms2[0];
    Structure structure2 = atom2.getGroup().getChain().getParent();
    try {
        atom2 = getMatchingAtom(atom1, structure2, false);
        return atom2;
    } catch (IllegalArgumentException ex) {
        for (Atom atom : atoms2) {
            if (compareAtoms(atom1, atom)) {
                return atom;
            }
        }
    }
    throw new IllegalArgumentException(String.format("No matching atom for %s found", atom1.toString()));
}
Also used : Structure(org.biojava.bio.structure.Structure) Atom(org.biojava.bio.structure.Atom)

Aggregations

Atom (org.biojava.bio.structure.Atom)6 Structure (org.biojava.bio.structure.Structure)3 Chain (org.biojava.bio.structure.Chain)2 Group (org.biojava.bio.structure.Group)2 BufferedWriter (java.io.BufferedWriter)1 File (java.io.File)1 FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 PDBCrystallographicInfo (org.biojava.bio.structure.PDBCrystallographicInfo)1 ResidueNumber (org.biojava.bio.structure.ResidueNumber)1 SSBond (org.biojava.bio.structure.SSBond)1 StructureException (org.biojava.bio.structure.StructureException)1 AlternativeAlignment (org.biojava.bio.structure.align.pairwise.AlternativeAlignment)1