0

thank you so much for your time, in advance. I want to calculate the distances of one atom from chain A against multiple atoms from chain B. for Exp:

My PDB file has these entries

Chain A ATOM 32 CZ ARG A 89 -9.472 17.209 -4.849 1.00 49.73 C

Chain B ATOM 538 O4' DG B 2 -6.257 16.810 11.821 1.00 71.16 O ATOM 539 C3' DG B 2 -4.271 15.614 11.464 1.00 73.87 C

Chain C ATOM 830 O3' DC C 2 -8.757 5.249 -25.109 1.00 30.80 O ATOM 831 C2' DC C 2 -6.307 4.905 -25.202 1.00 32.20 C

better:

ATOM     32  CZ  ARG A   89     -9.472  17.209  -4.849  1.00 49.73           C

ATOM    538  O4' DG  B   2      -6.257  16.810  11.821  1.00 71.16           O 
ATOM    539  C3' DG  B   2      -4.271  15.614  11.464  1.00 73.87           C

ATOM    830  O3* DC  C   2      -8.757   5.249 -25.109  1.00 30.80           O
ATOM    831  C2* DC  C   2      -6.307   4.905 -25.202  1.00 32.20           C

Now I want to calculate the distances between chain A CZ atom against chain B&C following atoms O4', C3', O3', C2' etc.

Please guide me. Thanks

pippo1980
  • 2,181
  • 3
  • 14
  • 30
ray
  • 5
  • 2
  • start from here Biopython PDB: calculate distance between an atom and a point https://stackoverflow.com/questions/37079684/biopython-pdb-calculate-distance-between-an-atom-and-a-point – pippo1980 Jul 08 '21 at 17:56

1 Answers1

1

here my attempt:

from Bio import PDB
parser = PDB.PDBParser()

pdb1 ='pdb_test.pdb' 
structure = parser.get_structure("pdb_test", pdb1) 

atom1 = structure[0]["A"][89]["CZ"]

for model in structure:
    for chain in model:
        for residue in chain:
            for atom in residue:
                if chain.id !='A':
                    print(atom1 , '  -  ',atom ,  '  =  ',atom1 - atom)

output:

<Atom CZ>   -   <Atom O4'>   =   16.981882
<Atom CZ>   -   <Atom C3'>   =   17.196173
<Atom CZ>   -   <Atom O3'>   =   23.537636
<Atom CZ>   -   <Atom C2'>   =   23.992712
pippo1980
  • 2,181
  • 3
  • 14
  • 30