1

Suppose, we have a protein (16PK).

We are considering a 5-residue segment/window.

If we assume ASN10 to be the ith residue, how can I calculate the following distances in Python?

  1. from [i+2] to [i-2]
  2. from [i+1] to [i-2]
  3. from [i+2] to [i-1]

Next major question is, what would be the distances like if my segment/window is 7 or 9 residues long?

user366312
  • 654
  • 2
  • 14
  • See this question for recommendations on a number of tools to calculate such distances: https://bioinformatics.stackexchange.com/questions/783/how-can-we-find-the-distance-between-all-residues-in-a-pdb-file – jgreener Sep 06 '21 at 11:28

1 Answers1

2

Your $[i,j,k]$ coordinates in the PDB file are coordinates. You can readily compute Euclidean distances between any pair of coordinates as described in the wiki page:

$d(p,q)=\sqrt{(p_1-q_1)^2 + (p_2-q_2)^2 + (p_3-q_3)^2}. $

This resource suggests one such approach (code reproduced below in case that site stops existing):

import Bio.PDB
import numpy

def calc_residue_dist(residue_one, residue_two) : """Returns the C-alpha distance between two residues""" diff_vector = residue_one["CA"].coord - residue_two["CA"].coord return numpy.sqrt(numpy.sum(diff_vector * diff_vector))

Maximilian Press
  • 3,989
  • 7
  • 23