You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to get all angles and bond lengths of a residue? #4213
The Bio.PDB.internal_coords module provides APIs such as "get_angle" and "get_length" that could return a specific angle or a bond length. But I didn't find an easy way to get all angles and bond lengths in the source code and official tutorial. Whether this purpose can only be implemented by traversing every angle or bond?
There are also arrays of the angle and length data at the chain level, but
these will need to be filtered if e.g. you want something like just all
backbone psi, phi and omega angles.
Another option is to process the Chain.internal_coords.ordered_aa_ic_list,
which may be easier depending on your application.
I've placed a copy of the updated documentation waiting to be merged at
https://janerob.com/assets/ .
On Wed, Jan 11, 2023 at 8:14 PM Seldon ***@***.***> wrote:
The *Bio.PDB.internal_coords* module provides APIs such as *"get_angle"*
and *"get_length"* that could return a specific angle or a bond length.
But I didn't find an easy way to get all angles and bond lengths in the
source code and official tutorial. Whether this purpose can only be
implemented by traversing every angle or bond?
—
Reply to this email directly, view it on GitHub
<#4213>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZW3QFD2BBI47EIUPFFBTTWR5EH3ANCNFSM6AAAAAATYUMJ6Q>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
For the GLY residue, call the get_length("N:CA") in the internal_coord returns None, but it works well for residue of other types and return normal bond length between N and CA. Is this a bug?
For the GLY residue, call the get_length("N:CA") in the internal_coord returns None, but it works well for residue of other types and return normal bond length between N and CA. Is this a bug?
For the GLY residue, call the get_length("N:CA") in the internal_coord returns None, but it works well for residue of other types and return normal bond length between N and CA. Is this a bug?
It seems that N:CA length doesn't take effect in "internal_coord_to_atom_coordindates", since the atom coordinates keep unchanged after the N:CA length is set to other values.
Sorry, more of an 'unimplemented feature' which I will add to my current
pull request. Should have expected it would get hit.
The problem is that the N:CA:C (tau) hedron is stored on the previous
residue except in the case of the initial residue of a chain. This is
discussed in the pick_angle() documentation, and the issue is handled for
pick_angle() but not for pick_length() (which get_length() calls). For the
current codebase, the workaround would be to specify "1N:1CA" for the
previous residue, e.g.
residue.internal_coord.rprev[0].get_length("1N:1CA")
The AtomKey syntax for residues i+/-1 is discussed in that class
documentation. rprev is a list of previous residues to handle the
possibility of alternate residues/locations.
If your goal is to print a list of just these lengths, the loop is probably
best using the line above and then handling the start residues as a special
case when `rprev == []`.
If you're wanting 'everything' printed out for a protein, I suggest having
a look at the .pic files (write_pic()), possibly using StringIO if you want
to modify the format.
If you want arbitrary read/write access to bond lengths, angles and
dihedrals, the best approach may be to work with the .hedra and .dihedra
dictionaries on the Chain.internal_coords structure directly.
However there is a bug related to this for set_length() on a backbone bond, causing some atom coordinates to not be updated as you found.
This fix has now been added to #3898, to work around it on the current code base you would need to change values directly in the IC_Chain.hedra dictionary. If you need/want to do this, you should know that the problem comes from multiple hedra specifying the same bond, e.g. N:CA or CA:C, and the value needs to be updated in all of them. Another option might be look at the #3898 fix to IC_Residue.pick_length() and monkey patch that on your installation.
Activity
peterjc commentedon Jan 12, 2023
Which bond/angles do you want? If you want all of them, then as you say traversing seems appropriate.
There may be a helper functions like
.get_phi_psi_list(...)for special case, see my (very old) example at https://warwick.ac.uk/fac/sci/moac/people/students/peter_cock/python/ramachandran/calculate/ using MMTK and Biopython for this.rob-miller commentedon Jan 12, 2023
LtECoD commentedon Jan 13, 2023
For the GLY residue, call the get_length("N:CA") in the internal_coord returns None, but it works well for residue of other types and return normal bond length between N and CA. Is this a bug?
LtECoD commentedon Jan 13, 2023
Even when i set the gly_cbeta to true by
i still cannot get the N:CA bond length of GLY.
LtECoD commentedon Jan 13, 2023
It seems that N:CA length doesn't take effect in "internal_coord_to_atom_coordindates", since the atom coordinates keep unchanged after the N:CA length is set to other values.
rob-miller commentedon Jan 13, 2023
rob-miller commentedon Jan 13, 2023
However there is a bug related to this for set_length() on a backbone bond, causing some atom coordinates to not be updated as you found.
This fix has now been added to #3898, to work around it on the current code base you would need to change values directly in the IC_Chain.hedra dictionary. If you need/want to do this, you should know that the problem comes from multiple hedra specifying the same bond, e.g. N:CA or CA:C, and the value needs to be updated in all of them. Another option might be look at the #3898 fix to IC_Residue.pick_length() and monkey patch that on your installation.