本文整理匯總了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()