Skip to main content
1 of 2
pippo1980
  • 1.3k
  • 4
  • 18

ok, here my input pdb, example_short.pdb :

ATOM      1  N   MET A   1      14.067  31.664  -1.639  1.00 80.87           N
ATOM      2  HN1 MET A   1      14.250  31.259  -0.699  1.00  0.00           H
ATOM      3  HN2 MET A   1      14.891  32.220  -1.945  1.00  0.00           H
ATOM      4  HN3 MET A   1      13.229  32.279  -1.596  1.00  0.00           H
ATOM      5  CA  MET A   1      13.824  30.564  -2.612  1.00 79.17           C
ATOM      6  HA  MET A   1      14.702  29.921  -2.671  1.00  0.00           H
ATOM      7  C   MET A   1      13.556  31.158  -3.989  1.00 78.52           C
ATOM      8  O   MET A   1      13.301  32.365  -4.085  1.00 79.40           O
ATOM      9  CB  MET A   1      12.634  29.724  -2.148  1.00 83.38           C
ATOM     10  HB1 MET A   1      12.600  29.755  -1.059  1.00  0.00           H
ATOM     11  HB2 MET A   1      11.725  30.170  -2.552  1.00  0.00           H
ATOM     12  CG  MET A   1      12.680  28.264  -2.580  1.00 85.71           C
ATOM     13  HG1 MET A   1      12.066  28.145  -3.473  1.00  0.00           H
ATOM     14  HG2 MET A   1      12.274  27.650  -1.776  1.00  0.00           H
ATOM     15  SD  MET A   1      14.354  27.697  -2.951  1.00100.24           S
ATOM     16  CE  MET A   1      15.137  27.675  -1.338  1.00 97.10           C
ATOM     17  HE1 MET A   1      15.118  28.678  -0.913  1.00  0.00           H
ATOM     18  HE2 MET A   1      14.597  26.991  -0.683  1.00  0.00           H
ATOM     19  HE3 MET A   1      16.170  27.342  -1.441  1.00  0.00           H
ATOM     20  N   GLU A   2      13.604  30.306  -5.018  1.00 75.32           N
ATOM     21  H   GLU A   2      13.628  29.291  -4.794  1.00  0.00           H
ATOM     22  CA  GLU A   2      13.626  30.684  -6.444  1.00 72.66           C
ATOM     23  HA  GLU A   2      13.508  29.732  -6.961  1.00  0.00           H
ATOM     24  C   GLU A   2      14.903  31.384  -6.843  1.00 65.44           C
ATOM     25  O   GLU A   2      15.489  31.127  -7.892  1.00 67.46           O
ATOM     26  CB  GLU A   2      12.516  31.672  -6.810  1.00 72.71           C
ATOM     27  HB1 GLU A   2      12.094  32.068  -5.886  1.00  0.00           H
ATOM     28  HB2 GLU A   2      12.960  32.486  -7.383  1.00  0.00           H
ATOM     29  CG  GLU A   2      11.397  31.081  -7.622  1.00 77.72           C
ATOM     30  HG1 GLU A   2      10.901  31.877  -8.178  1.00  0.00           H
ATOM     31  HG2 GLU A   2      11.809  30.354  -8.321  1.00  0.00           H
ATOM     32  CD  GLU A   2      10.385  30.393  -6.731  1.00 79.89           C
ATOM     33  OE1 GLU A   2       9.171  30.574  -6.987  1.00 82.69           O
ATOM     34  OE2 GLU A   2      10.824  29.702  -5.779  1.00 72.73           O
ATOM     35  N   ASN A   3      15.194  32.399  -6.043  1.00 60.12           N
ATOM     36  H   ASN A   3      14.712  32.444  -5.123  1.00  0.00           H
ATOM     37  CA  ASN A   3      16.140  33.452  -6.363  1.00 56.21           C
ATOM     38  HA  ASN A   3      16.072  33.715  -7.419  1.00  0.00           H
ATOM     39  C   ASN A   3      17.548  32.968  -6.047  1.00 50.40           C
ATOM     40  O   ASN A   3      18.513  33.666  -6.331  1.00 50.95           O
ATOM     41  CB  ASN A   3      15.821  34.667  -5.493  1.00 57.10           C
ATOM     42  HB1 ASN A   3      15.913  34.381  -4.445  1.00  0.00           H
ATOM     43  HB2 ASN A   3      16.538  35.457  -5.717  1.00  0.00           H
ATOM     44  CG  ASN A   3      14.425  35.196  -5.732  1.00 62.07           C
ATOM     45  OD1 ASN A   3      14.220  36.001  -6.641  1.00 69.12           O
ATOM     46  ND2 ASN A   3      13.464  34.748  -4.923  1.00 57.21           N
ATOM     47 1HD2 ASN A   3      12.486  35.079  -5.045  1.00  0.00           H
ATOM     48 2HD2 ASN A   3      13.693  34.068  -4.170  1.00  0.00           H
ATOM     49  N   PHE A   4      17.643  31.764  -5.492  1.00 47.14           N
ATOM     50  H   PHE A   4      16.781  31.193  -5.378  1.00  0.00           H
ATOM     51  CA  PHE A   4      18.914  31.219  -5.038  1.00 46.77           C
ATOM     52  HA  PHE A   4      19.696  31.915  -5.340  1.00  0.00           H
ATOM     53  C   PHE A   4      19.239  29.888  -5.695  1.00 48.73           C
ATOM     54  O   PHE A   4      18.490  28.919  -5.594  1.00 49.50           O
ATOM     55  CB  PHE A   4      18.922  31.095  -3.507  1.00 42.32           C
ATOM     56  HB1 PHE A   4      18.091  30.456  -3.207  1.00  0.00           H
ATOM     57  HB2 PHE A   4      19.862  30.635  -3.201  1.00  0.00           H
ATOM     58  CG  PHE A   4      18.787  32.415  -2.806  1.00 39.42           C
ATOM     59  CD1 PHE A   4      17.545  32.878  -2.408  1.00 40.76           C
ATOM     60  HD1 PHE A   4      16.673  32.232  -2.509  1.00  0.00           H
ATOM     61  CD2 PHE A   4      19.881  33.258  -2.648  1.00 35.13           C
ATOM     62  HD2 PHE A   4      20.857  32.941  -3.015  1.00  0.00           H
ATOM     63  CE1 PHE A   4      17.397  34.138  -1.889  1.00 36.49           C
ATOM     64  HE1 PHE A   4      16.400  34.520  -1.669  1.00  0.00           H
ATOM     65  CE2 PHE A   4      19.757  34.474  -2.043  1.00 32.88           C
ATOM     66  HE2 PHE A   4      20.640  35.090  -1.873  1.00  0.00           H
ATOM     67  CZ  PHE A   4      18.507  34.929  -1.643  1.00 43.95           C
ATOM     68  HZ  PHE A   4      18.401  35.892  -1.144  1.00  0.00           H
END

here my code :

from Bio import PDB

from Bio.PDB import PICIO, PDBIO

from typing import TypedDict, Dict, Tuple



parser = PDB.PDBParser(PERMISSIVE=1, QUIET=1)

structure: PDB.Structure.Structure = parser.get_structure("prova", "example_short.pdb")

structure.atom_to_internal_coordinates()
chain: PDB.Chain.Chain = list(structure.get_chains())[0]
ic_chain: PDB.internal_coords.IC_Chain = chain.internal_coord
d:  Dict[Tuple[PDB.internal_coords.AtomKey, 
                       PDB.internal_coords.AtomKey,
                       PDB.internal_coords.AtomKey,
                       PDB.internal_coords.AtomKey],
                 PDB.internal_coords.Dihedron] = ic_chain.dihedra



cnt = 1
for key in d:

    
    if key[0].akl[3] == 'N':
        if key[1].akl[3] == 'CA':
            if key[2].akl[3] == 'C':
                if key[3].akl[3] == 'N':
        
                    print ('\n',cnt,' :   ',  [x.akl[3] for x in key], d[key].angle)
                    
                    d[key].angle += 45
        
                    cnt += 1

cnt = 1
for key in d:

    
    if key[0].akl[3] == 'N':
        if key[1].akl[3] == 'CA':
            if key[2].akl[3] == 'C':
                if key[3].akl[3] == 'N':
        
                    print ('\n',cnt,' :   ',  [x.akl[3] for x in key], d[key].angle)
        
                    cnt += 1
                    
structure.internal_to_atom_coordinates(verbose = True)

io = PDBIO()

io.set_structure(structure)

io.save('atom_coord.pdb',  preserve_atom_numbering=True) 

here an image of the original vs new quadripeptid (cartoon repr, just backbone) :

original is rainbowed one (blue to red), magenta is the new one

saved as atom_coord.pdb

enter image description here

I believe I changed φ (Phi) adding 45° since

Now, a φ angle is N-CA-C-N

pippo1980
  • 1.3k
  • 4
  • 18