diff --git a/_notebooks/2021-12-20-substructlibrary-search-order.ipynb b/_notebooks/2021-12-20-substructlibrary-search-order.ipynb index 7275a2d..7d2b955 100644 --- a/_notebooks/2021-12-20-substructlibrary-search-order.ipynb +++ b/_notebooks/2021-12-20-substructlibrary-search-order.ipynb @@ -61,15 +61,17 @@ "metadata": {}, "source": [ "Here's the code to build the `SubstructLibrary` from the sdf file distributed by the ChEMBL team. \n", - "This uses a feature added in RDKit v2021.09 to allow a molecule key (or name) to be stored with the molecules in a `SubstructLibrary`.\n", + "This uses a feature added in RDKit v2021.09 to allow a molecule key (or name) to be stored with the molecules in a `SubstructLibrary`. Note you'll need to `pip install chembl_downloader` to run this block.\n", "\n", "Executing this takes about 45 minutes on my machine." ] }, { - "cell_type": "raw", + "cell_type": "markdown", "metadata": {}, "source": [ + "```python\n", + "import chembl_downloader\n", "RDLogger.DisableLog(\"rdApp.warning\")\n", "\n", "molholder = rdSubstructLibrary.CachedTrustedSmilesMolHolder()\n", @@ -79,7 +81,8 @@ "keys = rdSubstructLibrary.KeyFromPropHolder() \n", "slib = rdSubstructLibrary.SubstructLibrary(molholder,patts,keys)\n", "t1 = time.time()\n", - "with gzip.GzipFile('/home/glandrum/Downloads/chembl_29.sdf.gz') as gz, Chem.ForwardSDMolSupplier(gz) as suppl:\n", + "sdf_path = chembl_downloader.download_sdf(version=\"29\")\n", + "with gzip.open(sdf_path) as gz, Chem.ForwardSDMolSupplier(gz) as suppl:\n", " nDone = 0\n", " for m in suppl:\n", " if m is None:\n", @@ -96,7 +99,7 @@ "print(f'That took {time.time()-t1:.2f}s in total.')\n", "with open('./results/chembl29_ssslib.pkl','wb+') as outf:\n", " pickle.dump(slib,outf)\n", - " " + "```" ] }, {