Update README.md
Browse files
README.md
CHANGED
|
@@ -8,4 +8,80 @@ size_categories:
|
|
| 8 |
- 1K<n<10K
|
| 9 |
config_names:
|
| 10 |
- HematoxLong2022
|
| 11 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
- 1K<n<10K
|
| 9 |
config_names:
|
| 10 |
- HematoxLong2022
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Hematotoxicity Dataset (HematoxLong2022)
|
| 14 |
+
Initially, a total of 2670 compounds were collected and all molecules were subjected to the multistep data preparation process to ensure data quality.
|
| 15 |
+
Finally, a hematotoxicity dataset containing 1772 chemicals was obtained, which includes a positive set with 589 molecules and a negative set with 1183 molecules.
|
| 16 |
+
All of the molecules were divided into a training set of 1330 molecules and a test set of 442 molecules according to their Murcko scaffolds.
|
| 17 |
+
Additionally, 610 new molecules from related research and databases were compiled as the external validation set.
|
| 18 |
+
|
| 19 |
+
## Quickstart Usage
|
| 20 |
+
|
| 21 |
+
### Load a dataset in python
|
| 22 |
+
Each subset can be loaded into python using the Huggingface [datasets](https://huggingface.co/docs/datasets/index) library.
|
| 23 |
+
First, from the command line install the `datasets` library
|
| 24 |
+
|
| 25 |
+
$ pip install datasets
|
| 26 |
+
|
| 27 |
+
then, from within python load the datasets library
|
| 28 |
+
|
| 29 |
+
>>> import datasets
|
| 30 |
+
|
| 31 |
+
and load one of the `HematoxLong2022` datasets, e.g.,
|
| 32 |
+
|
| 33 |
+
>>> HematoxLong2022 = datasets.load_dataset("maomlab/HematoxLong2022", name = "HematoxLong2022")
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
and inspecting the loaded dataset
|
| 37 |
+
|
| 38 |
+
>>> HematoxLong2022
|
| 39 |
+
HematoxLong2022
|
| 40 |
+
DatasetDict({
|
| 41 |
+
test: Dataset({
|
| 42 |
+
features: ['NO.', 'compound_name', 'IUPAC_name', 'SMILES', 'CID', 'logBB', 'BBB+/BBB-', 'Inchi', 'threshold', 'reference', 'group', 'comments', 'ClusterNo', 'MolCount'],
|
| 43 |
+
num_rows: 1951
|
| 44 |
+
})
|
| 45 |
+
train: Dataset({
|
| 46 |
+
features: ['NO.', 'compound_name', 'IUPAC_name', 'SMILES', 'CID', 'logBB', 'BBB+/BBB-', 'Inchi', 'threshold', 'reference', 'group', 'comments', 'ClusterNo', 'MolCount'],
|
| 47 |
+
num_rows: 5856
|
| 48 |
+
})
|
| 49 |
+
})
|
| 50 |
+
|
| 51 |
+
### Use a dataset to train a model
|
| 52 |
+
One way to use the dataset is through the [MolFlux](https://exscientia.github.io/molflux/) package developed by Exscientia.
|
| 53 |
+
First, from the command line, install `MolFlux` library with `catboost` and `rdkit` support
|
| 54 |
+
|
| 55 |
+
pip install 'molflux[catboost,rdkit]'
|
| 56 |
+
|
| 57 |
+
then load, featurize, split, fit, and evaluate the a catboost model
|
| 58 |
+
|
| 59 |
+
import json
|
| 60 |
+
from datasets import load_dataset
|
| 61 |
+
from molflux.datasets import featurise_dataset
|
| 62 |
+
from molflux.features import load_from_dicts as load_representations_from_dicts
|
| 63 |
+
from molflux.splits import load_from_dict as load_split_from_dict
|
| 64 |
+
from molflux.modelzoo import load_from_dict as load_model_from_dict
|
| 65 |
+
from molflux.metrics import load_suite
|
| 66 |
+
|
| 67 |
+
split_dataset = load_dataset('maomlab/HematoxLong2022', name = 'HematoxLong2022')
|
| 68 |
+
|
| 69 |
+
split_featurised_dataset = featurise_dataset(
|
| 70 |
+
split_dataset,
|
| 71 |
+
column = "SMILES",
|
| 72 |
+
representations = load_representations_from_dicts([{"name": "morgan"}, {"name": "maccs_rdkit"}]))
|
| 73 |
+
|
| 74 |
+
model = load_model_from_dict({
|
| 75 |
+
"name": "cat_boost_classifier",
|
| 76 |
+
"config": {
|
| 77 |
+
"x_features": ['SMILES::morgan', 'SMILES::maccs_rdkit'],
|
| 78 |
+
"y_features": ['BBB+/BBB-']}})
|
| 79 |
+
|
| 80 |
+
model.train(split_featurised_dataset["train"])
|
| 81 |
+
preds = model.predict(split_featurised_dataset["test"])
|
| 82 |
+
|
| 83 |
+
classification_suite = load_suite("classification")
|
| 84 |
+
|
| 85 |
+
scores = classification_suite.compute(
|
| 86 |
+
references=split_featurised_dataset["test"]['BBB+/BBB-'],
|
| 87 |
+
predictions=preds["cat_boost_classifier::BBB+/BBB-"])
|