stacker.pairwise_distance.calculate_residue_distance

stacker.pairwise_distance.calculate_residue_distance#

calculate_residue_distance(trj, res1, res2, res1_atoms=('C2', 'C4', 'C6'), res2_atoms=('C2', 'C4', 'C6'), frame=1)[source]#

Calculates the vector between two residues with x, y, z units in Angstroms.

Calculates the distance between the center of two residues. The center is defined by the average x, y, z position of three passed atoms for each residue (typically every other carbon on the 6-carbon ring of the nucleotide base).

Parameters:
trjmd.Trajectory

Single frame trajectory.

res1int

1-indexed residue number of the first residue (PDB Column 5).

res2int

1-indexed residue number of the second residue (PDB Column 5).

res1_atomstuple, default=(“C2”, “C4”, “C6”)

Atom names whose positions are averaged to find the center of residue 1.

res2_atomstuple, default=(“C2”, “C4”, “C6”)

Atom names whose positions are averaged to find the center of residue 2.

frameint, default=1

1-indexed frame number of trajectory to calculate the distance.

Returns:
distance_res12Vector

Vector from the center of geometry of residue 1 to residue 2.

See also

get_residue_distance_for_frame

Calculates pairwise distances between all residues in a given frame.

Examples

>>> import stacker as st
>>> filtered_traj = st.filter_traj('testing/first10_5JUP_N2_tUAG_aCUA_+1GCU_nowat.mdcrd', 
...                              'testing/5JUP_N2_tUAG_aCUA_+1GCU_nowat.prmtop', 
...                              residues = {426,427}, 
...                              atoms = {'C2','C4','C6'})
WARNING: Residue Indices are expected to be 1-indexed
Reading trajectory...
Reading topology...
Filtering trajectory...
WARNING: Output filtered traj atom, residue, and chain indices are zero-indexed
>>> distance_vec = st.calculate_residue_distance(
...     trajectory=filtered_traj, 
...     res1_num=426, 
...     res2_num=427, 
...     res1_atoms=("C2", "C4", "C6"), 
...     res2_atoms=("C2", "C4", "C6"), 
...     frame=1
... )
>>> distance_vec.magnitude()
7.5253396