drawTopicModel.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:CheTo 作者: rdkit 项目源码 文件源码
def drawMolsByLabel(topicModel, label, idLabelToMatch=0, baseRad=0.5, molSize=(250,150),\
                    numRowsShown=3, tableHeader='', maxMols=100):

    result = generateMoleculeSVGsbyLabel(topicModel, label, idLabelToMatch=idLabelToMatch,baseRad=baseRad,\
                                                              molSize=molSize, maxMols=maxMols)
    if len(result)  == 1:
        print(result)
        return

    svgs, namesSVGs = result
    finalsvgs = []
    for svg in svgs:
        # make the svg scalable
        finalsvgs.append(svg.replace('<svg','<svg preserveAspectRatio="xMinYMin meet" viewBox="0 0 '+str(molSize[0])\
                                     +' '+str(molSize[1])+'"'))

    return display(HTML(utilsDrawing.drawSVGsToHTMLGrid(finalsvgs[:maxMols],cssTableName='overviewTab',tableHeader='Molecules of '+str(label),
                                                 namesSVGs=namesSVGs[:maxMols], size=molSize, numRowsShown=numRowsShown, numColumns=4)))

# produces a svg grid of the molecules of a certain label and highlights the most probable topic
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号