Skip to content

Instantly share code, notes, and snippets.

@collinarnett
Created May 12, 2020 18:59
Show Gist options
  • Save collinarnett/484c800210454efecfa980990320a6c6 to your computer and use it in GitHub Desktop.
Save collinarnett/484c800210454efecfa980990320a6c6 to your computer and use it in GitHub Desktop.
Create alpha-carbon distance maps
def calc_dist_matrix(residues):
"""Returns a matrix of distances between residues of the same chain."""
size = len(residues)
answer = np.zeros((size, size), np.float)
for row, residue_one in enumerate(residues):
for col, residue_two in enumerate(residues):
answer[row, col] = residue_one["CA"] - residue_two["CA"]
return answer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment