This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Get Indexes Of Atoms Involved In Dihedral Angles For A Specific Residue In A Pdb File

From a protein PDB file and for a given residue number, I would like to get the indexes of the four atoms related with psi and phi dihedral angles. Are there useful libraries for this?

pdb protein structure scripting

5 answers

You you can use VMD's tcl scripting to get phi/psi angles. Bellow is a script originally posted here, but with few modifications.

mol new "1abc.pdb" waitfor all

set fp [ open "phi-psi.dat" w ] 
set sel [ atomselect $mol "alpha" ] 
set n [ molinfo $mol get numframes ] 
for {set i 0 } { $i < $n } { incr i } { 
    $sel frame $i 
    $sel update 
    puts $fp "\# frame: $i" 
    set a [ $sel num ] 
    for {set j 0 } { $j < $a } { incr j } { 
        puts $fp "[expr $j + 1] [lindex [$sel get {resname phi psi}] $j]" 
    } 
} 
$sel delete 
close $fp 
exit

I have never used VMD, so have no idea how to run this script. Could you point me to some simple examples for learning how to use these scripts? thanks

you can run the script in two ways: a) load vmd, go to 'extensions' -> 'Tk Console' and then paste in the script

b) if using linux, save the above script into phi-psiscript.tcl; then in the terminal run 'vmd -dispdev text -e phi-psiscript.tcl'. don't forget to change "1abc" to a pdb file of your choice.

great! I will have a look at. thanks

Have you tried SSTRUC part of JOY package:

Here is first few lines of output for PDB ID: 2DXL. It basically generates this complete file for a given protein structure. You can then parse the output file for residues/regions.

Secondary structure calculation program - copyright by David Keith Smith, 1989
2DXL.atm                                                    
      HYDROLASE  MOL_ID: 1;  MOL_ID: 1;  
Sequence length - 1626
            A       A K K                                                                        hydrogen bonding             Ooi's
strk chain/ l amino u & S structure   bridge        dihedral angles                     donor    acceptor   donor    acceptor  N  N
num  seq.no t acids t S + patterns   partners    phi    psi  omega  alpha kappa   tco to/energy fr/energy to/energy fr/energy  8 14
   1 A   1    MET M     e              0    0  999.9  123.3  172.5  999.9 999.9 999.9    0   .0  242 -2.1    0   .0    0   .0  9 38
   2 A   2    LEU L   E E  AA     -  241    0 -129.1  120.1 -178.7 -174.5 999.9 169.0    0   .0   43 -3.3    0   .0   44 -1.1 11 43
   3 A   3    LEU L   E E  AAb    -  240   44 -116.7  133.3  170.7 -151.1  18.7 160.3  240 -3.2  240 -2.6    0   .0    5  -.7 12 57
   4 A   4    ALA A   E E  AAb    -  239   45  -98.4  115.0 -174.0 -166.1  22.9 157.6   44 -2.3   46 -2.7    0   .0    6  -.6 13 61
   5 A   5    HIS H   E E  AAb    +  238   46 -113.9  111.2  176.0  163.3  15.5 155.4  238 -3.5  238 -2.5    3  -.7    0   .0 12 74
   6 A   6    ILE I   E E  A b    -    0   47 -118.5  165.3 -174.2 -171.0  11.8 143.3   46 -3.1   48 -1.7    4  -.6    0   .0 17 78
   7 A   7    SER S               +    0    0 -152.5  158.5  166.2   24.5  49.7 168.3    0   .0  215 -1.5    0   .0    0   .0 17 76
   8 A   8    ASP D               +    0    0   54.9   54.3 -179.7  167.0  51.6  28.6    0   .0  216  -.5    0   .0    0   .0 16 78
   9 A   9    THR T               -    0    0  -69.5  -32.1  175.2 -161.9  22.4  38.4    0   .0    0   .0    0   .0    0   .0 14 79

============== Removed for brevity =======================

maybe you want to have a look at p3d

I had a look at the website but did not find anything useful related with my problem

I believe that the 'press' R package allows calculation of psi-phi angles from a PDB file

I had a look at the website but did not find anything useful related with my problem

You can easily do this in BioJava as well if it suits you better.

Here's a code example: http://www.biojava.org/docs/api/org/biojava/bio/structure/Structure.html (See 'How can I calculate Phi and Psi angles of AminoAcids?')

Log in to answer this question.