打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
开源化学信息学库 :ScaffoldGraph

ScaffoldGraph是一个开放源代码化学信息库,使用RDKit和NetworkX构建,用于生成和分析骨架网络和支架树。

1

特点

  • 骨架网络生成(Varin, 2011)

    通过迭代删除可用环来探索骨架空间,从而为一组输入分子生成所有可能的子骨架。输出是分子骨架的有向无环图。

  • HierS网络生成(Wilkens,2005年)

    通过迭代移除可用环来探索骨架空间,生成所有可能的子骨架,而不会剖析稠密的环系统。

  • 骨架树生成(Schuffenhauer,2007)

    通过从分子骨架中反复去除特征最少的环来探索骨架空间。输出是一棵分子骨架树。

  • Murcko片段生成(Bemis,1996年)

    通过迭代去除可用环,为分子生成一组murcko片段。

  • 化合物集富集(瓦林,2010,2011)

    从初步筛选数据中识别出活性化学系列。

2

与现有软件的比较

  • 骨架网络生成器(SNG)(Matlock 2013)

  • 骨架 Hunter(SH)(Wetzel,2009)

  • 骨架树生成器(STG)(SH CLI predecessor)

3

安装

ScaffoldGraph目前仅支持Python 3

conda安装

conda config --add channels conda-forge 

conda install -c uclcheminformatics scaffoldgraph

pip安装

pip install scaffoldgraph

4

ScaffoldGraph例:骨架网络与骨架树

导入库

import scaffoldgraph as sg
import networkx as nximport matplotlib.pyplot as pltfrom rdkit.Chem import Drawfrom rdkit import Chemimport randomimport os

载入数据,绘制分子

sdf_file = os.path.dirname(sg.__file__).replace('scaffoldgraph', 'examples/example.sdf') # Example SDF file (200 PubChem compounds)supplier = Chem.SDMolSupplier(sdf_file)
peek = 6Draw.MolsToGridImage([supplier[x] for x in range(peek)])

骨架网络‍

生成骨架网络

network = sg.ScaffoldNetwork.from_sdf(sdf_file, progress=True)# We can access the number of molecule nodes and scaffold nodes in the graphn_scaffolds = network.num_scaffold_nodesn_molecules = network.num_molecule_nodes
print('\nGenerated scaffold network from {} molecules with {} scaffolds\n'.format(n_molecules, n_scaffolds))

绘制骨架网络

scaffolds = list(network.get_scaffold_nodes())print(scaffolds[0:5])
# Visualize a few of the scaffoldssample = 6Draw.MolsToGridImage([Chem.MolFromSmiles(x) for x in scaffolds[:sample]])

骨架分布

counts = network.get_hierarchy_sizes()  # returns a collections Counter objectlists = sorted(counts.items())x, y = zip(*lists)
# Plot sizes as bar chartplt.figure(figsize=(8, 6))plt.bar(x, y)plt.xlabel('Hierarchy')plt.ylabel('Scaffold Count')plt.title('Number of Scaffolds per Hierarchy (Network)')plt.show()

骨架匹配与高亮

query_smiles = 'c1ccncc1'  # lets use this subscaffold as a queryquery_mol = Chem.MolFromSmiles(query_smiles)
next_scaffolds = []for succ in network.successors(query_smiles): if network.nodes[succ]['type'] == 'scaffold': next_scaffolds.append(succ)
print('Found {} scaffolds in hierarchy 2 containing {}:'.format(len(next_scaffolds), query_smiles))
mols = [Chem.MolFromSmiles(x) for x in next_scaffolds[:6]]Draw.MolsToGridImage(mols, highlightAtomLists=[mol.GetSubstructMatch(query_mol) for mol in mols])

分子匹配与高亮

molecules = []for succ in nx.bfs_tree(network, query_smiles, reverse=False):    if network.nodes[succ]['type'] == 'molecule':        molecules.append(succ)
print('Found {} molecules containing scaffold, {}\n'.format(len(molecules), query_smiles))
# Molecules are PubChem IDs so lets get the SMILES and view som of the molecules
smiles = [network.nodes[pid]['smiles'] for pid in molecules]mols = [Chem.MolFromSmiles(smi) for smi in smiles]
Draw.MolsToGridImage(mols, highlightAtomLists=[mol.GetSubstructMatch(query_mol) for mol in mols], legends=molecules, maxMols=9)

骨架树

tree = sg.ScaffoldTree.from_sdf(sdf_file, progress=True)# access the number of molecule nodes and scaffold nodes in the graphn_scaffolds = tree.num_scaffold_nodesn_molecules = tree.num_molecule_nodes
print('\nGenerated scaffold tree from {} molecules with {} scaffolds\n'.format(n_molecules, n_scaffolds))
# The output is a forest structure (multiple trees)print('Graph is a Forest:', nx.is_forest(tree))

绘制分子骨架树

random_pubchem_id = random.choice(list(tree.get_molecule_nodes()))print('PubChem ID:', random_pubchem_id)predecessors = nx.bfs_tree(tree, random_pubchem_id, reverse=True)
# We can validate that one molecules scaffold set forms a tree structureprint('Predecessors of {} is Tree: {}'.format(random_pubchem_id, nx.is_tree(predecessors)))
# Draw these scaffoldspredecessors_list = list(predecessors)predecessors_list[0] = tree.nodes[predecessors_list[0]]['smiles'] # [0] is pubchem IDDraw.MolsToGridImage([Chem.MolFromSmiles(x) for x in predecessors_list])

DrugAI

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
R&D|Nature Communications
干货 | 化合物靶点预测工具一网打尽
easy ui tree 取复选框打勾的值 var nodes = $('#basetree').tree('getChecked');
想用C++写一个多叉树的结构
Working with XML
在Visual FoxPro中使用TreeView控件
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服