Structure Analysis

ProDy comes with many functions that can be used to calculate structural properties and compare structures. We demonstrate only some of these functions. For more detailed examples, see Structure Analysis tutorial.

In [1]: from prody import *

In [2]: from pylab import *

In [3]: ion()

Measure geometric properties

Let’s parse a structure:

In [4]: p38 = parsePDB('5uoj')

Functions for analyzing structures can be found in measure module. For example, you can calculate phi (φ) and psi (ψ) for the 10th residue, or the radius of gyration of the protein as follows:

In [5]: calcPhi(p38[10,])
Out[5]: -124.86176953710802

In [6]: calcPsi(p38[10,])
Out[6]: 132.5985032413337

In [7]: calcGyradius(p38)
Out[7]: 22.31823191315965

Compare and align structures

You can also compare different structures using some of the methods in proteins module. Let’s parse another p38 MAP kinase structure

In [8]: bound = parsePDB('1zz2')

You can find similar chains in structure 5uoj and 1zz2 using matchChains() function:

In [9]: apo_chA, bnd_chA, seqid, overlap = matchChains(p38.protein, bound.protein)[0]

In [10]: apo_chA
Out[10]: <AtomMap: Chain A from 5uoj -> Chain A from 1zz2 from 5uoj (337 atoms)>

In [11]: bnd_chA
Out[11]: <AtomMap: Chain A from 1zz2 -> Chain A from 5uoj from 1zz2 (337 atoms)>

In [12]: seqid
Out[12]: 99.40652818991099

In [13]: overlap
Out[13]: 98

Matching Cα atoms are selected and returned as AtomMap instances. We can use them to calculate RMSD and superpose structures.

In [14]: calcRMSD(bnd_chA, apo_chA)
Out[14]: 72.93561517918914

In [15]: bnd_chA, transformation = superpose(bnd_chA, apo_chA)

In [16]: calcRMSD(bnd_chA, apo_chA)
Out[16]: 1.8248053285019694
In [17]: showProtein(p38);

In [18]: showProtein(bound);
../../_images/prody_tutorial_structure_compare.png

Writing PDB files

PDB files can be written using the writePDB() function. The function accepts objects containing or referring to atomic data.

Output selected atoms:

In [19]: writePDB('5uoj_calphas.pdb', p38.select('calpha'))
Out[19]: '5uoj_calphas.pdb'

Output a chain:

In [20]: chain_A = p38['A']

In [21]: writePDB('5uoj_chain_A.pdb', chain_A)
Out[21]: '5uoj_chain_A.pdb'

As you may have noticed, this function returns the file name after it is successfully written. This is a general behavior for ProDy output functions. For more PDB writing examples see Write PDB file.