# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """TODO: File Description""" import json import glob import gzip import os import datasets # Using https://www.bibtex.com/c/doi-to-bibtex-converter/ (doi: 10.1093/nar/gkv951) _CITATION = """\ @ARTICLE{Kim2016-sz, title = "{PubChem} Substance and Compound databases", author = "Kim, Sunghwan and Thiessen, Paul A and Bolton, Evan E and Chen, Jie and Fu, Gang and Gindulyte, Asta and Han, Lianyi and He, Jane and He, Siqian and Shoemaker, Benjamin A and Wang, Jiyao and Yu, Bo and Zhang, Jian and Bryant, Stephen H", abstract = "PubChem (https://pubchem.ncbi.nlm.nih.gov) is a public repository for information on chemical substances and their biological activities, launched in 2004 as a component of the Molecular Libraries Roadmap Initiatives of the US National Institutes of Health (NIH). For the past 11 years, PubChem has grown to a sizable system, serving as a chemical information resource for the scientific research community. PubChem consists of three inter-linked databases, Substance, Compound and BioAssay. The Substance database contains chemical information deposited by individual data contributors to PubChem, and the Compound database stores unique chemical structures extracted from the Substance database. Biological activity data of chemical substances tested in assay experiments are contained in the BioAssay database. This paper provides an overview of the PubChem Substance and Compound databases, including data sources and contents, data organization, data submission using PubChem Upload, chemical structure standardization, web-based interfaces for textual and non-textual searches, and programmatic access. It also gives a brief description of PubChem3D, a resource derived from theoretical three-dimensional structures of compounds in PubChem, as well as PubChemRDF, Resource Description Framework (RDF)-formatted PubChem data for data sharing, analysis and integration with information contained in other databases.", journal = "Nucleic Acids Res.", publisher = "Oxford University Press (OUP)", volume = 44, number = "D1", pages = "D1202--13", month = jan, year = 2016, language = "en" } """ # You can copy an official description _DESCRIPTION = """\ This dataset contains ~100M molecules from PubChem, with their SMILES and SELFIES representations. """ _HOMEPAGE = "https://pubchem.ncbi.nlm.nih.gov/" _LICENSE = "Open Data Commons Open Database License" # this list of files has been preshuffled so we can use the same splits everytime FILES = [ "data/Compound_021000001_021500000/Compound_021000001_021500000_SELFIES.jsonl.gz", "data/Compound_034500001_035000000/Compound_034500001_035000000_SELFIES.jsonl.gz", "data/Compound_023500001_024000000/Compound_023500001_024000000_SELFIES.jsonl.gz", "data/Compound_151500001_152000000/Compound_151500001_152000000_SELFIES.jsonl.gz", "data/Compound_126500001_127000000/Compound_126500001_127000000_SELFIES.jsonl.gz", "data/Compound_030500001_031000000/Compound_030500001_031000000_SELFIES.jsonl.gz", "data/Compound_061500001_062000000/Compound_061500001_062000000_SELFIES.jsonl.gz", "data/Compound_031500001_032000000/Compound_031500001_032000000_SELFIES.jsonl.gz", "data/Compound_111000001_111500000/Compound_111000001_111500000_SELFIES.jsonl.gz", "data/Compound_058500001_059000000/Compound_058500001_059000000_SELFIES.jsonl.gz", "data/Compound_065500001_066000000/Compound_065500001_066000000_SELFIES.jsonl.gz", "data/Compound_065000001_065500000/Compound_065000001_065500000_SELFIES.jsonl.gz", "data/Compound_039500001_040000000/Compound_039500001_040000000_SELFIES.jsonl.gz", "data/Compound_014000001_014500000/Compound_014000001_014500000_SELFIES.jsonl.gz", "data/Compound_021500001_022000000/Compound_021500001_022000000_SELFIES.jsonl.gz", "data/Compound_081000001_081500000/Compound_081000001_081500000_SELFIES.jsonl.gz", "data/Compound_122000001_122500000/Compound_122000001_122500000_SELFIES.jsonl.gz", "data/Compound_045000001_045500000/Compound_045000001_045500000_SELFIES.jsonl.gz", "data/Compound_017500001_018000000/Compound_017500001_018000000_SELFIES.jsonl.gz", "data/Compound_059000001_059500000/Compound_059000001_059500000_SELFIES.jsonl.gz", "data/Compound_141000001_141500000/Compound_141000001_141500000_SELFIES.jsonl.gz", "data/Compound_129500001_130000000/Compound_129500001_130000000_SELFIES.jsonl.gz", "data/Compound_163500001_164000000/Compound_163500001_164000000_SELFIES.jsonl.gz", "data/Compound_089000001_089500000/Compound_089000001_089500000_SELFIES.jsonl.gz", "data/Compound_077000001_077500000/Compound_077000001_077500000_SELFIES.jsonl.gz", "data/Compound_161000001_161500000/Compound_161000001_161500000_SELFIES.jsonl.gz", "data/Compound_113000001_113500000/Compound_113000001_113500000_SELFIES.jsonl.gz", "data/Compound_040000001_040500000/Compound_040000001_040500000_SELFIES.jsonl.gz", "data/Compound_010000001_010500000/Compound_010000001_010500000_SELFIES.jsonl.gz", "data/Compound_091500001_092000000/Compound_091500001_092000000_SELFIES.jsonl.gz", "data/Compound_154500001_155000000/Compound_154500001_155000000_SELFIES.jsonl.gz", "data/Compound_098500001_099000000/Compound_098500001_099000000_SELFIES.jsonl.gz", "data/Compound_019000001_019500000/Compound_019000001_019500000_SELFIES.jsonl.gz", "data/Compound_064000001_064500000/Compound_064000001_064500000_SELFIES.jsonl.gz", "data/Compound_147000001_147500000/Compound_147000001_147500000_SELFIES.jsonl.gz", "data/Compound_001500001_002000000/Compound_001500001_002000000_SELFIES.jsonl.gz", "data/Compound_137000001_137500000/Compound_137000001_137500000_SELFIES.jsonl.gz", "data/Compound_161500001_162000000/Compound_161500001_162000000_SELFIES.jsonl.gz", "data/Compound_074000001_074500000/Compound_074000001_074500000_SELFIES.jsonl.gz", "data/Compound_133500001_134000000/Compound_133500001_134000000_SELFIES.jsonl.gz", "data/Compound_028000001_028500000/Compound_028000001_028500000_SELFIES.jsonl.gz", "data/Compound_147500001_148000000/Compound_147500001_148000000_SELFIES.jsonl.gz", "data/Compound_159000001_159500000/Compound_159000001_159500000_SELFIES.jsonl.gz", "data/Compound_098000001_098500000/Compound_098000001_098500000_SELFIES.jsonl.gz", "data/Compound_024000001_024500000/Compound_024000001_024500000_SELFIES.jsonl.gz", "data/Compound_043000001_043500000/Compound_043000001_043500000_SELFIES.jsonl.gz", "data/Compound_004500001_005000000/Compound_004500001_005000000_SELFIES.jsonl.gz", "data/Compound_118000001_118500000/Compound_118000001_118500000_SELFIES.jsonl.gz", "data/Compound_104500001_105000000/Compound_104500001_105000000_SELFIES.jsonl.gz", "data/Compound_013000001_013500000/Compound_013000001_013500000_SELFIES.jsonl.gz", "data/Compound_035500001_036000000/Compound_035500001_036000000_SELFIES.jsonl.gz", "data/Compound_129000001_129500000/Compound_129000001_129500000_SELFIES.jsonl.gz", "data/Compound_141500001_142000000/Compound_141500001_142000000_SELFIES.jsonl.gz", "data/Compound_120500001_121000000/Compound_120500001_121000000_SELFIES.jsonl.gz", "data/Compound_066000001_066500000/Compound_066000001_066500000_SELFIES.jsonl.gz", "data/Compound_060000001_060500000/Compound_060000001_060500000_SELFIES.jsonl.gz", "data/Compound_014500001_015000000/Compound_014500001_015000000_SELFIES.jsonl.gz", "data/Compound_159500001_160000000/Compound_159500001_160000000_SELFIES.jsonl.gz", "data/Compound_107500001_108000000/Compound_107500001_108000000_SELFIES.jsonl.gz", "data/Compound_139500001_140000000/Compound_139500001_140000000_SELFIES.jsonl.gz", "data/Compound_088500001_089000000/Compound_088500001_089000000_SELFIES.jsonl.gz", "data/Compound_070000001_070500000/Compound_070000001_070500000_SELFIES.jsonl.gz", "data/Compound_103000001_103500000/Compound_103000001_103500000_SELFIES.jsonl.gz", "data/Compound_063000001_063500000/Compound_063000001_063500000_SELFIES.jsonl.gz", "data/Compound_052500001_053000000/Compound_052500001_053000000_SELFIES.jsonl.gz", "data/Compound_094000001_094500000/Compound_094000001_094500000_SELFIES.jsonl.gz", "data/Compound_091000001_091500000/Compound_091000001_091500000_SELFIES.jsonl.gz", "data/Compound_075000001_075500000/Compound_075000001_075500000_SELFIES.jsonl.gz", "data/Compound_116500001_117000000/Compound_116500001_117000000_SELFIES.jsonl.gz", "data/Compound_164500001_165000000/Compound_164500001_165000000_SELFIES.jsonl.gz", "data/Compound_071500001_072000000/Compound_071500001_072000000_SELFIES.jsonl.gz", "data/Compound_055000001_055500000/Compound_055000001_055500000_SELFIES.jsonl.gz", "data/Compound_027500001_028000000/Compound_027500001_028000000_SELFIES.jsonl.gz", "data/Compound_132500001_133000000/Compound_132500001_133000000_SELFIES.jsonl.gz", "data/Compound_027000001_027500000/Compound_027000001_027500000_SELFIES.jsonl.gz", "data/Compound_132000001_132500000/Compound_132000001_132500000_SELFIES.jsonl.gz", "data/Compound_089500001_090000000/Compound_089500001_090000000_SELFIES.jsonl.gz", "data/Compound_120000001_120500000/Compound_120000001_120500000_SELFIES.jsonl.gz", "data/Compound_088000001_088500000/Compound_088000001_088500000_SELFIES.jsonl.gz", "data/Compound_117500001_118000000/Compound_117500001_118000000_SELFIES.jsonl.gz", "data/Compound_114000001_114500000/Compound_114000001_114500000_SELFIES.jsonl.gz", "data/Compound_049500001_050000000/Compound_049500001_050000000_SELFIES.jsonl.gz", "data/Compound_134000001_134500000/Compound_134000001_134500000_SELFIES.jsonl.gz", "data/Compound_115000001_115500000/Compound_115000001_115500000_SELFIES.jsonl.gz", "data/Compound_143500001_144000000/Compound_143500001_144000000_SELFIES.jsonl.gz", "data/Compound_164000001_164500000/Compound_164000001_164500000_SELFIES.jsonl.gz", "data/Compound_094500001_095000000/Compound_094500001_095000000_SELFIES.jsonl.gz", "data/Compound_072500001_073000000/Compound_072500001_073000000_SELFIES.jsonl.gz", "data/Compound_086500001_087000000/Compound_086500001_087000000_SELFIES.jsonl.gz", "data/Compound_084000001_084500000/Compound_084000001_084500000_SELFIES.jsonl.gz", "data/Compound_148500001_149000000/Compound_148500001_149000000_SELFIES.jsonl.gz", "data/Compound_144000001_144500000/Compound_144000001_144500000_SELFIES.jsonl.gz", "data/Compound_146000001_146500000/Compound_146000001_146500000_SELFIES.jsonl.gz", "data/Compound_054500001_055000000/Compound_054500001_055000000_SELFIES.jsonl.gz", "data/Compound_034000001_034500000/Compound_034000001_034500000_SELFIES.jsonl.gz", "data/Compound_007000001_007500000/Compound_007000001_007500000_SELFIES.jsonl.gz", "data/Compound_056500001_057000000/Compound_056500001_057000000_SELFIES.jsonl.gz", "data/Compound_152500001_153000000/Compound_152500001_153000000_SELFIES.jsonl.gz", "data/Compound_030000001_030500000/Compound_030000001_030500000_SELFIES.jsonl.gz", "data/Compound_031000001_031500000/Compound_031000001_031500000_SELFIES.jsonl.gz", "data/Compound_035000001_035500000/Compound_035000001_035500000_SELFIES.jsonl.gz", "data/Compound_156500001_157000000/Compound_156500001_157000000_SELFIES.jsonl.gz", "data/Compound_036000001_036500000/Compound_036000001_036500000_SELFIES.jsonl.gz", "data/Compound_157500001_158000000/Compound_157500001_158000000_SELFIES.jsonl.gz", "data/Compound_051500001_052000000/Compound_051500001_052000000_SELFIES.jsonl.gz", "data/Compound_144500001_145000000/Compound_144500001_145000000_SELFIES.jsonl.gz", "data/Compound_038500001_039000000/Compound_038500001_039000000_SELFIES.jsonl.gz", "data/Compound_018500001_019000000/Compound_018500001_019000000_SELFIES.jsonl.gz", "data/Compound_149000001_149500000/Compound_149000001_149500000_SELFIES.jsonl.gz", "data/Compound_139000001_139500000/Compound_139000001_139500000_SELFIES.jsonl.gz", "data/Compound_039000001_039500000/Compound_039000001_039500000_SELFIES.jsonl.gz", "data/Compound_102000001_102500000/Compound_102000001_102500000_SELFIES.jsonl.gz", "data/Compound_022000001_022500000/Compound_022000001_022500000_SELFIES.jsonl.gz", "data/Compound_009500001_010000000/Compound_009500001_010000000_SELFIES.jsonl.gz", "data/Compound_086000001_086500000/Compound_086000001_086500000_SELFIES.jsonl.gz", "data/Compound_040500001_041000000/Compound_040500001_041000000_SELFIES.jsonl.gz", "data/Compound_131500001_132000000/Compound_131500001_132000000_SELFIES.jsonl.gz", "data/Compound_095000001_095500000/Compound_095000001_095500000_SELFIES.jsonl.gz", "data/Compound_107000001_107500000/Compound_107000001_107500000_SELFIES.jsonl.gz", "data/Compound_076500001_077000000/Compound_076500001_077000000_SELFIES.jsonl.gz", "data/Compound_013500001_014000000/Compound_013500001_014000000_SELFIES.jsonl.gz", "data/Compound_056000001_056500000/Compound_056000001_056500000_SELFIES.jsonl.gz", "data/Compound_138000001_138500000/Compound_138000001_138500000_SELFIES.jsonl.gz", "data/Compound_162500001_163000000/Compound_162500001_163000000_SELFIES.jsonl.gz", "data/Compound_136000001_136500000/Compound_136000001_136500000_SELFIES.jsonl.gz", "data/Compound_146500001_147000000/Compound_146500001_147000000_SELFIES.jsonl.gz", "data/Compound_007500001_008000000/Compound_007500001_008000000_SELFIES.jsonl.gz", "data/Compound_037500001_038000000/Compound_037500001_038000000_SELFIES.jsonl.gz", "data/Compound_015000001_015500000/Compound_015000001_015500000_SELFIES.jsonl.gz", "data/Compound_106500001_107000000/Compound_106500001_107000000_SELFIES.jsonl.gz", "data/Compound_003500001_004000000/Compound_003500001_004000000_SELFIES.jsonl.gz", "data/Compound_131000001_131500000/Compound_131000001_131500000_SELFIES.jsonl.gz", "data/Compound_102500001_103000000/Compound_102500001_103000000_SELFIES.jsonl.gz", "data/Compound_112000001_112500000/Compound_112000001_112500000_SELFIES.jsonl.gz", "data/Compound_049000001_049500000/Compound_049000001_049500000_SELFIES.jsonl.gz", "data/Compound_041000001_041500000/Compound_041000001_041500000_SELFIES.jsonl.gz", "data/Compound_011000001_011500000/Compound_011000001_011500000_SELFIES.jsonl.gz", "data/Compound_079500001_080000000/Compound_079500001_080000000_SELFIES.jsonl.gz", "data/Compound_105500001_106000000/Compound_105500001_106000000_SELFIES.jsonl.gz", "data/Compound_123500001_124000000/Compound_123500001_124000000_SELFIES.jsonl.gz", "data/Compound_057000001_057500000/Compound_057000001_057500000_SELFIES.jsonl.gz", "data/Compound_110500001_111000000/Compound_110500001_111000000_SELFIES.jsonl.gz", "data/Compound_029500001_030000000/Compound_029500001_030000000_SELFIES.jsonl.gz", "data/Compound_082000001_082500000/Compound_082000001_082500000_SELFIES.jsonl.gz", "data/Compound_087500001_088000000/Compound_087500001_088000000_SELFIES.jsonl.gz", "data/Compound_100500001_101000000/Compound_100500001_101000000_SELFIES.jsonl.gz", "data/Compound_018000001_018500000/Compound_018000001_018500000_SELFIES.jsonl.gz", "data/Compound_114500001_115000000/Compound_114500001_115000000_SELFIES.jsonl.gz", "data/Compound_008000001_008500000/Compound_008000001_008500000_SELFIES.jsonl.gz", "data/Compound_143000001_143500000/Compound_143000001_143500000_SELFIES.jsonl.gz", "data/Compound_142000001_142500000/Compound_142000001_142500000_SELFIES.jsonl.gz", "data/Compound_109000001_109500000/Compound_109000001_109500000_SELFIES.jsonl.gz", "data/Compound_047000001_047500000/Compound_047000001_047500000_SELFIES.jsonl.gz", "data/Compound_077500001_078000000/Compound_077500001_078000000_SELFIES.jsonl.gz", "data/Compound_100000001_100500000/Compound_100000001_100500000_SELFIES.jsonl.gz", "data/Compound_043500001_044000000/Compound_043500001_044000000_SELFIES.jsonl.gz", "data/Compound_029000001_029500000/Compound_029000001_029500000_SELFIES.jsonl.gz", "data/Compound_078500001_079000000/Compound_078500001_079000000_SELFIES.jsonl.gz", "data/Compound_005000001_005500000/Compound_005000001_005500000_SELFIES.jsonl.gz", "data/Compound_153000001_153500000/Compound_153000001_153500000_SELFIES.jsonl.gz", "data/Compound_004000001_004500000/Compound_004000001_004500000_SELFIES.jsonl.gz", "data/Compound_072000001_072500000/Compound_072000001_072500000_SELFIES.jsonl.gz", "data/Compound_045500001_046000000/Compound_045500001_046000000_SELFIES.jsonl.gz", "data/Compound_050000001_050500000/Compound_050000001_050500000_SELFIES.jsonl.gz", "data/Compound_115500001_116000000/Compound_115500001_116000000_SELFIES.jsonl.gz", "data/Compound_155500001_156000000/Compound_155500001_156000000_SELFIES.jsonl.gz", "data/Compound_025500001_026000000/Compound_025500001_026000000_SELFIES.jsonl.gz", "data/Compound_106000001_106500000/Compound_106000001_106500000_SELFIES.jsonl.gz", "data/Compound_075500001_076000000/Compound_075500001_076000000_SELFIES.jsonl.gz", "data/Compound_062500001_063000000/Compound_062500001_063000000_SELFIES.jsonl.gz", "data/Compound_155000001_155500000/Compound_155000001_155500000_SELFIES.jsonl.gz", "data/Compound_105000001_105500000/Compound_105000001_105500000_SELFIES.jsonl.gz", "data/Compound_097500001_098000000/Compound_097500001_098000000_SELFIES.jsonl.gz", "data/Compound_005500001_006000000/Compound_005500001_006000000_SELFIES.jsonl.gz", "data/Compound_127500001_128000000/Compound_127500001_128000000_SELFIES.jsonl.gz", "data/Compound_135500001_136000000/Compound_135500001_136000000_SELFIES.jsonl.gz", "data/Compound_020000001_020500000/Compound_020000001_020500000_SELFIES.jsonl.gz", "data/Compound_135000001_135500000/Compound_135000001_135500000_SELFIES.jsonl.gz", "data/Compound_068000001_068500000/Compound_068000001_068500000_SELFIES.jsonl.gz", "data/Compound_026000001_026500000/Compound_026000001_026500000_SELFIES.jsonl.gz", "data/Compound_099500001_100000000/Compound_099500001_100000000_SELFIES.jsonl.gz", "data/Compound_158000001_158500000/Compound_158000001_158500000_SELFIES.jsonl.gz", "data/Compound_069000001_069500000/Compound_069000001_069500000_SELFIES.jsonl.gz", "data/Compound_078000001_078500000/Compound_078000001_078500000_SELFIES.jsonl.gz", "data/Compound_066500001_067000000/Compound_066500001_067000000_SELFIES.jsonl.gz", "data/Compound_076000001_076500000/Compound_076000001_076500000_SELFIES.jsonl.gz", "data/Compound_009000001_009500000/Compound_009000001_009500000_SELFIES.jsonl.gz", "data/Compound_117000001_117500000/Compound_117000001_117500000_SELFIES.jsonl.gz", "data/Compound_055500001_056000000/Compound_055500001_056000000_SELFIES.jsonl.gz", "data/Compound_012500001_013000000/Compound_012500001_013000000_SELFIES.jsonl.gz", "data/Compound_011500001_012000000/Compound_011500001_012000000_SELFIES.jsonl.gz", "data/Compound_015500001_016000000/Compound_015500001_016000000_SELFIES.jsonl.gz", "data/Compound_092000001_092500000/Compound_092000001_092500000_SELFIES.jsonl.gz", "data/Compound_008500001_009000000/Compound_008500001_009000000_SELFIES.jsonl.gz", "data/Compound_000000001_000500000/Compound_000000001_000500000_SELFIES.jsonl.gz", "data/Compound_151000001_151500000/Compound_151000001_151500000_SELFIES.jsonl.gz", "data/Compound_082500001_083000000/Compound_082500001_083000000_SELFIES.jsonl.gz", "data/Compound_012000001_012500000/Compound_012000001_012500000_SELFIES.jsonl.gz", "data/Compound_057500001_058000000/Compound_057500001_058000000_SELFIES.jsonl.gz", "data/Compound_103500001_104000000/Compound_103500001_104000000_SELFIES.jsonl.gz", "data/Compound_067500001_068000000/Compound_067500001_068000000_SELFIES.jsonl.gz", "data/Compound_108000001_108500000/Compound_108000001_108500000_SELFIES.jsonl.gz", "data/Compound_046500001_047000000/Compound_046500001_047000000_SELFIES.jsonl.gz", "data/Compound_017000001_017500000/Compound_017000001_017500000_SELFIES.jsonl.gz", "data/Compound_058000001_058500000/Compound_058000001_058500000_SELFIES.jsonl.gz", "data/Compound_079000001_079500000/Compound_079000001_079500000_SELFIES.jsonl.gz", "data/Compound_062000001_062500000/Compound_062000001_062500000_SELFIES.jsonl.gz", "data/Compound_145000001_145500000/Compound_145000001_145500000_SELFIES.jsonl.gz", "data/Compound_163000001_163500000/Compound_163000001_163500000_SELFIES.jsonl.gz", "data/Compound_067000001_067500000/Compound_067000001_067500000_SELFIES.jsonl.gz", "data/Compound_083000001_083500000/Compound_083000001_083500000_SELFIES.jsonl.gz", "data/Compound_068500001_069000000/Compound_068500001_069000000_SELFIES.jsonl.gz", "data/Compound_020500001_021000000/Compound_020500001_021000000_SELFIES.jsonl.gz", "data/Compound_046000001_046500000/Compound_046000001_046500000_SELFIES.jsonl.gz", "data/Compound_096500001_097000000/Compound_096500001_097000000_SELFIES.jsonl.gz", "data/Compound_081500001_082000000/Compound_081500001_082000000_SELFIES.jsonl.gz", "data/Compound_108500001_109000000/Compound_108500001_109000000_SELFIES.jsonl.gz", "data/Compound_085500001_086000000/Compound_085500001_086000000_SELFIES.jsonl.gz", "data/Compound_119000001_119500000/Compound_119000001_119500000_SELFIES.jsonl.gz", "data/Compound_090500001_091000000/Compound_090500001_091000000_SELFIES.jsonl.gz", "data/Compound_036500001_037000000/Compound_036500001_037000000_SELFIES.jsonl.gz", "data/Compound_130500001_131000000/Compound_130500001_131000000_SELFIES.jsonl.gz", "data/Compound_121500001_122000000/Compound_121500001_122000000_SELFIES.jsonl.gz", "data/Compound_113500001_114000000/Compound_113500001_114000000_SELFIES.jsonl.gz", "data/Compound_145500001_146000000/Compound_145500001_146000000_SELFIES.jsonl.gz", "data/Compound_041500001_042000000/Compound_041500001_042000000_SELFIES.jsonl.gz", "data/Compound_083500001_084000000/Compound_083500001_084000000_SELFIES.jsonl.gz", "data/Compound_052000001_052500000/Compound_052000001_052500000_SELFIES.jsonl.gz", "data/Compound_140500001_141000000/Compound_140500001_141000000_SELFIES.jsonl.gz", "data/Compound_154000001_154500000/Compound_154000001_154500000_SELFIES.jsonl.gz", "data/Compound_044000001_044500000/Compound_044000001_044500000_SELFIES.jsonl.gz", "data/Compound_002000001_002500000/Compound_002000001_002500000_SELFIES.jsonl.gz", "data/Compound_010500001_011000000/Compound_010500001_011000000_SELFIES.jsonl.gz", "data/Compound_073000001_073500000/Compound_073000001_073500000_SELFIES.jsonl.gz", "data/Compound_048500001_049000000/Compound_048500001_049000000_SELFIES.jsonl.gz", "data/Compound_032000001_032500000/Compound_032000001_032500000_SELFIES.jsonl.gz", "data/Compound_026500001_027000000/Compound_026500001_027000000_SELFIES.jsonl.gz", "data/Compound_112500001_113000000/Compound_112500001_113000000_SELFIES.jsonl.gz", "data/Compound_069500001_070000000/Compound_069500001_070000000_SELFIES.jsonl.gz", "data/Compound_110000001_110500000/Compound_110000001_110500000_SELFIES.jsonl.gz", "data/Compound_156000001_156500000/Compound_156000001_156500000_SELFIES.jsonl.gz", "data/Compound_037000001_037500000/Compound_037000001_037500000_SELFIES.jsonl.gz", "data/Compound_130000001_130500000/Compound_130000001_130500000_SELFIES.jsonl.gz", "data/Compound_051000001_051500000/Compound_051000001_051500000_SELFIES.jsonl.gz", "data/Compound_093500001_094000000/Compound_093500001_094000000_SELFIES.jsonl.gz", "data/Compound_149500001_150000000/Compound_149500001_150000000_SELFIES.jsonl.gz", "data/Compound_158500001_159000000/Compound_158500001_159000000_SELFIES.jsonl.gz", "data/Compound_074500001_075000000/Compound_074500001_075000000_SELFIES.jsonl.gz", "data/Compound_053500001_054000000/Compound_053500001_054000000_SELFIES.jsonl.gz", "data/Compound_160500001_161000000/Compound_160500001_161000000_SELFIES.jsonl.gz", "data/Compound_022500001_023000000/Compound_022500001_023000000_SELFIES.jsonl.gz", "data/Compound_118500001_119000000/Compound_118500001_119000000_SELFIES.jsonl.gz", "data/Compound_025000001_025500000/Compound_025000001_025500000_SELFIES.jsonl.gz", "data/Compound_128500001_129000000/Compound_128500001_129000000_SELFIES.jsonl.gz", "data/Compound_080500001_081000000/Compound_080500001_081000000_SELFIES.jsonl.gz", "data/Compound_080000001_080500000/Compound_080000001_080500000_SELFIES.jsonl.gz", "data/Compound_101000001_101500000/Compound_101000001_101500000_SELFIES.jsonl.gz", "data/Compound_136500001_137000000/Compound_136500001_137000000_SELFIES.jsonl.gz", "data/Compound_033500001_034000000/Compound_033500001_034000000_SELFIES.jsonl.gz", "data/Compound_048000001_048500000/Compound_048000001_048500000_SELFIES.jsonl.gz", "data/Compound_032500001_033000000/Compound_032500001_033000000_SELFIES.jsonl.gz", "data/Compound_093000001_093500000/Compound_093000001_093500000_SELFIES.jsonl.gz", "data/Compound_123000001_123500000/Compound_123000001_123500000_SELFIES.jsonl.gz", "data/Compound_133000001_133500000/Compound_133000001_133500000_SELFIES.jsonl.gz", "data/Compound_090000001_090500000/Compound_090000001_090500000_SELFIES.jsonl.gz", "data/Compound_042500001_043000000/Compound_042500001_043000000_SELFIES.jsonl.gz", "data/Compound_127000001_127500000/Compound_127000001_127500000_SELFIES.jsonl.gz", "data/Compound_125000001_125500000/Compound_125000001_125500000_SELFIES.jsonl.gz", "data/Compound_138500001_139000000/Compound_138500001_139000000_SELFIES.jsonl.gz", "data/Compound_001000001_001500000/Compound_001000001_001500000_SELFIES.jsonl.gz", "data/Compound_099000001_099500000/Compound_099000001_099500000_SELFIES.jsonl.gz", "data/Compound_002500001_003000000/Compound_002500001_003000000_SELFIES.jsonl.gz", "data/Compound_019500001_020000000/Compound_019500001_020000000_SELFIES.jsonl.gz", "data/Compound_047500001_048000000/Compound_047500001_048000000_SELFIES.jsonl.gz", "data/Compound_097000001_097500000/Compound_097000001_097500000_SELFIES.jsonl.gz", "data/Compound_070500001_071000000/Compound_070500001_071000000_SELFIES.jsonl.gz", "data/Compound_125500001_126000000/Compound_125500001_126000000_SELFIES.jsonl.gz", "data/Compound_064500001_065000000/Compound_064500001_065000000_SELFIES.jsonl.gz", "data/Compound_157000001_157500000/Compound_157000001_157500000_SELFIES.jsonl.gz", "data/Compound_087000001_087500000/Compound_087000001_087500000_SELFIES.jsonl.gz", "data/Compound_071000001_071500000/Compound_071000001_071500000_SELFIES.jsonl.gz", "data/Compound_119500001_120000000/Compound_119500001_120000000_SELFIES.jsonl.gz", "data/Compound_044500001_045000000/Compound_044500001_045000000_SELFIES.jsonl.gz", "data/Compound_016000001_016500000/Compound_016000001_016500000_SELFIES.jsonl.gz", "data/Compound_095500001_096000000/Compound_095500001_096000000_SELFIES.jsonl.gz", "data/Compound_092500001_093000000/Compound_092500001_093000000_SELFIES.jsonl.gz", "data/Compound_000500001_001000000/Compound_000500001_001000000_SELFIES.jsonl.gz", "data/Compound_059500001_060000000/Compound_059500001_060000000_SELFIES.jsonl.gz", "data/Compound_016500001_017000000/Compound_016500001_017000000_SELFIES.jsonl.gz", "data/Compound_061000001_061500000/Compound_061000001_061500000_SELFIES.jsonl.gz", "data/Compound_101500001_102000000/Compound_101500001_102000000_SELFIES.jsonl.gz", "data/Compound_028500001_029000000/Compound_028500001_029000000_SELFIES.jsonl.gz", "data/Compound_042000001_042500000/Compound_042000001_042500000_SELFIES.jsonl.gz", "data/Compound_152000001_152500000/Compound_152000001_152500000_SELFIES.jsonl.gz", "data/Compound_122500001_123000000/Compound_122500001_123000000_SELFIES.jsonl.gz", "data/Compound_150500001_151000000/Compound_150500001_151000000_SELFIES.jsonl.gz", "data/Compound_142500001_143000000/Compound_142500001_143000000_SELFIES.jsonl.gz", "data/Compound_162000001_162500000/Compound_162000001_162500000_SELFIES.jsonl.gz", "data/Compound_053000001_053500000/Compound_053000001_053500000_SELFIES.jsonl.gz", "data/Compound_104000001_104500000/Compound_104000001_104500000_SELFIES.jsonl.gz", "data/Compound_084500001_085000000/Compound_084500001_085000000_SELFIES.jsonl.gz", "data/Compound_140000001_140500000/Compound_140000001_140500000_SELFIES.jsonl.gz", "data/Compound_160000001_160500000/Compound_160000001_160500000_SELFIES.jsonl.gz", "data/Compound_126000001_126500000/Compound_126000001_126500000_SELFIES.jsonl.gz", "data/Compound_153500001_154000000/Compound_153500001_154000000_SELFIES.jsonl.gz", "data/Compound_134500001_135000000/Compound_134500001_135000000_SELFIES.jsonl.gz", "data/Compound_063500001_064000000/Compound_063500001_064000000_SELFIES.jsonl.gz", "data/Compound_109500001_110000000/Compound_109500001_110000000_SELFIES.jsonl.gz", "data/Compound_137500001_138000000/Compound_137500001_138000000_SELFIES.jsonl.gz", "data/Compound_085000001_085500000/Compound_085000001_085500000_SELFIES.jsonl.gz", "data/Compound_024500001_025000000/Compound_024500001_025000000_SELFIES.jsonl.gz", "data/Compound_116000001_116500000/Compound_116000001_116500000_SELFIES.jsonl.gz", "data/Compound_006000001_006500000/Compound_006000001_006500000_SELFIES.jsonl.gz", "data/Compound_128000001_128500000/Compound_128000001_128500000_SELFIES.jsonl.gz", "data/Compound_121000001_121500000/Compound_121000001_121500000_SELFIES.jsonl.gz", "data/Compound_150000001_150500000/Compound_150000001_150500000_SELFIES.jsonl.gz", "data/Compound_124000001_124500000/Compound_124000001_124500000_SELFIES.jsonl.gz", "data/Compound_111500001_112000000/Compound_111500001_112000000_SELFIES.jsonl.gz", "data/Compound_148000001_148500000/Compound_148000001_148500000_SELFIES.jsonl.gz", "data/Compound_006500001_007000000/Compound_006500001_007000000_SELFIES.jsonl.gz", "data/Compound_033000001_033500000/Compound_033000001_033500000_SELFIES.jsonl.gz", "data/Compound_096000001_096500000/Compound_096000001_096500000_SELFIES.jsonl.gz", "data/Compound_038000001_038500000/Compound_038000001_038500000_SELFIES.jsonl.gz", "data/Compound_124500001_125000000/Compound_124500001_125000000_SELFIES.jsonl.gz", "data/Compound_050500001_051000000/Compound_050500001_051000000_SELFIES.jsonl.gz", "data/Compound_003000001_003500000/Compound_003000001_003500000_SELFIES.jsonl.gz", "data/Compound_073500001_074000000/Compound_073500001_074000000_SELFIES.jsonl.gz", "data/Compound_023000001_023500000/Compound_023000001_023500000_SELFIES.jsonl.gz", "data/Compound_060500001_061000000/Compound_060500001_061000000_SELFIES.jsonl.gz", "data/Compound_054000001_054500000/Compound_054000001_054500000_SELFIES.jsonl.gz" ] class PubchemSelfies(datasets.GeneratorBasedBuilder): """A dataset of PubChem molecules represented as SELFIES.""" VERSION = datasets.Version("1.1.0") # You will be able to load one or the other configurations in the following list with BUILDER_CONFIG = datasets.BuilderConfig( version=VERSION, description="A dataset of PubChem molecules represented as SELFIES." ) def _info(self): return datasets.DatasetInfo( # This is the description that will appear on the datasets page. description=_DESCRIPTION, # This defines the different columns of the dataset and their types features=datasets.Features( { "PUBCHEM_COMPOUND_CID": datasets.Value("int32"), "CAN_SELFIES": datasets.Value("string"), "PUBCHEM_OPENEYE_CAN_SMILES": datasets.Value("string"), } ), # Homepage of the dataset for documentation homepage=_HOMEPAGE, # License for the dataset if available license=_LICENSE, # Citation for the dataset citation=_CITATION, ) def _split_generators(self, dl_manager): downloaded_files = dl_manager.download(FILES) train_len = int(len(downloaded_files) * 0.8) valid_len = int(len(downloaded_files) * 0.1) return [ datasets.SplitGenerator( name=datasets.Split.TRAIN, # These kwargs will be passed to _generate_examples gen_kwargs={ "subdirs": downloaded_files[:train_len], "split": "train", }, ), datasets.SplitGenerator( name=datasets.Split.VALIDATION, # These kwargs will be passed to _generate_examples gen_kwargs={ "subdirs": downloaded_files[train_len : train_len + valid_len], "split": "valid", }, ), datasets.SplitGenerator( name=datasets.Split.TEST, # These kwargs will be passed to _generate_examples gen_kwargs={ "subdirs": downloaded_files[-valid_len:], "split": "test", }, ), ] # method parameters are unpacked from `gen_kwargs` as given in `_split_generators` def _generate_examples(self, subdirs, split): # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example. for filepath in subdirs: with gzip.open(open(filepath, "rb"), "rt", encoding="utf-8") as f: for row_idx, row in enumerate(f): data = json.loads(row) properties = data["molecules"][0]["properties"] key = f"{os.path.basename(filepath)}_{row_idx}" yield key, { "PUBCHEM_COMPOUND_CID": properties["PUBCHEM_COMPOUND_CID"], "PUBCHEM_OPENEYE_CAN_SMILES": properties[ "PUBCHEM_OPENEYE_CAN_SMILES" ], "CAN_SELFIES": properties["CAN_SELFIES"], }