-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtopng.py
28 lines (23 loc) · 901 Bytes
/
topng.py
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
from ddt.utility import SmilesToImage, SDFToImage
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description="Convert SMILES to PNG")
input = parser.add_mutually_exclusive_group(required=True)
input.add_argument(
"--smiles", action="store", dest="smiles", required=False, help="SMILES string",
)
input.add_argument(
"--sdf", action="store", dest="sdf", help="SDF file",
)
parser.add_argument(
"--out", action="store", dest="out", required=True, help="PNG file location"
)
args = parser.parse_args()
if args.smiles:
stoi = SmilesToImage(args.smiles)
stoi.toPNG(output=args.out)
# stoi.toPNG(output=args.out, get_binary=True)
if args.sdf:
stoi = SDFToImage(args.sdf)
stoi.toPNG(output=args.out, max=8)
# stoi.toPNG(output=args.out, get_binary=True)