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):
python rotamer_pdb.py -i ../../atom/test/input/1z5s_A.pdb \ -l /path/to/ALL.bbdep.rotamers.lib -o transformed_1z5s_A.pdb
27 def transform(input_pdb, input_lib, output_pdb):
30 rl.read_library_file(input_lib)
40 rc.transform(orig_h, hps, 0.9, 1e-6, 6)
52 if __name__ ==
'__main__':
57 P.add_argument(
'--input_pdb',
'-i', action=
'store',
58 help=
'input PDB file (required)')
59 P.add_argument(
'--input_lib',
'-l', action=
'store',
60 help=
'input rotamer library file (required)')
61 P.add_argument(
'--output_pdb',
'-o', action=
'store',
62 help=
'output PDB file (required)')
63 P.add_argument(
'--verbose',
'-v', action=
'store_true',
64 help=
'show more messages')
67 not (args.input_pdb
or args.input_lib
or args.output_pdb):
70 if not args.input_pdb:
71 print(
'--input_pdb is required')
73 if not args.output_pdb:
74 print(
'--output_pdb is required')
76 if not args.input_lib:
77 print(
'--input_lib is required')
83 transform(args.input_pdb, args.input_lib, args.output_pdb)