结合上篇博文,下面我们写一小段测试代码,用于将标准的iupac name转化成化学结构
这段代码使用到了ChemOffice中的ChemScript12模块。
ChemScript12模块是一个商业模块,提供Python和.Net接口,在安装ChemOffice的时候选择安装ChemScript,同时安装Python25。
1 from ChemScript12
import *
2
3 name_file=
'./name.txt'
4 sdf_file=
'./sdf_file.sdf'
5
6 writer=
SDFileWriter(sdf_file)
7
8 for line
in open(name_file):
9 print line
10 mol=StructureData().LoadData(line,
'name')
11 if writer.WriteStructure(mol)!=
True:
12 print '\n\t---------------\n\tCannot open "'+line+
'" as format: chemical/x-name\n\t---------------\n'
13
14 writer.Close()
转载于:https://www.cnblogs.com/chempython/p/3196040.html
相关资源:化学结构式绘图编辑软件(ChemDraw Std) v14.0.0.117