26 def transform(input_pdb, input_lib, output_pdb):
34 rl.read_library_file(input_lib)
40 rd = h.get_as_residue()
41 rr = rc.get_rotamer(rd, 0.01)
42 rotamers.append((rd, rr))
45 for rd, rr
in rotamers:
48 at_t = at.get_atom_type()
49 if rr.get_atom_exists(at_t):
51 idx = min(rr.get_number_of_cases(at_t) - 1, 1)
52 v = rr.get_coordinates(idx, at_t)
54 xyz.set_coordinates(v)
66 if __name__ ==
'__main__':
71 P = optparse.OptionParser()
72 P.add_option(
'--input_pdb',
'-i', action=
'store', type=
'string',
73 help=
'input PDB file (required)')
74 P.add_option(
'--input_lib',
'-l', action=
'store', type=
'string',
75 help=
'input rotamer library file (required)')
76 P.add_option(
'--output_pdb',
'-o', action=
'store', type=
'string',
77 help=
'output PDB file (required)')
78 P.add_option(
'--verbose',
'-v', action=
'store_true',
79 help=
'show more messages')
80 P.add_option(
'--run_quick_test', action=
'store_true',
81 help=
'run quick test')
82 opts, args = P.parse_args()
83 if opts.run_quick_test
or \
84 not (opts.input_pdb
or opts.input_lib
or opts.output_pdb):
87 if not opts.input_pdb:
88 print '--input_pdb is required'
90 if not opts.output_pdb:
91 print '--output_pdb is required'
93 if not opts.input_lib:
94 print '--input_lib is required'
100 transform(opts.input_pdb, opts.input_lib, opts.output_pdb)