Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #RMSD skaiciavimas
- #VR
- #pagal dockedpse.py is github
- #naudojimas: ./dockedpose.py kristalo.pdb docked.pdb
- import math
- import pybel
- import sys
- def squared_distance(coordsA, coordsB):
- """Find the squared distance between two 3-tuples"""
- sqrdist = sum( (a-b)**2 for a, b in zip(coordsA, coordsB) )
- return sqrdist
- def rmsd(allcoordsA, allcoordsB):
- """Find the RMSD between two lists of 3-tuples"""
- deviation = sum(squared_distance(atomA, atomB) for
- (atomA, atomB) in zip(allcoordsA, allcoordsB))
- return math.sqrt(deviation / float(len(allcoordsA)))
- #if __name__ == "__main__":
- crystal = next(pybel.readfile("pdb", sys.argv[1]))
- dockedpose = next(pybel.readfile("pdb", sys.argv[2]))
- xtalcoords = [atom.coords for atom in crystal if not atom.OBAtom.IsHydrogen()]
- #for i, dockedpose in enumerate(pybel.readfile("pdb", sys.argv[1])):
- posecoords = [atom.coords for atom in dockedpose if not atom.OBAtom.IsHydrogen()]
- mrmsd = rmsd(posecoords, xtalcoords)
- print mrmsd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement