Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import rdkit
|
4 |
+
import streamlit_ketcher
|
5 |
+
from streamlit_ketcher import st_ketcher
|
6 |
+
import run
|
7 |
+
|
8 |
+
# Page setup
|
9 |
+
st.set_page_config(page_title="DeepDAP", page_icon="🔋", layout="wide")
|
10 |
+
st.title("🔋DeepDAP")
|
11 |
+
|
12 |
+
# Connect to the Google Sheet
|
13 |
+
|
14 |
+
url1= r"https://docs.google.com/spreadsheets/d/1AKkZS04VF3osFT36aNHIb4iUbV8D1uNfsldcpHXogj0/gviz/tq?tqx=out:csv&sheet=dap"
|
15 |
+
df1 = pd.read_csv(url1, dtype=str, encoding='utf-8')
|
16 |
+
col1, col2 = st.columns(2)
|
17 |
+
with col1:
|
18 |
+
text_search = st.text_input("🔍Search papers or molecules", value="")
|
19 |
+
m1 = df1["Donor_Name"].str.contains(text_search)
|
20 |
+
m2 = df1["reference"].str.contains(text_search)
|
21 |
+
m3 = df1["Acceptor_Name"].str.contains(text_search)
|
22 |
+
df_search = df1[m1 | m2|m3]
|
23 |
+
with col2:
|
24 |
+
st.link_button("📝DATABASE", r"https://docs.google.com/spreadsheets/d/1AKkZS04VF3osFT36aNHIb4iUbV8D1uNfsldcpHXogj0")
|
25 |
+
st.caption('🎉If you want to update the database, click the button.')
|
26 |
+
if text_search:
|
27 |
+
st.write(df_search)
|
28 |
+
st.download_button( "⬇️Download edited files as .csv", df_search.to_csv(), "df_search.csv", use_container_width=True)
|
29 |
+
edited_df = st.data_editor(df1, num_rows="dynamic")
|
30 |
+
|
31 |
+
st.download_button(
|
32 |
+
"⬇️ Download edited files as .csv", edited_df.to_csv(), "edited_df.csv", use_container_width=True
|
33 |
+
)
|
34 |
+
|
35 |
+
option = st.selectbox(
|
36 |
+
"👇Select the type of active layer...",
|
37 |
+
("Donor", "Acceptor"), placeholder="Choose the type of active layer...",index = None
|
38 |
+
)
|
39 |
+
if option == 'Acceptor':
|
40 |
+
|
41 |
+
molecule = st.text_input("👨🔬Acceptor Molecule" )
|
42 |
+
acceptor= st_ketcher(molecule )
|
43 |
+
st.markdown(f"🏆New SMILES of edited acceptor molecules: {acceptor}")
|
44 |
+
donor= st.text_input("📋 Donor Molecule")
|
45 |
+
if option =='Donor':
|
46 |
+
do= st.text_input("👨🔬Donor Molecule" )
|
47 |
+
donor = st_ketcher(do)
|
48 |
+
st.markdown(f"🏆New SMILES of edited donor molecules: {donor}")
|
49 |
+
acceptor = st.text_input("📋 Acceptor Molecule")
|
50 |
+
try:
|
51 |
+
pce = run.smiles_aas_test( str(acceptor ), str(donor) )
|
52 |
+
st.markdown(f"⚡PCE: ``{pce}``")
|
53 |
+
except:
|
54 |
+
st.markdown(f"⚡PCE: None ")
|