Datasets:
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
Error code: EmptyDatasetError
Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
MolData
MolData is a comprehensive disease and target-based dataset collected from PubChem. The dataset contains 1.4 million unique molecules, and it is one the largest efforts to date for democratizing the molecular machine learning. This is a mirror of the Official Github repo where the dataset was uploaded in 2021.
Preprocessing
We utilized the raw data uploaded on Github and performed several preprocessing:
- Sanitize the molecules using RDKit and MolVS (standardize SMILES format)
- Formatting (from wide form to long form)
- Rename the columns
- Split the dataset (train, test, validation)
If you would like to try these processes with the original dataset, please follow the instructions in the preprocessing script file located in our MolData repository.
Quickstart Usage
Load a dataset in python
Each subset can be loaded into python using the Huggingface datasets library.
First, from the command line install the datasets
library
$ pip install datasets
then, from within python load the datasets library
>>> import datasets
and load the MolData
datasets, e.g.,
>>> MolData = datasets.load_dataset("maomlab/MolData", name = "MolData")
Generating train split: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 138547273/138547273 [02:07<00:00, 1088043.12 examples/s]
Generating test split: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 17069726/17069726 [00:16<00:00, 1037407.67 examples/s]
Generating validation split: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 12728449/12728449 [00:11<00:00, 1093675.24 examples/s]
and inspecting the loaded dataset
>>> MolData
DatasetDict({
train: Dataset({
features: ['SMILES', 'PUBCHEM_CID', 'split', 'AID', 'Y'],
num_rows: 138547273
})
test: Dataset({
features: ['SMILES', 'PUBCHEM_CID', 'split', 'AID', 'Y'],
num_rows: 17069726
})
validation: Dataset({
features: ['SMILES', 'PUBCHEM_CID', 'split', 'AID', 'Y'],
num_rows: 12728449
})
})
Use a dataset to train a model
One way to use the dataset is through the MolFlux package developed by Exscientia.
First, from the command line, install MolFlux
library with catboost
and rdkit
support
pip install 'molflux[catboost,rdkit]'
then load, featurize, split, fit, and evaluate the catboost model
import json
from datasets import load_dataset
from molflux.datasets import featurise_dataset
from molflux.features import load_from_dicts as load_representations_from_dicts
from molflux.splits import load_from_dict as load_split_from_dict
from molflux.modelzoo import load_from_dict as load_model_from_dict
from molflux.metrics import load_suite
Split and evaluate the catboost model
split_dataset = load_dataset('maomlab/MolData', name = 'MolData')
split_featurised_dataset = featurise_dataset(
split_dataset,
column = "SMILES",
representations = load_representations_from_dicts([{"name": "morgan"}, {"name": "maccs_rdkit"}]))
model = load_model_from_dict({
"name": "cat_boost_classifier",
"config": {
"x_features": ['SMILES::morgan', 'SMILES::maccs_rdkit'],
"y_features": ['Y']}})
model.train(split_featurised_dataset["train"])
preds = model.predict(split_featurised_dataset["test"])
classification_suite = load_suite("classification")
scores = classification_suite.compute(
references=split_featurised_dataset["test"]['Y'],
predictions=preds["cat_boost_classifier::Y"])
Citation
@article{KeshavarziArshadi2022, title = {MolData, a molecular benchmark for disease and target based machine learning}, volume = {14}, ISSN = {1758-2946}, url = {http://dx.doi.org/10.1186/s13321-022-00590-y}, DOI = {10.1186/s13321-022-00590-y}, number = {1}, journal = {Journal of Cheminformatics}, publisher = {Springer Science and Business Media LLC}, author = {Keshavarzi Arshadi, Arash and Salem, Milad and Firouzbakht, Arash and Yuan, Jiann Shiun}, year = {2022}, month = mar }
- Downloads last month
- 13