Skip to content

Commit e2cd140

Browse files
author
OliverBScott
committed
README update
1 parent f7cc107 commit e2cd140

1 file changed

Lines changed: 104 additions & 91 deletions

File tree

README.md

Lines changed: 104 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
<img width="80%", src="https://github.com/UCLCheminformatics/ScaffoldGraph/blob/master/img/scaffoldgraph.jpg?raw=true" />
1414
</p>
1515

16+
[Features](https://github.com/UCLCheminformatics/ScaffoldGraph#features) |
17+
[Installation](https://github.com/UCLCheminformatics/ScaffoldGraph#installation) |
18+
[Quick-start](https://github.com/UCLCheminformatics/ScaffoldGraph#quick-start) |
19+
[Contributing](https://github.com/UCLCheminformatics/ScaffoldGraph#contributing) |
20+
[References](https://github.com/UCLCheminformatics/ScaffoldGraph#references) |
21+
[Citation](https://github.com/UCLCheminformatics/ScaffoldGraph#citation)
22+
1623
## Features
1724

1825
* **Scaffold Network generation** (Varin, 2011)
@@ -180,7 +187,7 @@ Where "command" is one of: tree, network, hiers, aggregate or select.
180187
181188
Note: selecting subsets of a graph will not be possible if a name is not supplied
182189
183-
- ### Output Formats
190+
- #### Output Formats
184191

185192
- ##### TSV Format (default)
186193
@@ -211,20 +218,20 @@ Where "command" is one of: tree, network, hiers, aggregate or select.
211218
212219
--------------------------------------------------------------------------------
213220

214-
#### Library usage
221+
### Library usage
215222

216223
ScaffoldGraph makes it simple to construct a graph using the library API.
217224
The resultant graphs follow the same API as a NetworkX DiGraph.
218225

219-
```python
220-
import scaffoldgraph as sg
221-
222-
# construct a scaffold network from an SDF file
223-
network = sg.ScaffoldNetwork.from_sdf('my_sdf_file.sdf')
224-
225-
# construct a scaffold tree from a SMILES file
226-
tree = sg.ScaffoldTree.from_smiles('my_smiles_file.smi')
227-
```
226+
```python
227+
import scaffoldgraph as sg
228+
229+
# construct a scaffold network from an SDF file
230+
network = sg.ScaffoldNetwork.from_sdf('my_sdf_file.sdf')
231+
232+
# construct a scaffold tree from a SMILES file
233+
tree = sg.ScaffoldTree.from_smiles('my_smiles_file.smi')
234+
```
228235

229236

230237
--------------------------------------------------------------------------------
@@ -237,25 +244,25 @@ tree = sg.ScaffoldTree.from_smiles('my_smiles_file.smi')
237244
It is simple to construct a graph from multiple input source in parallel,
238245
using the concurrent.futures module and the sg.utils.aggregate function.
239246
240-
```python
241-
from concurrent.futures import ProcessPoolExecutor
242-
from functools import partial
243-
import scaffoldgraph as sg
244-
import os
245-
246-
directory = './data'
247-
sdf_files = [f for f in os.listdir(directory) if f.endswith('.sdf')]
248-
249-
func = partial(sg.ScaffoldNetwork.from_sdf, ring_cutoff=10)
250-
251-
graphs = []
252-
with ProcessPoolExecutor(max_workers=4) as executor:
253-
futures = executor.map(func, sdf_files)
254-
for future in futures:
255-
graphs.append(future)
256-
257-
network = sg.utils.aggregate(graphs)
258-
```
247+
```python
248+
from concurrent.futures import ProcessPoolExecutor
249+
from functools import partial
250+
import scaffoldgraph as sg
251+
import os
252+
253+
directory = './data'
254+
sdf_files = [f for f in os.listdir(directory) if f.endswith('.sdf')]
255+
256+
func = partial(sg.ScaffoldNetwork.from_sdf, ring_cutoff=10)
257+
258+
graphs = []
259+
with ProcessPoolExecutor(max_workers=4) as executor:
260+
futures = executor.map(func, sdf_files)
261+
for future in futures:
262+
graphs.append(future)
263+
264+
network = sg.utils.aggregate(graphs)
265+
```
259266
260267
- **Creating custom scaffold prioritisation rules**
261268

@@ -267,71 +274,71 @@ tree = sg.ScaffoldTree.from_smiles('my_smiles_file.smi')
267274
When subclassing a name property must be defined and either a condition, get_property or filter function.
268275
Examples are shown below:
269276
270-
```python
271-
import scaffoldgraph as sg
272-
from scaffoldgraph.prioritization import *
273-
274-
"""
275-
Scaffold filter rule (must implement name and condition)
276-
The filter will retain all scaffolds which return a True condition
277-
"""
278-
279-
class CustomRule01(ScaffoldFilterRule):
280-
"""Do not remove rings with >= 12 atoms if there are smaller rings to remove"""
281-
282-
def condition(self, child, parent):
283-
removed_ring = child.rings[parent.removed_ring_idx]
284-
return removed_ring.size < 12
277+
```python
278+
import scaffoldgraph as sg
279+
from scaffoldgraph.prioritization import *
280+
281+
"""
282+
Scaffold filter rule (must implement name and condition)
283+
The filter will retain all scaffolds which return a True condition
284+
"""
285+
286+
class CustomRule01(ScaffoldFilterRule):
287+
"""Do not remove rings with >= 12 atoms if there are smaller rings to remove"""
288+
289+
def condition(self, child, parent):
290+
removed_ring = child.rings[parent.removed_ring_idx]
291+
return removed_ring.size < 12
292+
293+
@property
294+
def name(self):
295+
return 'custom rule 01'
296+
297+
"""
298+
Scaffold min/max filter rule (must implement name and get_property)
299+
The filter will retain all scaffolds with the min/max property value
300+
"""
301+
302+
class CustomRule02(ScaffoldMinFilterRule):
303+
"""Smaller rings are removed first"""
304+
305+
def get_property(self, child, parent):
306+
return child.rings[parent.removed_ring_idx].size
307+
308+
@property
309+
def name(self):
310+
return 'custom rule 02'
285311
286-
@property
287-
def name(self):
288-
return 'custom rule 01'
289312
290-
"""
291-
Scaffold min/max filter rule (must implement name and get_property)
292-
The filter will retain all scaffolds with the min/max property value
293-
"""
294-
295-
class CustomRule02(ScaffoldMinFilterRule):
296-
"""Smaller rings are removed first"""
297-
298-
def get_property(self, child, parent):
299-
return child.rings[parent.removed_ring_idx].size
300-
301-
@property
302-
def name(self):
303-
return 'custom rule 02'
304-
313+
"""
314+
Scaffold base filter rule (must implement name and filter)
315+
The filter method must return a list of filtered parent scaffolds
316+
This rule is used when a more complex rule is required, this example
317+
defines a tiebreaker rule. Only one scaffold must be left at the end
318+
of all filter rules in a rule set
319+
"""
305320
306-
"""
307-
Scaffold base filter rule (must implement name and filter)
308-
The filter method must return a list of filtered parent scaffolds
309-
This rule is used when a more complex rule is required, this example
310-
defines a tiebreaker rule. Only one scaffold must be left at the end
311-
of all filter rules in a rule set
312-
"""
313-
314-
class CustomRule03(BaseScaffoldFilterRule):
315-
"""Tie-breaker rule (alphabetical)"""
316-
317-
def filter(self, child, parents):
318-
return [sorted(parents, key=lambda p: p.smiles)[0]]
319-
320-
@property
321-
def name(self):
322-
return 'cutstom rule 03'
323-
```
321+
class CustomRule03(BaseScaffoldFilterRule):
322+
"""Tie-breaker rule (alphabetical)"""
323+
324+
def filter(self, child, parents):
325+
return [sorted(parents, key=lambda p: p.smiles)[0]]
326+
327+
@property
328+
def name(self):
329+
return 'cutstom rule 03'
330+
```
324331
325332
Custom rules can subsequently be added to a rule set and supplied to the scaffold tree constructor:
326333
327-
```python
328-
ruleset = ScaffoldRuleSet(name='custom rules')
329-
ruleset.add_rule(CustomRule01())
330-
ruleset.add_rule(CustomRule02())
331-
ruleset.add_rule(CustomRule03())
332-
333-
graph = sg.ScaffoldTree.from_sdf('my_sdf_file.sdf', prioritization_rules=ruleset)
334-
```
334+
```python
335+
ruleset = ScaffoldRuleSet(name='custom rules')
336+
ruleset.add_rule(CustomRule01())
337+
ruleset.add_rule(CustomRule02())
338+
ruleset.add_rule(CustomRule03())
339+
340+
graph = sg.ScaffoldTree.from_sdf('my_sdf_file.sdf', prioritization_rules=ruleset)
341+
```
335342

336343
--------------------------------------------------------------------------------
337344

@@ -347,7 +354,7 @@ Contributions to ScaffoldGraph will most likely fall into the following categori
347354
Request please provide a clear description of the encountered bug. If unsure feel free to post an issue
348355

349356
Please send Pull Requests to:
350-
http://github.com/UCLCheminformatics/scaffoldgraph
357+
http://github.com/UCLCheminformatics/ScaffoldGraph
351358

352359
### Testing
353360

@@ -374,4 +381,10 @@ ScaffoldGraph uses Travis CI for continuous integration
374381
* Varin, T., Schuffenhauer, A., Ertl, P., and Renner, S. (2011). Mining for bioactive scaffolds with scaffold networks: Improved compound set enrichment from primary screening data. Journal of Chemical Information and Modeling, 51(7), 1528–1538.
375382
* Varin, T., Gubler, H., Parker, C., Zhang, J., Raman, P., Ertl, P. and Schuffenhauer, A. (2010) Compound Set Enrichment: A Novel Approach to Analysis of Primary HTS Data. Journal of Chemical Information and Modeling, 50(12), 2067-2078.
376383
* Wetzel, S., Klein, K., Renner, S., Rennerauh, D., Oprea, T. I., Mutzel, P., and Waldmann, H. (2009). Interactive exploration of chemical space with scaffold hunter. Nat Chem Biol, 1875(8), 581–583.
377-
* Wilkens, J., Janes, J. and Su, A. (2005). HierS:  Hierarchical Scaffold Clustering Using Topological Chemical Graphs. Journal of Medicinal Chemistry, 48(9), 3182-3193.
384+
* Wilkens, J., Janes, J. and Su, A. (2005). HierS:  Hierarchical Scaffold Clustering Using Topological Chemical Graphs. Journal of Medicinal Chemistry, 48(9), 3182-3193.
385+
386+
---------------------------------------------------------------------------------
387+
388+
## Citation
389+
390+
Pending...

0 commit comments

Comments
 (0)