Skip to content

Instantly share code, notes, and snippets.

@Alexhuszagh
Created September 5, 2016 00:22
Show Gist options
  • Save Alexhuszagh/155df91af93bafcda7efc33746dd39ab to your computer and use it in GitHub Desktop.
Save Alexhuszagh/155df91af93bafcda7efc33746dd39ab to your computer and use it in GitHub Desktop.
Align Matrix
'''
align_matrix
------------
Aligns two sturctures and prints the distance matrix (complete)
between the two aligned matrices.
:author: Alex Huszagh
:license: Unlicense, or MIT
'''
from pymol import cmd
def align_matrix(first, second):
'''
Align two structures and get the full alignment distance pair.
Args:
first - object name for first structure
second - object name for second structure
'''
cmd.super("%s & guide" %first, "%s & guide" %second, object="aln")
pairs = cmd.get_raw_alignment('aln')
for pair in pairs:
print(pair, cmd.get_distance(pair[0], pair[1]))
cmd.delete("aln")
cmd.extend('align_matrix', align_matrix)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment