rotamer_pdb.py is a script demonstrating the usage of RotamerCalculator and RotamerLibrary. It reads a PDB file and a rotamer library file, and tries to rotate the atoms based on the most probable chi angles from the rotamer library. Then it saves the rotated atoms to a specified output PDB file.
Usage:
python rotamer_pdb.py -i <input>.pdb -l <rotamer_library>.lib -o <output>.pdb
Example (the result will be saved into transformed_1z5s_A.pdb):
../../../tools/imppy.sh python rotamer_pdb.py -i ../../atom/test/input/1z5s_A.pdb \ -l /path/to/ALL.bbdep.rotamers.lib -o transformed_1z5s_A.pdb
20 from __future__
import print_function
29 def transform(input_pdb, input_lib, output_pdb):
32 rl.read_library_file(input_lib)
42 rc.transform(orig_h, hps, 0.9, 1e-6, 6)
54 if __name__ ==
'__main__':
59 P.add_option(
'--input_pdb',
'-i', action=
'store', type=
'string',
60 help=
'input PDB file (required)')
61 P.add_option(
'--input_lib',
'-l', action=
'store', type=
'string',
62 help=
'input rotamer library file (required)')
63 P.add_option(
'--output_pdb',
'-o', action=
'store', type=
'string',
64 help=
'output PDB file (required)')
65 P.add_option(
'--verbose',
'-v', action=
'store_true',
66 help=
'show more messages')
67 opts, args = P.parse_args()
69 not (opts.input_pdb
or opts.input_lib
or opts.output_pdb):
72 if not opts.input_pdb:
73 print(
'--input_pdb is required')
75 if not opts.output_pdb:
76 print(
'--output_pdb is required')
78 if not opts.input_lib:
79 print(
'--input_lib is required')
85 transform(opts.input_pdb, opts.input_lib, opts.output_pdb)