changed small thing in code snippet for reaction smile conversion
#5
by
Bienenwolf655
- opened
README.md
CHANGED
|
@@ -44,9 +44,9 @@ e.g. for the carbonic anhydrase reaction: ```r2sO.COO>>HCOOO.[H+]</s>```
|
|
| 44 |
or via this simple python script:
|
| 45 |
|
| 46 |
```python
|
| 47 |
-
# left reactants (seperated by
|
| 48 |
-
reactions = "CO2
|
| 49 |
-
# agents (seperated by
|
| 50 |
agent = ""
|
| 51 |
|
| 52 |
# https://stackoverflow.com/questions/54930121/converting-molecule-name-to-smiles
|
|
@@ -61,9 +61,9 @@ def CIRconvert(ids):
|
|
| 61 |
except:
|
| 62 |
return 'Did not work'
|
| 63 |
|
| 64 |
-
reagent = [CIRconvert(i) for i in reactions.replace(' ','').split('=')[0].split('
|
| 65 |
-
agent = [CIRconvert(i) for i in agent.replace(' ','').split('
|
| 66 |
-
product = [CIRconvert(i) for i in reactions.replace(' ','').split('=')[1].split('
|
| 67 |
f"r2s{'.'.join(reagent)}>{'.'.join(agent)}>{'.'.join(product)}</s>"
|
| 68 |
```
|
| 69 |
|
|
|
|
| 44 |
or via this simple python script:
|
| 45 |
|
| 46 |
```python
|
| 47 |
+
# left reactants (seperated by .) seperated by a equal sign from the products (seperated by .)
|
| 48 |
+
reactions = "CO2 . H2O = carbonic acid . H+"
|
| 49 |
+
# agents (seperated by .)
|
| 50 |
agent = ""
|
| 51 |
|
| 52 |
# https://stackoverflow.com/questions/54930121/converting-molecule-name-to-smiles
|
|
|
|
| 61 |
except:
|
| 62 |
return 'Did not work'
|
| 63 |
|
| 64 |
+
reagent = [CIRconvert(i) for i in reactions.replace(' ','').split('=')[0].split('.') if i != ""]
|
| 65 |
+
agent = [CIRconvert(i) for i in agent.replace(' ','').split('.') if i != ""]
|
| 66 |
+
product = [CIRconvert(i) for i in reactions.replace(' ','').split('=')[1].split('.') if i != ""]
|
| 67 |
f"r2s{'.'.join(reagent)}>{'.'.join(agent)}>{'.'.join(product)}</s>"
|
| 68 |
```
|
| 69 |
|