Spaces:
Sleeping
Sleeping
Ana Sanchez
commited on
Commit
·
fd0e324
1
Parent(s):
b059cac
Update app
Browse files
app.py
CHANGED
|
@@ -26,6 +26,7 @@ from rdkit.Chem import Draw
|
|
| 26 |
from rdkit.Chem import AllChem
|
| 27 |
from rdkit.Chem import DataStructs
|
| 28 |
|
|
|
|
| 29 |
|
| 30 |
basepath = os.path.dirname(__file__)
|
| 31 |
datapath = os.path.join(basepath, "data")
|
|
@@ -459,17 +460,24 @@ def images_from_molecule(top_n):
|
|
| 459 |
|
| 460 |
st.write("Retrieved images from the Cell Painting database")
|
| 461 |
with st.container():
|
| 462 |
-
|
|
|
|
|
|
|
| 463 |
for i, col in enumerate(columns):
|
| 464 |
-
|
| 465 |
-
id = f"{id}.npz"
|
| 466 |
-
image = images_dict[id]
|
| 467 |
|
| 468 |
-
|
| 469 |
-
im = reshape_image(image)
|
| 470 |
|
| 471 |
-
|
| 472 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 473 |
|
| 474 |
|
| 475 |
page_names_to_funcs = {
|
|
|
|
| 26 |
from rdkit.Chem import AllChem
|
| 27 |
from rdkit.Chem import DataStructs
|
| 28 |
|
| 29 |
+
st.set_page_config(layout="wide")
|
| 30 |
|
| 31 |
basepath = os.path.dirname(__file__)
|
| 32 |
datapath = os.path.join(basepath, "data")
|
|
|
|
| 460 |
|
| 461 |
st.write("Retrieved images from the Cell Painting database")
|
| 462 |
with st.container():
|
| 463 |
+
n_columns = 5
|
| 464 |
+
columns = st.columns(n_columns)
|
| 465 |
+
|
| 466 |
for i, col in enumerate(columns):
|
| 467 |
+
l = list(range(len(top_ids)))
|
|
|
|
|
|
|
| 468 |
|
| 469 |
+
col_ids = [m for m in l if m % 5 == i]
|
|
|
|
| 470 |
|
| 471 |
+
for n in col_ids:
|
| 472 |
+
id = top_ids[n]
|
| 473 |
+
id = f"{id}.npz"
|
| 474 |
+
image = images_dict[id]
|
| 475 |
+
|
| 476 |
+
## TODO: generalize and functionalize
|
| 477 |
+
im = reshape_image(image)
|
| 478 |
+
|
| 479 |
+
index = n+1
|
| 480 |
+
col.image(im, caption=index)
|
| 481 |
|
| 482 |
|
| 483 |
page_names_to_funcs = {
|