Skip to content

Commit bc5d5b6

Browse files
committed
ss-master: push new version
1 parent f27f3a3 commit bc5d5b6

6 files changed

Lines changed: 8 additions & 2762 deletions

File tree

README.md

Lines changed: 6 additions & 293 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ pattern matching (SMARTS).
2525
<img width="800" height="400" src="images/globalchemlogo.png">
2626
</p>
2727

28+
Docs
29+
====
30+
31+
Link to Documentation: [![Documentation](https://img.shields.io/badge/GitBook-Docu-lightblue)](https://sulstice.gitbook.io/globalchem-your-chemical-graph-network/)
32+
2833
Installation
2934
============
3035

@@ -46,8 +51,6 @@ pip install global-chem-extensions
4651
4752
```
4853

49-
50-
5154
Rules
5255
=====
5356

@@ -68,244 +71,6 @@ Quick Start
6871
Just with no dependencies, intialize the class and there you go! All the common and rare groups of the world
6972
at your disposal
7073

71-
#### Print the GlobalChem Structure
72-
73-
```python
74-
75-
gc = GlobalChem()
76-
gc.print_globalchem_network()
77-
78-
>>>
79-
80-
┌solvents─common_organic_solvents
81-
┌organic_synthesis─└protecting_groups─amino_acid_protecting_groups
82-
│ ┌polymers─common_monomer_repeating_units
83-
├materials─└clay─montmorillonite_adsorption
84-
│ ┌privileged_kinase_inhibtors
85-
│ ├privileged_scaffolds
86-
├proteins─kinases─┌scaffolds─├iupac_blue_book_substituents
87-
│ │ └common_r_group_replacements
88-
│ └braf─inhibitors
89-
│ ┌vitamins
90-
│ ├open_smiles
91-
├miscellaneous─├amino_acids
92-
│ └regex_patterns
93-
global_chem──├environment─emerging_perfluoroalkyls
94-
│ ┌schedule_one
95-
│ ├schedule_four
96-
│ ├schedule_five
97-
├narcotics─├pihkal
98-
│ ├schedule_two
99-
│ └schedule_three
100-
├interstellar_space
101-
│ ┌cannabinoids
102-
│ │ ┌electrophillic_warheads_for_kinases
103-
│ ├warheads─└common_warheads_covalent_inhibitors
104-
└medicinal_chemistry─│ ┌phase_2_hetereocyclic_rings
105-
└rings─├iupac_blue_book_rings
106-
└rings_in_drugs
107-
108-
```
109-
#### To Access Nodes and Visualize the Internal Network:
110-
111-
```python
112-
113-
from global_chem import GlobalChem
114-
115-
gc = GlobalChem()
116-
117-
nodes_list = gc.check_available_nodes()
118-
print (nodes_list)
119-
120-
>>>
121-
'emerging_perfluoro_alkyls', 'montmorillonite_adsorption', 'common_monomer_repeating_units', 'electrophilic_warheads_for_kinases',
122-
123-
gc.build_global_chem_network(print_output=True)
124-
125-
>>>
126-
'global_chem': {
127-
'children': [
128-
'environment',
129-
'miscellaneous',
130-
'organic_synthesis',
131-
'medicinal_chemistry',
132-
'narcotics',
133-
'interstellar_space',
134-
'proteins',
135-
'materials'
136-
],
137-
'name': 'global_chem',
138-
'node_value': <global_chem.global_chem.Node object at 0x10f60eed0>,
139-
'parents': []
140-
},
141-
```
142-
143-
The algorithm uses a series of parents/children to connect nodes instead of "edges" as in traditional graph networks. This just makes it easier to code if
144-
the graph database lives as a 1-dimensional with lists of parents and childrens connected in this fashion.
145-
146-
#### Fetch the Node:
147-
148-
```python
149-
150-
gc = GlobalChem()
151-
gc.build_global_chem_network(print_output=False, debugger=False)
152-
node = gc.get_node('emerging_perfluoroalkyls').get_smiles()
153-
print (node)
154-
155-
```
156-
157-
#### Fetch the IUPAC:SMILES/SMARTS Data from the Node:
158-
159-
```python
160-
161-
gc = GlobalChem()
162-
gc.build_global_chem_network(print_output=True, debugger=False)
163-
smiles = gc.get_node_smiles('emerging_perfluoroalkyls')
164-
smarts = gc.get_node_smarts('emerging_perfluoroalkyls')
165-
166-
print (smiles)
167-
```
168-
169-
#### Fetch All Data from Network:
170-
171-
```python
172-
173-
gc = GlobalChem()
174-
print(gc.get_all_smiles())
175-
print(gc.get_all_smarts())
176-
print(gc.get_all_names())
177-
178-
>>>
179-
['C(=O)(C(C(C(C(C(F)(F)F)(F)F)(F)F)(F)F)(F)F)O', 'C(=O)(C(C(C(C(C(C(F)(F)F)(F)F)(F)F)(F)F)(F)F)(F)F)O' etc...]
180-
181-
```
182-
183-
#### Remove a Node from the Network:
184-
185-
Removes the Node and it's connections to any parents.
186-
187-
```python
188-
189-
gc = GlobalChem()
190-
gc.build_global_chem_network(print_output=False, debugger=False)
191-
gc.remove_node('emerging_perfluoroalkyls')
192-
193-
```
194-
195-
#### Fetch a SMILES By IUPAC
196-
197-
```python
198-
199-
gc = GlobalChem()
200-
definition = gc.get_smiles_by_iupac(
201-
'benzene',
202-
return_network_path=False,
203-
return_all_network_paths=False
204-
)
205-
206-
```
207-
#### Set & Get the Node Value:
208-
209-
If the user wants to put some metadata inside the node they can:
210-
211-
```python
212-
213-
gc = GlobalChem()
214-
gc.build_global_chem_network(print_output=True, debugger=False)
215-
gc.set_node_value('emerging_perfluoroalkyls', {'some_data': ['bunny']})
216-
print (gc.get_node_value('emerging_perfluoroalkyls'))
217-
218-
>>>
219-
{'some_data': ['bunny']}
220-
```
221-
222-
#### To Create Your Own Chemical Graph Network (GN) And Check the Values
223-
224-
```python
225-
226-
from global_chem import GlobalChem
227-
228-
gc = GlobalChem(verbose=False)
229-
gc.initiate_network()
230-
gc.add_node('global_chem', 'common_monomer_repeating_units')
231-
gc.add_node('common_monomer_repeating_units','electrophilic_warheads_for_kinases')
232-
values = gc.get_node_smiles('common_monomer_repeating_units')
233-
234-
print (values)
235-
236-
>>>
237-
'3′-bromo-2-chloro[1,1′:4′,1′′-terphenyl]-4,4′′': 'ClC1=CC=CC=C1C2=CC=C(C3=CC=CC=C3)C(Br)=C2'
238-
239-
values = gc.get_node_smarts('electrophilic_warheads_for_kinases')
240-
241-
>>>
242-
'propane-1,3-diyl': '[#6]-[#6]-[#6]', 'methylmethylene': '[#6H]-[#6]',
243-
244-
```
245-
246-
#### Creating Deep Layer Chemical Graph Networks (DGN) & Print it out:
247-
248-
This is for more advanced users of graph theory and understanding.
249-
250-
```python
251-
252-
gc = GlobalChem()
253-
gc.initiate_deep_layer_network()
254-
gc.add_deep_layer(
255-
[
256-
'emerging_perfluoroalkyls',
257-
'montmorillonite_adsorption',
258-
'common_monomer_repeating_units'
259-
]
260-
)
261-
gc.add_deep_layer(
262-
[
263-
'common_warhead_covalent_inhibitors',
264-
'privileged_scaffolds',
265-
'iupac_blue_book'
266-
]
267-
)
268-
269-
gc.print_deep_network()
270-
271-
272-
>>>
273-
┌common_warhead_covalent_inhibitors
274-
┌emerging_perfluoroalkyls─├privileged_scaffolds
275-
│ └iupac_blue_book
276-
│ ┌common_warhead_covalent_inhibitors
277-
global_chem─├montmorillonite_adsorption─├privileged_scaffolds
278-
│ └iupac_blue_book
279-
│ ┌common_warhead_covalent_inhibitors
280-
└common_monomer_repeating_units─├privileged_scaffolds
281-
└iupac_blue_book
282-
283-
```
284-
285-
#### Compute Common Score for an IUPAC Name:
286-
287-
Based on how many times a word is mentioned per object increases the common weight. The more weight the more common.
288-
A score of 0 indicates it is "uncommon".
289-
290-
```
291-
292-
Common Score Algorithm:
293-
294-
1.) Data mine the current state of GlobalChem
295-
2.) Get the Object Weights of Each mention
296-
3.) Determine the Mention Weight
297-
4.) Sum the Weights and That's How common it is.
298-
299-
```
300-
301-
```python
302-
303-
gc = GlobalChem()
304-
gc.build_global_chem_network(print_output=False, debugger=False)
305-
gc.compute_common_score('benzene', verbose=True)
306-
307-
```
308-
30974
Adding Your Own Chemical List
31075
=============================
31176

@@ -324,58 +89,6 @@ smiles = {
32489
32590
```
32691

327-
GlobalChem Extensions
328-
=====================
329-
330-
Applications of `GlobalChem` can be applied to a variety of cheminformatic usage. One of which is functional group analysos of
331-
any SMILES dataset using the SMARTS patterns strings described in the data. GlobalChemExtensions have
332-
333-
334-
#### Sunbursting
335-
336-
Please navigate here for more documentation: https://github.com/Sulstice/global-chem-extensions
337-
```python
338-
339-
from global_chem_extensions.global_chem_extensions import GlobalChemExtensions
340-
341-
test_set = [
342-
'c1[n+](cc2n(c1OCCc1cc(c(cc1)F)F)c(nn2)c1ccc(cc1)OC(F)F)[O-]',
343-
'c1nc(c2n(c1OCCc1cc(c(cc1)F)F)c(nn2)c1ccc(cc1)OC(F)F)Cl',
344-
'c1ncc2n(c1CCO)c(nn2)c1ccc(cc1)OC(F)F',
345-
'C1NCc2n(C1CCO)c(nn2)c1ccc(cc1)OC(F)F',
346-
'C1(CN(C1)c1cc(c(cc1)F)F)Oc1cncc2n1c(nn2)c1ccc(cc1)OC(F)F',
347-
'c1ncc2n(c1N1CCC(C1)c1ccccc1)c(nn2)c1ccc(cc1)OC(F)F',
348-
]
349-
350-
GlobalChemExtensions().sunburst_chemical_list(test_set, save_file=False)
351-
352-
```
353-
354-
<p align="center">
355-
<img width="550" height="500" src="images/extensions/figure_1.gif">
356-
</p>
357-
358-
#### PCA Analysis
359-
360-
Conduct PCA Analysis with a SMILES list input.
361-
362-
```python
363-
364-
from global_chem.global_chem import GlobalChem
365-
from global_chem_extensions.global_chem_extensions import GlobalChemExtensions
366-
367-
gc = GlobalChem()
368-
gc.build_global_chem_network(print_output=False, debugger=False)
369-
smiles_list = list(gc.get_node_smiles('schedule_one').values())
370-
371-
GlobalChemExtensions().node_pca_analysis(smiles_list, save_file=False)
372-
373-
```
374-
375-
<p align="center">
376-
<img width="500" height="450" src="images/extensions/pca_analysis.gif">
377-
</p>
378-
37992
Nodes List
38093
==============
38194

@@ -404,6 +117,7 @@ Nodes List
404117
| Schedule 3 United States Narcotics | 22 | ECFR :: 21 CFR Part 1308 - Schedules. |
405118
| Schedule 4 United States Narcotics | 77 | ECFR :: 21 CFR Part 1308 - Schedules. |
406119
| Schedule 5 United States Narcotics | 8 | ECFR :: 21 CFR Part 1308 - Schedules. |
120+
| Pihkal | 179 | Shulgin, Alexander T., and Ann Shulgin. Pihkal: A Chemical Love Story. 1. ed., 8. print, Transform, 2010. |
407121
| Common Regex Patterns | 1 | |
408122

409123

@@ -433,6 +147,5 @@ Citation
433147
It's on it's way
434148

435149

436-
437150
## License
438151
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FSulstice%2Fglobal-chem.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FSulstice%2Fglobal-chem?ref=badge_large)

0 commit comments

Comments
 (0)