Delete app.py
Browse files
app.py
DELETED
|
@@ -1,76 +0,0 @@
|
|
| 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 |
-
import screen
|
| 8 |
-
|
| 9 |
-
# Page setup
|
| 10 |
-
st.set_page_config(page_title="DeepDAP", page_icon="🔋", layout="wide")
|
| 11 |
-
st.title("🔋DeepDAP")
|
| 12 |
-
st.subheader('',divider='rainbow')
|
| 13 |
-
# Connect to the Google Sheet
|
| 14 |
-
|
| 15 |
-
url1= r"https://docs.google.com/spreadsheets/d/1AKkZS04VF3osFT36aNHIb4iUbV8D1uNfsldcpHXogj0/gviz/tq?tqx=out:csv&sheet=dap"
|
| 16 |
-
df1 = pd.read_csv(url1, dtype=str, encoding='utf-8')
|
| 17 |
-
col1, col2 = st.columns(2)
|
| 18 |
-
with col1:
|
| 19 |
-
st.header("🔍**Search papers or molecules**")
|
| 20 |
-
text_search = st.text_input(label="_", value="",label_visibility="hidden" )
|
| 21 |
-
m1 = df1["Donor_Name"].str.contains(text_search)
|
| 22 |
-
m2 = df1["reference"].str.contains(text_search)
|
| 23 |
-
m3 = df1["Acceptor_Name"].str.contains(text_search)
|
| 24 |
-
df_search = df1[m1 | m2|m3]
|
| 25 |
-
with col2:
|
| 26 |
-
st.link_button(":black[📝**DATABASE**]", r"https://docs.google.com/spreadsheets/d/1AKkZS04VF3osFT36aNHIb4iUbV8D1uNfsldcpHXogj0")
|
| 27 |
-
st.caption(':black[👆If you want to update the origin database, click the button.]')
|
| 28 |
-
if text_search:
|
| 29 |
-
st.write(df_search)
|
| 30 |
-
st.download_button( "⬇️Download edited files as .csv", df_search.to_csv(), "df_search.csv", use_container_width=True)
|
| 31 |
-
edited_df = st.data_editor(df1, num_rows="dynamic")
|
| 32 |
-
|
| 33 |
-
st.download_button(
|
| 34 |
-
"⬇️ Download edited files as .csv", edited_df.to_csv(), "edited_df.csv", use_container_width=True
|
| 35 |
-
)
|
| 36 |
-
st.subheader("👇 :red[***Select the type of active layer...***]")
|
| 37 |
-
option = st.radio(
|
| 38 |
-
"👇 :red[**Select the type of active layer...**]",
|
| 39 |
-
[":black[**Donor**]", ":black[**Acceptor**]"], label_visibility="hidden"
|
| 40 |
-
)
|
| 41 |
-
if option ==":black[**Acceptor**]":
|
| 42 |
-
st.subheader("👨🔬**Input the SMILES of Acceptor Molecule**")
|
| 43 |
-
molecule = st.text_input("👨🔬**Input the SMILES of Acceptor Molecule**", label_visibility="hidden" )
|
| 44 |
-
acceptor= st_ketcher(molecule )
|
| 45 |
-
st.subheader(f"🏆**New SMILES of edited acceptor molecules**: {acceptor}")
|
| 46 |
-
st.subheader(":black[**🧡Input the SMILES of Donor Molecule**]")
|
| 47 |
-
donor= st.text_input(":black[**🧡Input the SMILES of Donor Molecule**]", label_visibility="hidden")
|
| 48 |
-
if option ==":black[**Donor**]":
|
| 49 |
-
st.subheader("👨🔬**Input the SMILES of Donor Molecule**" )
|
| 50 |
-
do= st.text_input("👨🔬**Input the SMILES of Donor Molecule**" , label_visibility="hidden")
|
| 51 |
-
donor = st_ketcher(do)
|
| 52 |
-
st.subheader(f"🏆**New SMILES of edited donor molecules**: {donor}")
|
| 53 |
-
st.subheader(":black[**🧡Input the SMILES of Acceptor Molecule**]")
|
| 54 |
-
acceptor = st.text_input(":black[**🧡Input the SMILES of Acceptor Molecule**]", label_visibility="hidden")
|
| 55 |
-
try:
|
| 56 |
-
mola = Chem.MolFromSmiles(acceptor)
|
| 57 |
-
acceptor = Chem.MolToSmiles(mola)
|
| 58 |
-
mold = Chem.MolFromSmiles(donor)
|
| 59 |
-
donor = Chem.MolToSmiles(mold)
|
| 60 |
-
pce = run.smiles_aas_test( str(acceptor ), str(donor) )
|
| 61 |
-
st.subheader(f"⚡**PCE**: ``{pce}``")
|
| 62 |
-
except:
|
| 63 |
-
st.subheader(f"⚡**PCE**: None ")
|
| 64 |
-
st.subheader(":black[**🧡Batch screening for high-performance D/A pairs**]")
|
| 65 |
-
uploaded_files = st.file_uploader("Choose a CSV file")
|
| 66 |
-
st.write( "🎈upload a csv file containing ['donor' ] and ['acceptor']")
|
| 67 |
-
if st.button("📑PREDICT"):
|
| 68 |
-
if uploaded_files is not None:
|
| 69 |
-
text = st.markdown(":red[Predictions are being made... Please wait...]")
|
| 70 |
-
st.progress(100, text=None)
|
| 71 |
-
x = screen.smiles_aas_test(uploaded_files )
|
| 72 |
-
x = pd.DataFrame(x)
|
| 73 |
-
|
| 74 |
-
st.download_button( "⬇️Download the predicted files as .csv", x.to_csv(), "predict results.csv", use_container_width=True)
|
| 75 |
-
else:
|
| 76 |
-
st.markdown(":red[Please upload the file first!]")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|