本文整理汇总了Python中rdkit.Chem.Draw.MolDrawing.DrawingOptions.radicalSymbol方法的典型用法代码示例。如果您正苦于以下问题:Python DrawingOptions.radicalSymbol方法的具体用法?Python DrawingOptions.radicalSymbol怎么用?Python DrawingOptions.radicalSymbol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rdkit.Chem.Draw.MolDrawing.DrawingOptions
的用法示例。
在下文中一共展示了DrawingOptions.radicalSymbol方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MolToFile
# 需要导入模块: from rdkit.Chem.Draw.MolDrawing import DrawingOptions [as 别名]
# 或者: from rdkit.Chem.Draw.MolDrawing.DrawingOptions import radicalSymbol [as 别名]
def MolToFile(mol, fileName, size=(300, 300), kekulize=True, wedgeBonds=True,
imageType=None, fitImage=False, options=None, **kwargs):
""" Generates a drawing of a molecule and writes it to a file
"""
# original contribution from Uwe Hoffmann
if not fileName:
raise ValueError('no fileName provided')
if not mol:
raise ValueError('Null molecule provided')
if imageType is None:
imageType = os.path.splitext(fileName)[1][1:]
if options is None:
options = DrawingOptions()
useAGG, useCairo, Canvas = _getCanvas()
if fitImage:
options.dotsPerAngstrom = int(min(size) / 10)
options.wedgeDashedBonds = wedgeBonds
if useCairo or useAGG:
canvas = Canvas(size=size, imageType=imageType,
fileName=fileName)
else:
# <- the sping canvas doesn't support unicode well
options.radicalSymbol = '.'
canvas = Canvas(size=size, name=fileName, imageType=imageType)
drawer = MolDrawing(canvas=canvas, drawingOptions=options)
if kekulize:
from rdkit import Chem
mol = Chem.Mol(mol.ToBinary())
Chem.Kekulize(mol)
if not mol.GetNumConformers():
from rdkit.Chem import AllChem
AllChem.Compute2DCoords(mol)
drawer.AddMol(mol, **kwargs)
if useCairo or useAGG:
canvas.flush()
else:
canvas.save()