Skip to content

Commit a0c5838

Browse files
author
wjm41
authored
Merge pull request #8 from wjm41/feat/dropdown
Replace slider with dropdown menu
2 parents f4f3ed6 + 1f9c8ac commit a0c5838

2 files changed

Lines changed: 81 additions & 274 deletions

File tree

example_multiple_columns.ipynb

Lines changed: 13 additions & 234 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
{
1818
"cell_type": "code",
19-
"execution_count": 1,
19+
"execution_count": null,
2020
"metadata": {},
2121
"outputs": [],
2222
"source": [
@@ -37,190 +37,9 @@
3737
},
3838
{
3939
"cell_type": "code",
40-
"execution_count": 2,
40+
"execution_count": null,
4141
"metadata": {},
42-
"outputs": [
43-
{
44-
"data": {
45-
"text/html": [
46-
"<div>\n",
47-
"<style scoped>\n",
48-
" .dataframe tbody tr th:only-of-type {\n",
49-
" vertical-align: middle;\n",
50-
" }\n",
51-
"\n",
52-
" .dataframe tbody tr th {\n",
53-
" vertical-align: top;\n",
54-
" }\n",
55-
"\n",
56-
" .dataframe thead th {\n",
57-
" text-align: right;\n",
58-
" }\n",
59-
"</style>\n",
60-
"<table border=\"1\" class=\"dataframe\">\n",
61-
" <thead>\n",
62-
" <tr style=\"text-align: right;\">\n",
63-
" <th></th>\n",
64-
" <th>Aryl_halide_SMILES</th>\n",
65-
" <th>Additive_SMILES</th>\n",
66-
" <th>Base_SMILES</th>\n",
67-
" <th>Ligand_SMILES</th>\n",
68-
" <th>yield</th>\n",
69-
" </tr>\n",
70-
" <tr>\n",
71-
" <th>entry</th>\n",
72-
" <th></th>\n",
73-
" <th></th>\n",
74-
" <th></th>\n",
75-
" <th></th>\n",
76-
" <th></th>\n",
77-
" </tr>\n",
78-
" </thead>\n",
79-
" <tbody>\n",
80-
" <tr>\n",
81-
" <th>49</th>\n",
82-
" <td>FC(F)(F)c1ccc(Cl)cc1</td>\n",
83-
" <td>o1nccc1c2ccccc2</td>\n",
84-
" <td>CN(C)P(N(C)C)(N(C)C)=NP(N(C)C)(N(C)C)=NCC</td>\n",
85-
" <td>CC(C)C1=CC(C(C)C)=CC(C(C)C)=C1C2=C(P(C3CCCCC3)...</td>\n",
86-
" <td>10.657812</td>\n",
87-
" </tr>\n",
88-
" <tr>\n",
89-
" <th>50</th>\n",
90-
" <td>FC(F)(F)c1ccc(Br)cc1</td>\n",
91-
" <td>o1nccc1c2ccccc2</td>\n",
92-
" <td>CN(C)P(N(C)C)(N(C)C)=NP(N(C)C)(N(C)C)=NCC</td>\n",
93-
" <td>CC(C)C1=CC(C(C)C)=CC(C(C)C)=C1C2=C(P(C3CCCCC3)...</td>\n",
94-
" <td>14.747896</td>\n",
95-
" </tr>\n",
96-
" <tr>\n",
97-
" <th>51</th>\n",
98-
" <td>FC(F)(F)c1ccc(I)cc1</td>\n",
99-
" <td>o1nccc1c2ccccc2</td>\n",
100-
" <td>CN(C)P(N(C)C)(N(C)C)=NP(N(C)C)(N(C)C)=NCC</td>\n",
101-
" <td>CC(C)C1=CC(C(C)C)=CC(C(C)C)=C1C2=C(P(C3CCCCC3)...</td>\n",
102-
" <td>18.278686</td>\n",
103-
" </tr>\n",
104-
" <tr>\n",
105-
" <th>52</th>\n",
106-
" <td>COc1ccc(Cl)cc1</td>\n",
107-
" <td>o1nccc1c2ccccc2</td>\n",
108-
" <td>CN(C)P(N(C)C)(N(C)C)=NP(N(C)C)(N(C)C)=NCC</td>\n",
109-
" <td>CC(C)C1=CC(C(C)C)=CC(C(C)C)=C1C2=C(P(C3CCCCC3)...</td>\n",
110-
" <td>2.475058</td>\n",
111-
" </tr>\n",
112-
" <tr>\n",
113-
" <th>53</th>\n",
114-
" <td>COc1ccc(Br)cc1</td>\n",
115-
" <td>o1nccc1c2ccccc2</td>\n",
116-
" <td>CN(C)P(N(C)C)(N(C)C)=NP(N(C)C)(N(C)C)=NCC</td>\n",
117-
" <td>CC(C)C1=CC(C(C)C)=CC(C(C)C)=C1C2=C(P(C3CCCCC3)...</td>\n",
118-
" <td>6.119058</td>\n",
119-
" </tr>\n",
120-
" <tr>\n",
121-
" <th>...</th>\n",
122-
" <td>...</td>\n",
123-
" <td>...</td>\n",
124-
" <td>...</td>\n",
125-
" <td>...</td>\n",
126-
" <td>...</td>\n",
127-
" </tr>\n",
128-
" <tr>\n",
129-
" <th>4603</th>\n",
130-
" <td>Brc1ccccn1</td>\n",
131-
" <td>COC(=O)c1cc(on1)c2sccc2</td>\n",
132-
" <td>CN1CCCN2CCCN=C12</td>\n",
133-
" <td>CC(C1=C(C2=C(OC)C=CC(OC)=C2P(C34CC5CC(C4)CC(C5...</td>\n",
134-
" <td>57.426670</td>\n",
135-
" </tr>\n",
136-
" <tr>\n",
137-
" <th>4604</th>\n",
138-
" <td>Ic1ccccn1</td>\n",
139-
" <td>COC(=O)c1cc(on1)c2sccc2</td>\n",
140-
" <td>CN1CCCN2CCCN=C12</td>\n",
141-
" <td>CC(C1=C(C2=C(OC)C=CC(OC)=C2P(C34CC5CC(C4)CC(C5...</td>\n",
142-
" <td>86.233157</td>\n",
143-
" </tr>\n",
144-
" <tr>\n",
145-
" <th>4605</th>\n",
146-
" <td>Clc1cccnc1</td>\n",
147-
" <td>COC(=O)c1cc(on1)c2sccc2</td>\n",
148-
" <td>CN1CCCN2CCCN=C12</td>\n",
149-
" <td>CC(C1=C(C2=C(OC)C=CC(OC)=C2P(C34CC5CC(C4)CC(C5...</td>\n",
150-
" <td>1.440081</td>\n",
151-
" </tr>\n",
152-
" <tr>\n",
153-
" <th>4606</th>\n",
154-
" <td>Brc1cccnc1</td>\n",
155-
" <td>COC(=O)c1cc(on1)c2sccc2</td>\n",
156-
" <td>CN1CCCN2CCCN=C12</td>\n",
157-
" <td>CC(C1=C(C2=C(OC)C=CC(OC)=C2P(C34CC5CC(C4)CC(C5...</td>\n",
158-
" <td>43.538365</td>\n",
159-
" </tr>\n",
160-
" <tr>\n",
161-
" <th>4607</th>\n",
162-
" <td>Ic1cccnc1</td>\n",
163-
" <td>COC(=O)c1cc(on1)c2sccc2</td>\n",
164-
" <td>CN1CCCN2CCCN=C12</td>\n",
165-
" <td>CC(C1=C(C2=C(OC)C=CC(OC)=C2P(C34CC5CC(C4)CC(C5...</td>\n",
166-
" <td>69.795902</td>\n",
167-
" </tr>\n",
168-
" </tbody>\n",
169-
"</table>\n",
170-
"<p>3955 rows × 5 columns</p>\n",
171-
"</div>"
172-
],
173-
"text/plain": [
174-
" Aryl_halide_SMILES Additive_SMILES \\\n",
175-
"entry \n",
176-
"49 FC(F)(F)c1ccc(Cl)cc1 o1nccc1c2ccccc2 \n",
177-
"50 FC(F)(F)c1ccc(Br)cc1 o1nccc1c2ccccc2 \n",
178-
"51 FC(F)(F)c1ccc(I)cc1 o1nccc1c2ccccc2 \n",
179-
"52 COc1ccc(Cl)cc1 o1nccc1c2ccccc2 \n",
180-
"53 COc1ccc(Br)cc1 o1nccc1c2ccccc2 \n",
181-
"... ... ... \n",
182-
"4603 Brc1ccccn1 COC(=O)c1cc(on1)c2sccc2 \n",
183-
"4604 Ic1ccccn1 COC(=O)c1cc(on1)c2sccc2 \n",
184-
"4605 Clc1cccnc1 COC(=O)c1cc(on1)c2sccc2 \n",
185-
"4606 Brc1cccnc1 COC(=O)c1cc(on1)c2sccc2 \n",
186-
"4607 Ic1cccnc1 COC(=O)c1cc(on1)c2sccc2 \n",
187-
"\n",
188-
" Base_SMILES \\\n",
189-
"entry \n",
190-
"49 CN(C)P(N(C)C)(N(C)C)=NP(N(C)C)(N(C)C)=NCC \n",
191-
"50 CN(C)P(N(C)C)(N(C)C)=NP(N(C)C)(N(C)C)=NCC \n",
192-
"51 CN(C)P(N(C)C)(N(C)C)=NP(N(C)C)(N(C)C)=NCC \n",
193-
"52 CN(C)P(N(C)C)(N(C)C)=NP(N(C)C)(N(C)C)=NCC \n",
194-
"53 CN(C)P(N(C)C)(N(C)C)=NP(N(C)C)(N(C)C)=NCC \n",
195-
"... ... \n",
196-
"4603 CN1CCCN2CCCN=C12 \n",
197-
"4604 CN1CCCN2CCCN=C12 \n",
198-
"4605 CN1CCCN2CCCN=C12 \n",
199-
"4606 CN1CCCN2CCCN=C12 \n",
200-
"4607 CN1CCCN2CCCN=C12 \n",
201-
"\n",
202-
" Ligand_SMILES yield \n",
203-
"entry \n",
204-
"49 CC(C)C1=CC(C(C)C)=CC(C(C)C)=C1C2=C(P(C3CCCCC3)... 10.657812 \n",
205-
"50 CC(C)C1=CC(C(C)C)=CC(C(C)C)=C1C2=C(P(C3CCCCC3)... 14.747896 \n",
206-
"51 CC(C)C1=CC(C(C)C)=CC(C(C)C)=C1C2=C(P(C3CCCCC3)... 18.278686 \n",
207-
"52 CC(C)C1=CC(C(C)C)=CC(C(C)C)=C1C2=C(P(C3CCCCC3)... 2.475058 \n",
208-
"53 CC(C)C1=CC(C(C)C)=CC(C(C)C)=C1C2=C(P(C3CCCCC3)... 6.119058 \n",
209-
"... ... ... \n",
210-
"4603 CC(C1=C(C2=C(OC)C=CC(OC)=C2P(C34CC5CC(C4)CC(C5... 57.426670 \n",
211-
"4604 CC(C1=C(C2=C(OC)C=CC(OC)=C2P(C34CC5CC(C4)CC(C5... 86.233157 \n",
212-
"4605 CC(C1=C(C2=C(OC)C=CC(OC)=C2P(C34CC5CC(C4)CC(C5... 1.440081 \n",
213-
"4606 CC(C1=C(C2=C(OC)C=CC(OC)=C2P(C34CC5CC(C4)CC(C5... 43.538365 \n",
214-
"4607 CC(C1=C(C2=C(OC)C=CC(OC)=C2P(C34CC5CC(C4)CC(C5... 69.795902 \n",
215-
"\n",
216-
"[3955 rows x 5 columns]"
217-
]
218-
},
219-
"execution_count": 2,
220-
"metadata": {},
221-
"output_type": "execute_result"
222-
}
223-
],
42+
"outputs": [],
22443
"source": [
22544
"df = pd.read_csv('https://raw.githubusercontent.com/b-shields/edbo/master/experiments/data/aryl_amination/experiment_index.csv',\n",
22645
" index_col=0)\n",
@@ -236,7 +55,7 @@
23655
},
23756
{
23857
"cell_type": "code",
239-
"execution_count": 3,
58+
"execution_count": null,
24059
"metadata": {},
24160
"outputs": [],
24261
"source": [
@@ -287,7 +106,7 @@
287106
},
288107
{
289108
"cell_type": "code",
290-
"execution_count": 4,
109+
"execution_count": null,
291110
"metadata": {},
292111
"outputs": [],
293112
"source": [
@@ -303,7 +122,7 @@
303122
},
304123
{
305124
"cell_type": "code",
306-
"execution_count": 5,
125+
"execution_count": null,
307126
"metadata": {},
308127
"outputs": [],
309128
"source": [
@@ -319,28 +138,17 @@
319138
},
320139
{
321140
"cell_type": "code",
322-
"execution_count": 6,
141+
"execution_count": null,
323142
"metadata": {},
324-
"outputs": [
325-
{
326-
"data": {
327-
"text/plain": [
328-
"RandomForestRegressor()"
329-
]
330-
},
331-
"execution_count": 6,
332-
"metadata": {},
333-
"output_type": "execute_result"
334-
}
335-
],
143+
"outputs": [],
336144
"source": [
337145
"model = RandomForestRegressor()\n",
338146
"model.fit(X_train, Y_train)"
339147
]
340148
},
341149
{
342150
"cell_type": "code",
343-
"execution_count": 7,
151+
"execution_count": null,
344152
"metadata": {},
345153
"outputs": [],
346154
"source": [
@@ -352,36 +160,14 @@
352160
"cell_type": "markdown",
353161
"metadata": {},
354162
"source": [
355-
"Now we can use molplotly to see all the components corresponding to each point in the scatter plot!"
163+
"Now we can use molplotly to see all the components corresponding to each point in the scatter plot! Select the SMILES columns you'd like to plot by choosing from the dropdown menu :)"
356164
]
357165
},
358166
{
359167
"cell_type": "code",
360-
"execution_count": 8,
168+
"execution_count": null,
361169
"metadata": {},
362-
"outputs": [
363-
{
364-
"data": {
365-
"text/html": [
366-
"\n",
367-
" <iframe\n",
368-
" width=\"100%\"\n",
369-
" height=\"1000\"\n",
370-
" src=\"http://127.0.0.1:8751/\"\n",
371-
" frameborder=\"0\"\n",
372-
" allowfullscreen\n",
373-
" \n",
374-
" ></iframe>\n",
375-
" "
376-
],
377-
"text/plain": [
378-
"<IPython.lib.display.IFrame at 0x25ea7779cd0>"
379-
]
380-
},
381-
"metadata": {},
382-
"output_type": "display_data"
383-
}
384-
],
170+
"outputs": [],
385171
"source": [
386172
"fig_scatter = px.scatter(df_test,\n",
387173
" x=\"yield\",\n",
@@ -400,13 +186,6 @@
400186
"# change the arguments here to run the dash app on an external server and/or change the size of the app!\n",
401187
"app_scatter.run_server(mode='inline', port=8751, height=1000)\n"
402188
]
403-
},
404-
{
405-
"cell_type": "markdown",
406-
"metadata": {},
407-
"source": [
408-
"Now changing the slider value changes which column is used for displaying the structure of the molecule."
409-
]
410189
}
411190
],
412191
"metadata": {
@@ -428,7 +207,7 @@
428207
"name": "python",
429208
"nbconvert_exporter": "python",
430209
"pygments_lexer": "ipython3",
431-
"version": "3.9.7"
210+
"version": "3.10.0"
432211
},
433212
"orig_nbformat": 4
434213
},

0 commit comments

Comments
 (0)