Skip to content

Commit

Permalink
Add to Cookbook "Include a Bond Index" recipe and image (rdkit#7939)
Browse files Browse the repository at this point in the history
* Add "Include a Bond Index" recipe and image

* Add testoutput so doctest passes

* Use addBondIndices. Follow template of recipe "Include an Atom Index".
  • Loading branch information
bertiewooster authored Oct 22, 2024
1 parent 2553cfc commit f29dd30
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion Docs/Book/Cookbook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Alternatively, you can also send Cookbook revisions and addition requests to the

The Index ID# (e.g., **RDKitCB_##**) is simply a way to track Cookbook entries and image file names.
New Cookbook additions are sequentially index numbered, regardless of where they are placed
within the document. As such, for reference, the next Cookbook entry is **RDKitCB_40**.
within the document. As such, for reference, the next Cookbook entry is **RDKitCB_41**.

Drawing Molecules (Jupyter)
*******************************
Expand Down Expand Up @@ -104,6 +104,40 @@ indices are now near the atom, rather than at the atom position.
.. image:: images/RDKitCB_0_im2.png


Include a Bond Index
======================

| **Author:** Jeremy Monat
| **Source:** Direct contribution to Cookbook
| **Index ID#:** RDKitCB_40
| **Summary:** Draw a molecule with bond index numbers.
.. testcode::

from rdkit import Chem
from rdkit.Chem import Draw
from rdkit.Chem.Draw import IPythonConsole
IPythonConsole.ipython_useSVG=True #< set this to False if you want PNGs instead of SVGs

.. testcode::

# Test in a kinase inhibitor
mol = Chem.MolFromSmiles("C1CC2=C3C(=CC=C2)C(=CN3C1)[C@H]4[C@@H](C(=O)NC4=O)C5=CNC6=CC=CC=C65")
# Default
mol

.. image:: images/RDKitCB_40_im0.png

.. testcode::

# Add bond indices
IPythonConsole.drawOptions.addBondIndices = True
IPythonConsole.molSize = 350,300
mol

.. image:: images/RDKitCB_40_im1.png
:scale: 75%

Include a Calculation
======================

Expand Down
Binary file added Docs/Book/images/RDKitCB_40_im0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Docs/Book/images/RDKitCB_40_im1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f29dd30

Please sign in to comment.