Files
rdkit/Code/GraphMol/RGroupDecomposition/test_data/View datasets.ipynb
Greg Landrum 52c83c45f0 Add some more comprehensive R-Group Decomposition tests (#3778)
* start to add some human-readable regression-test like examples for RGD

* small examples from JMedChem

* add helper viewer

* make that generate actual JSON

* use JSON of full output for tests
move JSON generation to RGroupUtils.h

* switch to using JSON from files

* add test notebook

* add jupyter testing to the code

* add nbval to linux test env

* add notebook tests to mac and windows too

* add toJSON for columns too
2021-02-05 10:35:32 +01:00

105 lines
2.4 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2021.03.1dev1\n"
]
}
],
"source": [
"from rdkit import Chem\n",
"from rdkit.Chem import Draw\n",
"from rdkit.Chem.Draw import IPythonConsole\n",
"from rdkit.Chem import rdDepictor\n",
"IPythonConsole.molSize = (350,300)\n",
"IPythonConsole.drawOptions.centreMoleculesBeforeDrawing=True\n",
"import rdkit\n",
"print(rdkit.__version__)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"from ipywidgets import interact\n",
"import glob"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "cd503bbc3249487d9e5d0afc0c97e130",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(Dropdown(description='fn', options=('jm7b00306.excerpt.sdf', 'jm200186n.excerpt.sdf', 's…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"_lastFn = None\n",
"_lastMols = None\n",
"fns = glob.glob('*.sdf')\n",
"@interact(fn=fns,start='0',molsPerPage=range(4,24,4))\n",
"def show_mols(fn,start,molsPerPage=12):\n",
" global _lastFn\n",
" global _lastMols\n",
" if fn==_lastFn:\n",
" mols = _lastMols\n",
" else:\n",
" mols = [x for x in Chem.SDMolSupplier(fn) if x is not None]\n",
" _lastMols = mols\n",
" _lastFn = fn\n",
" start = int(start)\n",
" return Draw.MolsToGridImage(mols[start:start+molsPerPage],molsPerRow=4)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 4
}