annotate PLIDflow/scripts/draw_mol.py @ 6:795e11fac81b draft default tip

Included new tools for standardization
author bitlab
date Wed, 22 Apr 2020 06:12:00 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
1 from rdkit import Chem
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
2 from rdkit.Chem import Draw
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
3
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
4 import sys
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
5
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
6
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
7 if(len(sys.argv) < 3):
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
8 print("Use: ", str(sys.argv[0]), " <chain in smiles> <output png>")
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
9 sys.exit(-1)
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
10
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
11 chainfile = str(sys.argv[1])
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
12 output = str(sys.argv[2])
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
13
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
14 print(chainfile)
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
15 print(output)
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
16
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
17 with open(chainfile) as f:
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
18 chain = f.readline()
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
19
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
20
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
21 mol = Chem.MolFromSmiles(chain)
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
22
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
23 Draw.MolToFile(mol, output)
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
24
795e11fac81b Included new tools for standardization
bitlab
parents:
diff changeset
25