maom commited on
Commit
6e01acf
·
verified ·
1 Parent(s): 75b9838

initial example usage using the MolFlux package

Browse files
Files changed (1) hide show
  1. README.md +65 -19
README.md CHANGED
@@ -94,9 +94,11 @@ while the whole dataset has categorical (`BBB+` or `BBB-`) BBB permeability labe
94
  (7807 compounds). Some physicochemical properties of the molecules are also provided.
95
 
96
 
97
- ## Usage
 
 
98
  Each subset can be loaded into python using the Huggingface [datasets](https://huggingface.co/docs/datasets/index) library.
99
- First, from the commandline install the datasets package
100
 
101
  $ pip install datasets
102
 
@@ -128,17 +130,74 @@ and inspecting the loaded dataset
128
  })
129
  })
130
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
 
132
- ## Data splits
133
- The original B3DB dataset does not define splits, so here we have used the `Realistic Split` method described
134
- in [(Martin et al., 2018)](https://doi.org/10.1021/acs.jcim.7b00166).
135
 
 
 
136
 
 
 
137
 
 
 
138
 
139
 
 
 
 
140
 
141
- ## Citation
142
  Please use the following citation in any publication using our *B3DB* dataset:
143
 
144
  ```md
@@ -155,18 +214,5 @@ publisher = {Springer Nature}
155
  }
156
  ```
157
 
158
- ## Features of *B3DB*
159
-
160
- 1. The largest dataset with numerical and categorical values for Blood-Brain Barrier small molecules
161
- (to the best of our knowledge, as of February 25, 2021).
162
-
163
- 2. Inclusion of stereochemistry information with isomeric SMILES with chiral specifications if
164
- available. Otherwise, canonical SMILES are used.
165
-
166
- 3. Characterization of uncertainty of experimental measurements by grouping the collected molecular
167
- data records.
168
-
169
- 4. Extended datasets for numerical and categorical data with precomputed physicochemical properties
170
- using [mordred](https://github.com/mordred-descriptor/mordred).
171
 
172
 
 
94
  (7807 compounds). Some physicochemical properties of the molecules are also provided.
95
 
96
 
97
+ ## Quickstart Usage
98
+
99
+ ### Load a dataset in python
100
  Each subset can be loaded into python using the Huggingface [datasets](https://huggingface.co/docs/datasets/index) library.
101
+ First, from the command line install the `datasets` library
102
 
103
  $ pip install datasets
104
 
 
130
  })
131
  })
132
 
133
+ ### Use a dataset to train a model
134
+ One way to use the dataset is through the [MolFlux](https://exscientia.github.io/molflux/) package developed by Exscientia.
135
+ First, from the command line, install `MolFlux` library with `catboost` and `rdkit` support
136
+
137
+ pip install 'molflux[catboost,rdkit]'
138
+
139
+ then load, featurize, split, fit, and evaluate the a catboost model
140
+
141
+ import json
142
+ from molflux.datasets import load_dataset, featurise_dataset, split_dataset
143
+ from molflux.features import load_from_dicts as load_representations_from_dicts
144
+ from molflux.splits import load_from_dict as load_split_from_dict
145
+ from molflux.modelzoo import load_from_dict as load_model_from_dict
146
+ from molflux.metrics import load_suite
147
+
148
+ dataset = load_dataset('maomlab/B3DB', config_name = 'B3DB_classification')
149
+
150
+ featurised_dataset = featurise_dataset(
151
+ dataset,
152
+ column = "SMILES",
153
+ representations = load_representations_from_dicts([{"name": "morgan"}, {"name": "maccs_rdkit"}]))
154
+
155
+ shuffle_strategy = load_split_from_dict({
156
+ "name": "shuffle_split",
157
+ "presets": {
158
+ "train_fraction": 0.8,
159
+ "validation_fraction": 0.0,
160
+ "test_fraction": 0.2}})
161
+ split_featurised_dataset = next(split_dataset(featurised_dataset, shuffle_strategy))
162
+
163
+ model = load_model_from_dict({
164
+ "name": "cat_boost_classifier",
165
+ "config": {
166
+ "x_features": ['SMILES::morgan', 'SMILES::maccs_rdkit'],
167
+ "y_features": ['BBB+/BBB-']}})
168
+
169
+ model.train(split_featurised_dataset["train"])
170
+ preds = model.predict(split_featurised_dataset["test"])
171
+
172
+ classification_suite = load_suite("classification")
173
+
174
+ scores = classification_suite.compute(
175
+ references=split_featurised_dataset["test"]['BBB+/BBB-'],
176
+ predictions=preds["cat_boost_classifier::BBB+/BBB-"])
177
+
178
+
179
+ ## About the DB3B
180
+
181
+ ### Features of *B3DB*
182
 
183
+ 1. The largest dataset with numerical and categorical values for Blood-Brain Barrier small molecules
184
+ (to the best of our knowledge, as of February 25, 2021).
 
185
 
186
+ 2. Inclusion of stereochemistry information with isomeric SMILES with chiral specifications if
187
+ available. Otherwise, canonical SMILES are used.
188
 
189
+ 3. Characterization of uncertainty of experimental measurements by grouping the collected molecular
190
+ data records.
191
 
192
+ 4. Extended datasets for numerical and categorical data with precomputed physicochemical properties
193
+ using [mordred](https://github.com/mordred-descriptor/mordred).
194
 
195
 
196
+ ### Data splits
197
+ The original B3DB dataset does not define splits, so here we have used the `Realistic Split` method described
198
+ in [(Martin et al., 2018)](https://doi.org/10.1021/acs.jcim.7b00166).
199
 
200
+ ### Citation
201
  Please use the following citation in any publication using our *B3DB* dataset:
202
 
203
  ```md
 
214
  }
215
  ```
216
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
 
218