Spaces:
Runtime error
Runtime error
Update app.py
#2
by
alidenewade
- opened
app.py
CHANGED
@@ -1,47 +1,30 @@
|
|
1 |
import streamlit as st
|
2 |
-
import ipywidgets
|
3 |
import py3Dmol
|
4 |
-
|
5 |
-
|
6 |
from rdkit import Chem
|
7 |
-
from rdkit.Chem import Draw
|
8 |
-
from PIL import Image
|
9 |
-
from rdkit import Chem
|
10 |
-
from rdkit.Chem import AllChem
|
11 |
-
from ipywidgets import interact,fixed,IntSlider
|
12 |
-
import streamlit as st
|
13 |
import streamlit.components.v1 as components
|
14 |
-
import py3Dmol
|
15 |
-
from rdkit import Chem
|
16 |
-
from rdkit.Chem import Draw
|
17 |
-
from rdkit.Chem import AllChem
|
18 |
|
|
|
19 |
|
20 |
-
def
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
24 |
mol = Chem.AddHs(mol)
|
25 |
AllChem.EmbedMolecule(mol)
|
26 |
AllChem.MMFFOptimizeMolecule(mol, maxIters=200)
|
27 |
return mol
|
28 |
-
|
|
|
29 |
return None
|
30 |
|
31 |
-
def
|
32 |
-
"""
|
33 |
-
|
34 |
-
Args:
|
35 |
-
----
|
36 |
-
mol: rdMol, molecule to show
|
37 |
-
size: tuple(int, int), canvas size
|
38 |
-
style: str, type of drawing molecule
|
39 |
-
style can be 'line', 'stick', 'sphere', 'carton'
|
40 |
-
surface, bool, display SAS
|
41 |
-
opacity, float, opacity of surface, range 0.0-1.0
|
42 |
-
Return:
|
43 |
-
----
|
44 |
-
viewer: py3Dmol.view, a class for constructing embedded 3Dmol.js views in ipython notebooks.
|
45 |
"""
|
46 |
assert style in ('line', 'stick', 'sphere', 'carton')
|
47 |
mblock = Chem.MolToMolBlock(mol)
|
@@ -51,167 +34,111 @@ def MolTo3DView(mol, size=(300, 300), style="stick", surface=False, opacity=0.5)
|
|
51 |
if surface:
|
52 |
viewer.addSurface(py3Dmol.SAS, {'opacity': opacity})
|
53 |
viewer.zoomTo()
|
54 |
-
|
55 |
-
|
56 |
-
def MakeMolecule(name, ingredients):
|
57 |
-
st.write(name, ": ", ingredients)
|
58 |
-
m = Chem.MolFromSmiles(ingredients)
|
59 |
-
im=Draw.MolToImage(m)
|
60 |
-
st.image(im)
|
61 |
-
|
62 |
-
def conf_viewer(idx):
|
63 |
-
mol = confs[idx]
|
64 |
-
return MolTo3DView(mol).show()
|
65 |
-
|
66 |
-
def style_selector(idx, s):
|
67 |
-
conf = confs[idx]
|
68 |
-
return MolTo3DView(conf, style=s).show()
|
69 |
-
|
70 |
-
@interact
|
71 |
-
def smi2viewer(smi='CC=O'):
|
72 |
-
try:
|
73 |
-
conf = smi2conf(smi)
|
74 |
-
return MolTo3DView(conf).show()
|
75 |
-
except:
|
76 |
-
return None
|
77 |
-
|
78 |
-
smi = 'COc3nc(OCc2ccc(C#N)c(c1ccc(C(=O)O)cc1)c2P(=O)(O)O)ccc3C[NH2+]CC(I)NC(=O)C(F)(Cl)Br'
|
79 |
-
conf = smi2conf(smi)
|
80 |
-
viewer = MolTo3DView(conf, size=(600, 300), style='sphere')
|
81 |
-
viewer.show()
|
82 |
-
|
83 |
-
#compound_smiles = 'c1cc(C(=O)O)c(OC(=O)C)cc1'
|
84 |
-
#m = Chem.MolFromSmiles(compound_smiles)
|
85 |
-
#im=Draw.MolToImage(m)
|
86 |
-
#st.image(im)
|
87 |
-
|
88 |
-
|
89 |
-
viewer = MolTo3DView(conf, size=(600, 300), style='sphere')
|
90 |
-
viewer.show()
|
91 |
-
|
92 |
-
smis = [ 'COc3nc(OCc2ccc(C#N)c(c1ccc(C(=O)O)cc1)c2P(=O)(O)O)ccc3C[NH2+]CC(I)NC(=O)C(F)(Cl)Br',
|
93 |
-
'CC(NCCNCC1=CC=C(OCC2=C(C)C(C3=CC=CC=C3)=CC=C2)N=C1OC)=O',
|
94 |
-
'Cc1c(COc2cc(OCc3cccc(c3)C#N)c(CN3C[C@H](O)C[C@H]3C(O)=O)cc2Cl)cccc1-c1ccc2OCCOc2c1',
|
95 |
-
'CCCCC(=O)NCCCCC(=O)NCCCCCC(=O)[O-]',
|
96 |
-
"CC(NCCNCC1=CC=C(OCC2=C(C)C(C3=CC=CC=C3)=CC=C2)N=C1OC)=O"]
|
97 |
-
|
98 |
-
confs = [smi2conf(s) for s in smis]
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
-
st.title('⚛️🧬Molecule Modeler🧬⚛️')
|
102 |
|
|
|
103 |
|
|
|
|
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
AllChem.MMFFOptimizeMolecule(mol, maxIters=200)
|
110 |
-
mblock = Chem.MolToMolBlock(mol)
|
111 |
|
112 |
-
view = py3Dmol.view(width=400, height=400)
|
113 |
-
view.addModel(mblock, 'mol')
|
114 |
-
view.setStyle({style:{}})
|
115 |
-
view.zoomTo()
|
116 |
-
view.show()
|
117 |
-
view.render()
|
118 |
-
t =view.js()
|
119 |
-
f = open('viz.html', 'w')
|
120 |
-
f.write(t.startjs)
|
121 |
-
f.write(t.endjs)
|
122 |
-
f.close()
|
123 |
-
|
124 |
-
compound_smiles=st.text_input('SMILES please','CCCCC(=O)NCCCCC(=O)NCCCCCC(=O)[O-]')
|
125 |
-
m = Chem.MolFromSmiles(compound_smiles)
|
126 |
-
|
127 |
-
#Draw.MolToFile(m,'mol.png')
|
128 |
-
|
129 |
-
show(compound_smiles)
|
130 |
-
HtmlFile = open("viz.html", 'r', encoding='utf-8')
|
131 |
-
source_code = HtmlFile.read()
|
132 |
-
c1,c2=st.columns(2)
|
133 |
with c1:
|
134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
with c2:
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
MakeMolecule("DNA", "C1C(C(OC1N)COP(=O)(O)OC2CC(OC2COP(=O)(O)OC3CC(OC3CO)N)N)O")
|
148 |
-
MakeMolecule("Trecovirsen DNA", "CC1=CN(C(=O)NC1=O)C2CC(C(O2)COP(=S)(O)OC3CC(OC3COP(=S)(O)OC4CC(OC4COP(=S)(O)OC5CC(OC5COP(=S)(O)OC6CC(OC6COP(=S)(O)OC7CC(OC7COP(=S)(O)OC8CC(OC8COP(=S)(O)OC9CC(OC9COP(=S)(O)OC1CC(OC1COP(=S)(O)OC1CC(OC1COP(=S)(O)OC1CC(OC1COP(=S)(O)OC1CC(OC1COP(=S)(O)OC1CC(OC1COP(=S)(O)OC1CC(OC1COP(=S)(O)OC1CC(OC1COP(=S)(O)OC1CC(OC1COP(=S)(O)OC1CC(OC1COP(=S)(O)OC1CC(OC1COP(=S)(O)OC1CC(OC1COP(=S)(O)OC1CC(OC1COP(=S)(O)OC1CC(OC1COP(=S)(O)OC1CC(OC1COP(=S)(O)OC1CC(OC1COP(=S)(O)OC1CC(OC1COP(=S)(O)OC1CC(OC1CO)N1C=CC(=NC1=O)N)N1C=C(C(=O)NC1=O)C)N1C=CC(=NC1=O)N)N1C=C(C(=O)NC1=O)C)N1C=CC(=NC1=O)N)N1C=NC2=C1N=C(NC2=O)N)N1C=CC(=NC1=O)N)N1C=NC2=C(N=CN=C21)N)N1C=CC(=NC1=O)N)N1C=CC(=NC1=O)N)N1C=CC(=NC1=O)N)N1C=NC2=C(N=CN=C21)N)N1C=C(C(=O)NC1=O)C)N1C=CC(=NC1=O)N)N1C=C(C(=O)NC1=O)C)N1C=CC(=NC1=O)N)N1C=C(C(=O)NC1=O)C)N1C=CC(=NC1=O)N)N1C=C(C(=O)NC1=O)C)N1C=CC(=NC1=O)N)N1C=CC(=NC1=O)N)N1C=C(C(=O)NC1=O)C)N1C=C(C(=O)NC1=O)C)N1C=CC(=NC1=O)N)O")
|
149 |
|
150 |
|
151 |
-
|
152 |
-
MakeMolecule("Thiamine (vitamin B1, C12H17N4OS+)", "OCCc1c(C)[n+](cs1)Cc2cnc(C)nc2N")
|
153 |
-
MakeMolecule("Vitamin E", "CC(C)CCC[C@@H](C)CCC[C@@H](C)CCC [C@]1(C)CCc2c(C)c(O)c(C)c(C)c2O1")
|
154 |
-
MakeMolecule("Vitamin K2", "CC1=C(C(=O)C2=CC=CC=C2C1=O)CC=C(C)CCC=C(C)CCC=C(C)CCC=C(C)C")
|
155 |
-
MakeMolecule("Vitamin K1", "CC(C)CCCC(C)CCCC(C)CCCC(=CCC12C(=O)C3=CC=CC=C3C(=O)C1(O2)C)C")
|
156 |
-
MakeMolecule("Vitamin D3", "C[C@@H]([C@@H]1C2([C@H](/C(=C/C=C/3\C(=C)CCC(C3)O)/CCC2)CC1)C)CCCC(C)C.C[C@@H]([C@@H]1C2([C@H](/C(=C/C=C/3\C(=C)CCC(C3)O)/CCC2)CC1)C)CCCC(C)C")
|
157 |
|
158 |
-
|
159 |
-
|
160 |
-
MakeMolecule("Ritonavir", "CC(C)C1=NC(=CS1)CN(C)C(=O)N[C@@H](C(C)C)C(=O)N[C@@H](CC2=CC=CC=C2)C[C@@H]([C@H](CC3=CC=CC=C3)NC(=O)OCC4=CN=CS4)O")
|
161 |
-
MakeMolecule("Chloroquine", "CCN(CC)CCCC(C)NC1=C2C=CC(=CC2=NC=C1)Cl")
|
162 |
-
MakeMolecule("Fingolimod", "CCCCCCCCC1=CC=C(C=C1)CCC(CO)(CO)N")
|
163 |
-
MakeMolecule("N4-Hydroxycytidine", "C1=CN(C(=O)N=C1NO)[C@H]2[C@@H]([C@@H]([C@H](O2)CO)O)O")
|
164 |
|
165 |
-
st.
|
166 |
-
st.write('Option 1: Symbicort @ Budesonide 160 mcg with Formoterol Fumurate Dihydrate 4.5 mcg')
|
167 |
-
st.write('Option 2: Dulera @ Mometasone 200 mcg with Formoterol Fumurate Dihydrate 5 mcg')
|
168 |
-
st.write('Symbicort - https://pubchem.ncbi.nlm.nih.gov/#query=Symbicort - Isomeric SMILES: CCCC1O[C@@H]2C[C@H]3[C@@H]4CCC5=CC(=O)C=C[C@@]5([C@H]4[C@H](C[C@@]3([C@@]2(O1)C(=O)CO)C)O)C.C[C@@H](CC1=CC=C(C=C1)OC)NC[C@H](C2=CC(=C(C=C2)O)NC=O)O')
|
169 |
-
st.write('Dulera - https://pubchem.ncbi.nlm.nih.gov/#query=Dulera - Isomeric SMILES: C[C@@H]1C[C@H]2[C@@H]3CCC4=CC(=O)C=C[C@@]4([C@]3([C@H](C[C@@]2([C@]1(C(=O)CCl)OC(=O)C5=CC=CO5)C)O)Cl)C.C[C@H](CC1=CC=C(C=C1)OC)NC[C@@H](C2=CC(=C(C=C2)O)NC=O)O.C[C@H](CC1=CC=C(C=C1)OC)NC[C@@H](C2=CC(=C(C=C2)O)NC=O)O.C(=C/C(=O)O)\C(=O)O.O.O')
|
170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
|
172 |
-
|
173 |
-
st.
|
174 |
-
|
|
|
|
|
175 |
|
176 |
-
|
177 |
-
|
|
|
|
|
|
|
178 |
|
179 |
-
|
180 |
-
MakeMolecule("Cyclohexane", "C1CCCCC1")
|
181 |
-
MakeMolecule("Pyridine", "c1cnccc1")
|
182 |
|
183 |
-
|
184 |
-
|
185 |
-
MakeMolecule("Copper(II) sulfate", "[Cu+2].[O-]S(=O)(=O)[O-]")
|
186 |
-
MakeMolecule("Flavopereirin (C17H15N2)", "CCc(c1)ccc2[n+]1ccc3c2[nH]c4c3cccc4 CCc1c[n+]2ccc3c4ccccc4[nH]c3c2cc1")
|
187 |
-
MakeMolecule("cephalostatin-1", "CC(C)(O1)C[C@@H](O)[C@@]1(O2)[C@@H](C)[C@@H]3CC=C4[C@]3(C2)C(=O)C[C@H]5[C@H]4CC[C@@H](C6)[C@]5(C)Cc(n7)c6nc(C[C@@]89(C))c7C[C@@H]8CC[C@@H]%10[C@@H]9C[C@@H](O)[C@@]%11(C)C%10=C[C@H](O%12)[C@]%11(O)[C@H](C)[C@]%12(O%13)[C@H](O)C[C@@]%13(C)CO")
|
188 |
|
189 |
-
# Request list:
|
190 |
markDown = '''
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
4. Zolpidem Tartrate (Ambien). https://pubchem.ncbi.nlm.nih.gov/#query=Zolpidem - CC1=CC=C(C=C1)C2=C(N3C=C(C=CC3=N2)C)CC(=O)N(C)C
|
206 |
-
5. Sertraline (Zoloft). https://pubchem.ncbi.nlm.nih.gov/#query=Sertraline - CN[C@H]1CC[C@H](C2=CC=CC=C12)C3=CC(=C(C=C3)Cl)Cl
|
207 |
-
|
208 |
-
# Stimulants
|
209 |
-
1. Dextroamphetamine (Dexedrine). https://pubchem.ncbi.nlm.nih.gov/#query=Dextroamphetamine - C[C@@H](CC1=CC=CC=C1)N
|
210 |
-
2. Methylphenidate (Ritalin and Concerta). https://pubchem.ncbi.nlm.nih.gov/#query=Methylphenidate - COC(=O)C(C1CCCCN1)C2=CC=CC=C2
|
211 |
-
3. Amphetamines (Adderall). https://pubchem.ncbi.nlm.nih.gov/#query=Amphetamines - C[C@@H](CC1=CC=CC=C1)N.C[C@@H](CC1=CC=CC=C1)N.C[C@@H](CC1=CC=CC=C1)N.C[C@@H](CC1=CC=CC=C1)N.CC(CC1=CC=CC=C1)N.CC(CC1=CC=CC=C1)N.C([C@@H](C(=O)O)N)C(=O)O.[C@H]([C@@H]([C@@H](C(=O)O)O)O)([C@H](C(=O)O)O)O.OS(=O)(=O)O.OS(=O)(=O)O
|
212 |
-
|
213 |
-
# More at PubChem: https://pubchem.ncbi.nlm.nih.gov/substance/135324815#section=Identity
|
214 |
'''
|
215 |
-
|
216 |
-
|
217 |
-
st.write(markDown)
|
|
|
1 |
import streamlit as st
|
|
|
2 |
import py3Dmol
|
|
|
|
|
3 |
from rdkit import Chem
|
4 |
+
from rdkit.Chem import AllChem, Draw
|
|
|
|
|
|
|
|
|
|
|
5 |
import streamlit.components.v1 as components
|
|
|
|
|
|
|
|
|
6 |
|
7 |
+
# --- Helper Functions ---
|
8 |
|
9 |
+
def smi_to_3d_mol(smiles):
|
10 |
+
"""
|
11 |
+
Converts a SMILES string to an RDKit Mol object with 3D coordinates.
|
12 |
+
"""
|
13 |
+
try:
|
14 |
+
mol = Chem.MolFromSmiles(smiles)
|
15 |
+
if mol is None:
|
16 |
+
return None
|
17 |
mol = Chem.AddHs(mol)
|
18 |
AllChem.EmbedMolecule(mol)
|
19 |
AllChem.MMFFOptimizeMolecule(mol, maxIters=200)
|
20 |
return mol
|
21 |
+
except Exception as e:
|
22 |
+
st.error(f"Error processing SMILES: {e}")
|
23 |
return None
|
24 |
|
25 |
+
def render_3d_viewer(mol, style="stick", size=(500, 500), surface=False, opacity=0.5):
|
26 |
+
"""
|
27 |
+
Creates a py3Dmol viewer and returns its HTML representation for Streamlit.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
"""
|
29 |
assert style in ('line', 'stick', 'sphere', 'carton')
|
30 |
mblock = Chem.MolToMolBlock(mol)
|
|
|
34 |
if surface:
|
35 |
viewer.addSurface(py3Dmol.SAS, {'opacity': opacity})
|
36 |
viewer.zoomTo()
|
37 |
+
# Return the viewer's HTML/JS representation for Streamlit
|
38 |
+
return viewer.js()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
+
def render_2d_image(name, ingredients):
|
41 |
+
"""
|
42 |
+
Displays the name and a 2D image of a molecule in a Streamlit column.
|
43 |
+
"""
|
44 |
+
mol = Chem.MolFromSmiles(ingredients)
|
45 |
+
if mol:
|
46 |
+
st.write(f"**{name}**")
|
47 |
+
img = Draw.MolToImage(mol)
|
48 |
+
st.image(img, caption=ingredients)
|
49 |
+
else:
|
50 |
+
st.warning(f"Could not generate molecule for '{name}'.")
|
51 |
|
|
|
52 |
|
53 |
+
# --- Main Streamlit App ---
|
54 |
|
55 |
+
st.set_page_config(layout="wide")
|
56 |
+
st.title('⚛️🧬 Molecule Modeler 🧬⚛️')
|
57 |
|
58 |
+
# --- Interactive 3D Viewer Section ---
|
59 |
+
st.header("Interactive 3D Molecule Viewer")
|
60 |
+
# Create two columns for the input and the viewer
|
61 |
+
c1, c2 = st.columns([1, 2]) # Input column is 1/3 of the width
|
|
|
|
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
with c1:
|
64 |
+
st.write('Enter a SMILES string below to generate a 3D model.')
|
65 |
+
compound_smiles = st.text_input(
|
66 |
+
'SMILES Input',
|
67 |
+
'CC(=O)Oc1ccccc1C(=O)O' # Default: Aspirin
|
68 |
+
)
|
69 |
+
style = st.selectbox('Select Viewer Style', ['stick', 'sphere', 'line', 'carton'])
|
70 |
+
show_surface = st.checkbox('Show Molecular Surface')
|
71 |
+
opacity = 0.5
|
72 |
+
if show_surface:
|
73 |
+
opacity = st.slider('Surface Opacity', 0.1, 1.0, 0.5)
|
74 |
+
|
75 |
+
st.write('**What is SMILES?**')
|
76 |
+
st.info('''
|
77 |
+
The **Simplified Molecular-Input Line-Entry System (SMILES)** is a text-based representation of a molecule's structure.
|
78 |
+
- [Learn more on Wikipedia](https://en.wikipedia.org/wiki/Simplified_molecular-input_line-entry_system)
|
79 |
+
- [Find compounds on PubChem](https://pubchem.ncbi.nlm.nih.gov/).
|
80 |
+
''')
|
81 |
+
|
82 |
+
|
83 |
+
# Process input and display the 3D viewer in the second column
|
84 |
with c2:
|
85 |
+
if compound_smiles:
|
86 |
+
mol_3d = smi_to_3d_mol(compound_smiles)
|
87 |
+
if mol_3d:
|
88 |
+
st.write('**3D Chemical Structure**')
|
89 |
+
viewer_html = render_3d_viewer(mol_3d, style=style, surface=show_surface, opacity=opacity)
|
90 |
+
components.html(viewer_html, height=500, width=500)
|
91 |
+
else:
|
92 |
+
st.error("Invalid SMILES string. Could not generate the molecule.")
|
93 |
+
else:
|
94 |
+
st.info("Enter a SMILES string to generate a 3D model.")
|
|
|
|
|
|
|
95 |
|
96 |
|
97 |
+
st.divider()
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
+
# --- Predefined Molecules Section ---
|
100 |
+
st.header("Molecule Examples (2D)")
|
|
|
|
|
|
|
|
|
101 |
|
102 |
+
col1, col2, col3 = st.columns(3)
|
|
|
|
|
|
|
|
|
103 |
|
104 |
+
with col1:
|
105 |
+
st.subheader("Common Molecules")
|
106 |
+
render_2d_image("Ibuprofen", "CC(C)CC1=CC=C(C=C1)C(C)C(=O)O")
|
107 |
+
render_2d_image("Caffeine", "CN1C=NC2=C1C(=O)N(C(=O)N2C)C")
|
108 |
+
render_2d_image("Ethanol", "CCO")
|
109 |
+
render_2d_image("Glucose", "OC[C@@H](O1)[C@@H](O)[C@H](O)[C@@H](O)[C@H](O)1")
|
110 |
|
111 |
+
with col2:
|
112 |
+
st.subheader("Vitamins")
|
113 |
+
render_2d_image("Thiamine (B1)", "OCCc1c(C)[n+](cs1)Cc2cnc(C)nc2N")
|
114 |
+
render_2d_image("Vitamin E", "CC(C)CCC[C@@H](C)CCC[C@@H](C)CCC[C@]1(C)CCc2c(C)c(O)c(C)c(C)c2O1")
|
115 |
+
render_2d_image("Vitamin D3", "C[C@@H](CCCC(C)C)[C@H]1CC[C@H]2/C(=C/C=C/3\C(=C)CCC[C@H]3O)/CC[C@]12C")
|
116 |
|
117 |
+
with col3:
|
118 |
+
st.subheader("COVID-19 Antivirals")
|
119 |
+
render_2d_image("Favipiravir", "C1=C(N=C(C(=O)N1)C(=O)N)F")
|
120 |
+
render_2d_image("Remdesivir", "CCC(CC)COC(=O)[C@H](C)N[P@](=O)(OC[C@@H]1[C@H]([C@H]([C@](O1)(C#N)C2=CC=C3N2N=CN=C3N)O)O)OC4=CC=CC=C4")
|
121 |
+
render_2d_image("Ritonavir", "CC(C)C1=NC(=CS1)CN(C)C(=O)N[C@@H](C(C)C)C(=O)N[C@@H](CC2=CC=CC=C2)C[C@@H]([C@H](CC3=CC=CC=C3)NC(=O)OCC4=CN=CS4)O")
|
122 |
|
123 |
+
st.divider()
|
|
|
|
|
124 |
|
125 |
+
# --- Markdown Section with SMILES Lists ---
|
126 |
+
st.header("Drug Information & SMILES Strings")
|
|
|
|
|
|
|
127 |
|
|
|
128 |
markDown = '''
|
129 |
+
### Opioids
|
130 |
+
* **Fentanyl:** `CCC(=O)N(C1CCN(CC1)CCC2=CC=CC=C2)C3=CC=CC=C3`
|
131 |
+
* **Hydrocodone:** `CN1CC[C@]23[C@@H]4[C@H]1CC5=C2C(=C(C=C5)OC)O[C@H]3C(=O)CC4`
|
132 |
+
* **Oxycodone:** `CN1CC[C@]23[C@@H]4C(=O)CC[C@]2([C@H]1CC5=C3C(=C(C=C5)OC)O4)O`
|
133 |
+
|
134 |
+
### CNS Depressants
|
135 |
+
* **Diazepam (Valium):** `CN1C(=O)CN=C(C2=C1C=CC(=C2)Cl)C3=CC=CC=C3`
|
136 |
+
* **Alprazolam (Xanax):** `CC1=NN=C2N1C3=C(C=C(C=C3)Cl)C(=NC2)C4=CC=CC=C4`
|
137 |
+
* **Zolpidem (Ambien):** `CC1=CC=C(C=C1)C2=C(N3C=C(C=CC3=N2)C)CC(=O)N(C)C`
|
138 |
+
|
139 |
+
### Stimulants
|
140 |
+
* **Dextroamphetamine:** `C[C@@H](CC1=CC=CC=C1)N`
|
141 |
+
* **Methylphenidate (Ritalin):** `COC(=O)C(C1CCCCN1)C2=CC=CC=C2`
|
142 |
+
* **Amphetamine (base):** `CC(N)CC1=CC=CC=C1`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
'''
|
144 |
+
st.markdown(markDown)
|
|
|
|