From cf44f643da67b55ac30e858fcd3c87fcaa6a2fbf Mon Sep 17 00:00:00 2001 From: Mike Henry <11765982+mikemhenry@users.noreply.github.com> Date: Tue, 9 Jan 2024 17:02:02 -0700 Subject: [PATCH] Add deps to colab notebook (#32) * this should work... * fix colab bug * add batteries included env file * update notebook to use new env * forgot rdkit * oops made a mistake, rdkit is a dep for karto * looks like we can't pass in `--no-deps` --- examples/environment.yaml | 8 ++++ examples/kartograf_example.ipynb | 79 ++++++++++++++++++++++++++------ 2 files changed, 74 insertions(+), 13 deletions(-) create mode 100644 examples/environment.yaml diff --git a/examples/environment.yaml b/examples/environment.yaml new file mode 100644 index 0000000..82d34c8 --- /dev/null +++ b/examples/environment.yaml @@ -0,0 +1,8 @@ +channels: + - conda-forge +dependencies: + - kartograf >=1 + - openfe >=0.15 + - pip + - pip: + - git+https://github.com/OpenFreeEnergy/openfe-benchmarks.git diff --git a/examples/kartograf_example.ipynb b/examples/kartograf_example.ipynb index 8a51fb6..cfdd616 100644 --- a/examples/kartograf_example.ipynb +++ b/examples/kartograf_example.ipynb @@ -3,7 +3,10 @@ { "cell_type": "markdown", "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "source": [ "# Example Notebook: Atom Mappings\n", @@ -17,6 +20,25 @@ "with well aligned conformations." ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# NBVAL_SKIP\n", + "# Only run this cell if on google colab\n", + "import os\n", + "if \"COLAB_RELEASE_TAG\" in os.environ:\n", + " !pip install -U https://github.com/conda-incubator/condacolab/archive/cuda-version-12.tar.gz\n", + " import condacolab\n", + " condacolab.install_mambaforge()\n", + " !wget -q https://raw.githubusercontent.com/OpenFreeEnergy/kartograf/main/examples/environment.yaml\n", + " !mamba env update -q --name=base --file=environment.yaml\n", + " from google.colab import output\n", + " output.enable_custom_widget_manager()" + ] + }, { "cell_type": "code", "execution_count": 2, @@ -36,10 +58,10 @@ " Cloning https://github.com/OpenFreeEnergy/openfe-benchmarks.git to /tmp/pip-req-build-dsih_khc\n", " Running command git clone --filter=blob:none --quiet https://github.com/OpenFreeEnergy/openfe-benchmarks.git /tmp/pip-req-build-dsih_khc\n", " Resolved https://github.com/OpenFreeEnergy/openfe-benchmarks.git to commit d81c79273b88f9b3baddd9886097789151e3df39\n", - " Preparing metadata (setup.py) ... \u001B[?25ldone\n", - "\u001B[?25hBuilding wheels for collected packages: openfe-benchmarks\n", - " Building wheel for openfe-benchmarks (setup.py) ... \u001B[?25ldone\n", - "\u001B[?25h Created wheel for openfe-benchmarks: filename=openfe_benchmarks-0.0.0-py2.py3-none-any.whl size=1338664 sha256=156abe05cd092abb61d261190aa89c60dc9084f1ad2bb96e4ecba6eaf90e1c1e\n", + " Preparing metadata (setup.py) ... \u001b[?25ldone\n", + "\u001b[?25hBuilding wheels for collected packages: openfe-benchmarks\n", + " Building wheel for openfe-benchmarks (setup.py) ... \u001b[?25ldone\n", + "\u001b[?25h Created wheel for openfe-benchmarks: filename=openfe_benchmarks-0.0.0-py2.py3-none-any.whl size=1338664 sha256=156abe05cd092abb61d261190aa89c60dc9084f1ad2bb96e4ecba6eaf90e1c1e\n", " Stored in directory: /tmp/pip-ephem-wheel-cache-jp81fv_5/wheels/3d/2e/0d/a9d202ebefb2df685d9ab7255081f70a7ace5ff45bcdd698d2\n", "Successfully built openfe-benchmarks\n", "Installing collected packages: openfe-benchmarks\n", @@ -78,10 +100,20 @@ "Chem.Draw.MolsToGridImage([c.to_rdkit() for c in components])\n" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "markdown", "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "source": [ "## Generate Atom Mappings with Kartograf:\n", @@ -98,6 +130,9 @@ "start_time": "2023-11-06T00:01:55.473133240Z" }, "collapsed": false, + "jupyter": { + "outputs_hidden": false + }, "scrolled": true }, "outputs": [ @@ -284,7 +319,10 @@ "end_time": "2023-11-06T00:01:55.817641995Z", "start_time": "2023-11-06T00:01:55.741239258Z" }, - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "outputs": [ { @@ -310,7 +348,10 @@ { "cell_type": "markdown", "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "source": [ "## Scoring Metrics for Atom mappings:\n", @@ -327,7 +368,10 @@ "end_time": "2023-11-06T00:01:55.951440479Z", "start_time": "2023-11-06T00:01:55.813431246Z" }, - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "outputs": [ { @@ -434,7 +478,10 @@ "end_time": "2023-11-06T00:01:56.139870575Z", "start_time": "2023-11-06T00:01:55.943210488Z" }, - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "outputs": [ { @@ -464,7 +511,10 @@ "end_time": "2023-11-06T00:01:59.231030094Z", "start_time": "2023-11-06T00:01:56.163961283Z" }, - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "outputs": [ { @@ -522,7 +572,10 @@ "end_time": "2023-11-06T00:01:59.231424281Z", "start_time": "2023-11-06T00:01:59.224933917Z" }, - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "outputs": [], "source": [] @@ -544,7 +597,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.7" + "version": "3.12.0" } }, "nbformat": 4,