{ "cells": [ { "cell_type": "markdown", "id": "b73a0c39-48d2-43fc-94b1-bb16b5301631", "metadata": { "tags": [] }, "source": [ "# Using the JSME widget\n", "\n", "We will first import the `trident_chemwidgets` package." ] }, { "cell_type": "code", "execution_count": null, "id": "329c257f-0c79-418d-b08b-d66c8cb0a548", "metadata": {}, "outputs": [], "source": [ "import trident_chemwidgets as tcw" ] }, { "cell_type": "markdown", "id": "0151a38f-dc5a-42c7-92f1-6f61ff35a6a8", "metadata": {}, "source": [ "We can the use the `JSME` widget provided by `tcw` to launch an instance of the JSME molecule editor directly in the cell." ] }, { "cell_type": "code", "execution_count": null, "id": "2cbb25a6-aea2-4995-85e0-fbf9bcaddf97", "metadata": {}, "outputs": [], "source": [ "j = tcw.JSME()\n", "j" ] }, { "cell_type": "markdown", "id": "338a03b8-6e19-4f1d-b3b3-ebdb53ee9bbb", "metadata": {}, "source": [ "The JSME widget offers a few extensions over the base `JSME` interface. First, it can store a list of input molecules. You can add to this list by hitting the `ADD TO SMILES LIST` button below the interface once a desired structure has been input. Note that the interface will not clear when this button is hit, in case you would like to add derivative molecules to the input list as well. A depiction of the structure, and all others that have been added to the saved internal molecule list will be displayed in the gallery to the right. You can access the list of input smiles using the `smiles` property of the widget, as shown below." ] }, { "cell_type": "code", "execution_count": null, "id": "af60622f-61a8-4616-bf95-f7a724d13150", "metadata": {}, "outputs": [], "source": [ "j.smiles" ] }, { "cell_type": "markdown", "id": "0d9c9188-10f6-4771-ba9a-a3e038e0c093", "metadata": {}, "source": [ "### Using a base SMILES string for derivative molecules\n", "\n", "The second extended feature of the `tcw` implementation of JSME is the ability to define a base SMILES string for your input. This feature is particularly helpful if you are defining a set of related molecules that are all derived from a similar scaffold. Below we set the SMILES string of ibuprofen as our base SMILES. Here, we can draw derivative compounds and add them to our list, as in the example above. However, since we have defined a base SMILES string, we also have the ability to reset the input window to this base molecule to draw in another derivative by clicking the `RESET TO BASE SMILES` button. " ] }, { "cell_type": "code", "execution_count": null, "id": "0061bf2b-681a-4794-bbfd-f949e27cd4e6", "metadata": {}, "outputs": [], "source": [ "j = tcw.JSME(base_smiles='CC(C)Cc1ccc(cc1)[C@@H](C)C(=O)O')\n", "j" ] }, { "cell_type": "markdown", "id": "2ce4a75e-6f14-4ce6-9a07-69f8353e819b", "metadata": {}, "source": [ "Here you can access your list of SMILES strings by using the `smiles` property, as in the example above. You can also access the base SMILES string using the `base_smiles` property." ] }, { "cell_type": "code", "execution_count": null, "id": "16bb3ee8-8f74-4df6-ac7d-7231e391d261", "metadata": {}, "outputs": [], "source": [ "j.smiles" ] }, { "cell_type": "code", "execution_count": null, "id": "8de6138d-95a4-4830-bb80-129b40ca30f9", "metadata": {}, "outputs": [], "source": [ "j.base_smiles" ] }, { "cell_type": "code", "execution_count": null, "id": "8ecd58cd-bf37-4cb5-a5c8-1740301db3f5", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.10.2" } }, "nbformat": 4, "nbformat_minor": 5 }