當前位置: 首頁>>代碼示例>>Python>>正文


Python DrawingOptions.radicalSymbol方法代碼示例

本文整理匯總了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()
開發者ID:mnowotka,項目名稱:rdkit,代碼行數:43,代碼來源:__init__.py


注:本文中的rdkit.Chem.Draw.MolDrawing.DrawingOptions.radicalSymbol方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。