From b6084120bce152b22d57df23f64a20a0d1b5fff0 Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Tue, 21 Dec 2021 08:13:37 -0500 Subject: [PATCH 1/2] Demonstrating using chembl_downloader to get SDF path --- .../2021-12-20-substructlibrary-search-order.ipynb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/_notebooks/2021-12-20-substructlibrary-search-order.ipynb b/_notebooks/2021-12-20-substructlibrary-search-order.ipynb index 7275a2d..78a251a 100644 --- a/_notebooks/2021-12-20-substructlibrary-search-order.ipynb +++ b/_notebooks/2021-12-20-substructlibrary-search-order.ipynb @@ -67,9 +67,11 @@ ] }, { - "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", - " " + "```" ] }, { From b9624ff46391b21b1ca4c8a1669421a75ef4f767 Mon Sep 17 00:00:00 2001 From: Charles Tapley Hoyt Date: Tue, 21 Dec 2021 08:18:09 -0500 Subject: [PATCH 2/2] Update 2021-12-20-substructlibrary-search-order.ipynb --- _notebooks/2021-12-20-substructlibrary-search-order.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_notebooks/2021-12-20-substructlibrary-search-order.ipynb b/_notebooks/2021-12-20-substructlibrary-search-order.ipynb index 78a251a..7d2b955 100644 --- a/_notebooks/2021-12-20-substructlibrary-search-order.ipynb +++ b/_notebooks/2021-12-20-substructlibrary-search-order.ipynb @@ -61,7 +61,7 @@ "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." ]