Question: how to extract coordinates from Two PDB files and how to calculate all atom to all atom distances
1
gravatar for python
20 months ago by
python20
python20 wrote:

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

biopython python • 1.6k views
ADD COMMENTlink modified 10 months ago by Cave0 • written 20 months ago by python20
3
gravatar for Peter
20 months ago by
Peter5.6k
Scotland, UK
Peter5.6k wrote:

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 COMMENTlink modified 19 months ago • written 20 months ago by Peter5.6k
2
gravatar for Petr Ponomarenko
20 months ago by
United States / Los Angeles / ALAPY.com
Petr Ponomarenko2.5k wrote:

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 COMMENTlink modified 20 months ago • written 20 months ago by Petr Ponomarenko2.5k
1

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 REPLYlink written 20 months ago by python20
0
gravatar for Cave
10 months ago by
Cave0
Cave0 wrote:

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 COMMENTlink written 10 months ago by Cave0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2099 users visited in the last hour