-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathpkl2sdf.py
More file actions
executable file
·29 lines (21 loc) · 824 Bytes
/
pkl2sdf.py
File metadata and controls
executable file
·29 lines (21 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python3
import argparse
from rdkit import Chem
from read_input import read_input
def calc(input_fname, output_fname):
w = Chem.SDWriter(output_fname)
for mol, mol_name in read_input(input_fname):
mol.SetProp('_Name', mol_name)
for conf in mol.GetConformers():
w.write(mol, conf.GetId())
w.close()
def main():
parser = argparse.ArgumentParser(description='Convert multi-conformer PKL file to SDF.')
parser.add_argument('-i', '--input', metavar='input.pkl', required=True,
help='input SDF file.')
parser.add_argument('-o', '--output', metavar='output.sdf', required=True,
help='output pickle file.')
args = parser.parse_args()
calc(args.input, args.output)
if __name__ == '__main__':
main()