使用 OpenEye 生成小分子构象库 - 详细步骤与代码示例
以下是使用 OpenEye 工具生成小分子构象库的命令,适用于初始为 SDF 格式的小分子:
- 将 SDF 格式的小分子文件转换为 OpenEye 的 mol2 格式:
obabel input.sdf -O output.mol2
- 生成小分子的初始构象:
omega -in input.mol2 -out output.mol2 -prefix output_conformers -conftest -maxconfs 1000
其中,'-maxconfs' 指定最大生成构象数,可以根据需要进行调整。
- 使用 OEMol 的 ConformerGenerator 生成更多构象:
from openeye import oechem
from openeye import oedepict
from openeye import oeomega
# 加载 mol2 文件
ifs = oechem.oemolistream()
ifs.open('output.mol2')
# 创建 ConformerGenerator 对象
omega = oeomega.OEOmega()
omega.SetMaxConfs(1000)
omega.SetIncludeInput(False)
omega.SetStrictStereo(True)
# 遍历分子文件,生成构象
for mol in ifs.GetOEMols():
omega(mol)
oechem.OEWriteMolecule(ifs, mol)
这个命令将生成更多的构象,并将它们添加到 mol2 文件中。
- 可以使用 OEDepict 库将构象可视化:
# 加载 mol2 文件
ifs = oechem.oemolistream()
ifs.open('output.mol2')
# 创建 OEDepict 对象
opts = oedepict.OE2DMolDisplayOptions(500, 500, oedepict.OEScale_AutoScale)
disp = oedepict.OE2DMolDisplay()
# 遍历分子文件,可视化构象
for mol in ifs.GetOEMols():
for conf in mol.GetConfs():
oedepict.OEPrepareDepiction(mol)
disp.Clear()
oedepict.OEAddMolecule(disp, mol, oedepict.OEHighlightStyle_Stick)
oedepict.OEAddStickAndBallOverlay(disp, conf)
oedepict.OERenderMolecule('conformer_%s.png' % conf.GetIdx(), disp, opts)
这个命令将为每个构象生成一个 PNG 图像文件。
原文地址: https://www.cveoy.top/t/topic/gvii 著作权归作者所有。请勿转载和采集!