how to extract coordinates from Two PDB files and how to calculate all atom to all atom distances
3
1
Entering edit mode
7.8 years ago
python ▴ 20

how to extract coordinates from Two PDB files and how to calculate all atom to all atom distances please help me to write a code in python

python biopython • 6.3k views
ADD COMMENT
3
Entering edit mode
7.8 years ago
Peter 6.0k

See http://www.warwick.ac.uk/go/peter_cock/python/protein_contact_map for an (old) example of using Biopython for calculating all the atom-to-atom distances to draw a contact map.

ADD COMMENT
2
Entering edit mode
7.8 years ago

Could you please explain whether you want to calculate distances between atoms within each file or between files? The later depends on the purpose of the calculating distances. For example, if you want to compare structures than you want to align them in 3D before calculating distances. The way to align them properly will depend a lot on the biological question you ask, type of the proteins, their structure, sequence and/or function similarity and so on. Also depending on the biological purpose, you may want to refine the structures first, maybe build multimers and/or add mutations, remove or add some molecules or atoms to the structure, change residue properties like charge and so on.

If you are planning to do a lot of bio and pdb analysis in python, you can start from byopython http://biopython.org/ and Bio.PDB in particular. You will have to install it first. Here is a cookbook http://biopython.org/DIST/docs/tutorial/Tutorial.html There is get_coord() and get_vector methods for atom objects. Atom object is within residues, that is within chains, within models in structures so you can iterate over the structure like this to get all atoms' coordinates:

for model in structure:
    for chain in model:
        for residue in chain:
            for atom in residue:                                  
                XYZ = atom.get_coord()

Then you calculate the distances between atoms you want.

If this is one-time task this can be solved in one-liner in Unix shell, just please tell us what exactly you want and what for.

ADD COMMENT
1
Entering edit mode

actualyy i have to extract xyz coordinates from any pdb file and than have to calculate all atom to all atom distances and have to seprate out the atom for only if distance is between 1 to 5 angstrom

ADD REPLY
0
Entering edit mode
7.0 years ago
Cave • 0

You can do this using biopandas. Here's a link that explains how to: https://rasbt.github.io/biopandas/tutorials/Working_with_PDB_Structures_in_DataFrames/#filtering-pdbs-by-distance

ADD COMMENT

Login before adding your answer.

Traffic: 1518 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6