IMP  2.0.1
The Integrative Modeling Platform
rmsd.py
1 #!/usr/bin/env python
2 
3 __doc__ = "Calculate RMSD between a model and the reference."
4 
5 import IMP.cnmultifit
6 from optparse import OptionParser
7 
8 def parse_args():
9  usage = """%prog [options] <parameter file> <transformations file>
10  <reference PDB>
11 
12 This program calculates the RMSD between modeled cyclic symmetric complexes and
13 the reference structure. The RMSD and cross correlation of each complex is
14 written into a file called rmsd.output.
15 
16 Notice: no structural alignment is performed!"""
17 
18  parser = OptionParser(usage)
19  parser.add_option("--vec", dest="vec", default="", metavar="FILE",
20  help="output the RMSDs as a vector into the named "
21  "file, if specified")
22  parser.add_option("--start", dest="start", default=0, type="int",
23  help="first model in transformations file to compare "
24  "with the reference (by default, model 0)")
25  parser.add_option("--end", dest="end", default=-1, type="int",
26  help="last model in transformations file to compare "
27  "with the reference (by default, the final model)")
28  (options, args) = parser.parse_args()
29  if len(args) != 3:
30  parser.error("incorrect number of arguments")
31  return options, args
32 
33 def main():
34  opts, args = parse_args()
35  IMP.base.set_log_level(IMP.WARNING)
36  rmsds = IMP.cnmultifit.get_rmsd_for_models(args[0], args[1], args[2],
37  opts.start, opts.end)
38  if opts.vec:
39  open(opts.vec, 'w').write(" ".join(['%f' % x for x in rmsds]))
40 
41 if __name__ == '__main__':
42  main()