BioJava:CookBook:PDB:atomsCalc

From BioJava

Jump to: navigation, search

How can I do calculations with Atoms?

The Calc class provides a set of methods that can be used for calculations.

public  double getPhi(Group a, Group b)
    throws StructureException
    {
        
        if ( ! Calc.isConnected(a,b)){
            throw new StructureException("can not calc Phi - AminoAcids are not connected!") ;
        } 
        
        Atom a_C  = a.getAtom("C");
        Atom b_N  = b.getAtom("N");
        Atom b_CA = b.getAtom("CA");
        Atom b_C  = b.getAtom("C");
        
        double phi = Calc.torsionAngle(a_C,b_N,b_CA,b_C);
        return phi ;
    }

BioJava contains a protein structure superimposition algorithm that is implemented using the BioJava structure API. To learn more about aligning protein structures go to BioJava:CookBook:PDB:align


Next: BioJava:CookBook:PDB:header - How to access the header information

Personal tools