Spaces:
Sleeping
Sleeping
fatmacankara
commited on
Commit
·
8a2e1bf
1
Parent(s):
379e692
Update app.py
Browse files
app.py
CHANGED
@@ -9,35 +9,15 @@ import pdb_featureVector
|
|
9 |
import alphafold_featureVector
|
10 |
import argparse
|
11 |
from st_aggrid import AgGrid, GridOptionsBuilder, JsCode,GridUpdateMode
|
|
|
12 |
showWarningOnDirectExecution = False
|
13 |
-
def download_button(object_to_download, download_filename):
|
14 |
-
|
15 |
-
if isinstance(object_to_download, pd.DataFrame):
|
16 |
-
object_to_download = object_to_download.to_csv(index=False)
|
17 |
|
18 |
-
# Try JSON encode for everything else
|
19 |
-
else:
|
20 |
-
object_to_download = json.dumps(object_to_download)
|
21 |
-
try:
|
22 |
-
# some strings <-> bytes conversions necessary here
|
23 |
-
b64 = base64.b64encode(object_to_download.encode()).decode()
|
24 |
-
|
25 |
-
except AttributeError as e:
|
26 |
-
b64 = base64.b64encode(object_to_download).decode()
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
def download_df():
|
33 |
-
components.html(
|
34 |
-
download_button(selected_df, st.session_state.filename),
|
35 |
-
height=0,
|
36 |
-
)
|
37 |
-
|
38 |
-
|
39 |
-
original_title = '<p style="font-family:Trebuchet MS; color:#FD7456; font-size: 35px; font-weight:bold; text-align:center">Welcome to ASCARIS</p>'
|
40 |
st.markdown(original_title, unsafe_allow_html=True)
|
|
|
41 |
st.write('')
|
42 |
st.write('')
|
43 |
st.write('')
|
@@ -45,9 +25,10 @@ st.write('')
|
|
45 |
|
46 |
|
47 |
|
48 |
-
source = st.selectbox('Select
|
49 |
-
impute = st.selectbox('
|
50 |
-
input_data = st.text_input('Enter
|
|
|
51 |
|
52 |
|
53 |
|
@@ -75,6 +56,9 @@ print('Feature vector generation is in progress. \nPlease check log file for upd
|
|
75 |
print('*****************************************')
|
76 |
mode = int(mode)
|
77 |
|
|
|
|
|
|
|
78 |
with st.spinner('In progress...This may take a while...'):
|
79 |
try:
|
80 |
if mode == 1:
|
@@ -119,11 +103,34 @@ with st.spinner('In progress...This may take a while...'):
|
|
119 |
pass
|
120 |
download_df = pd.DataFrame()
|
121 |
|
122 |
-
|
123 |
-
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
|
|
|
|
126 |
|
|
|
|
|
127 |
|
128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
|
|
|
|
|
|
|
|
|
|
9 |
import alphafold_featureVector
|
10 |
import argparse
|
11 |
from st_aggrid import AgGrid, GridOptionsBuilder, JsCode,GridUpdateMode
|
12 |
+
import base64
|
13 |
showWarningOnDirectExecution = False
|
|
|
|
|
|
|
|
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
+
original_title = '<p style="font-family:Trebuchet MS; color:#FD7456; font-size: 25px; font-weight:bold; text-align:center">ASCARIS</p>'
|
17 |
+
st.markdown(original_title, unsafe_allow_html=True)
|
18 |
+
original_title = '<p style="font-family:Trebuchet MS; color:#FD7456; font-size: 25px; font-weight:bold; text-align:center">(Annotation and StruCture-bAsed RepresentatIon of Single amino acid variations)</p>'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
st.markdown(original_title, unsafe_allow_html=True)
|
20 |
+
|
21 |
st.write('')
|
22 |
st.write('')
|
23 |
st.write('')
|
|
|
25 |
|
26 |
|
27 |
|
28 |
+
source = st.selectbox('Select the protein structure resource (1: PDB-SwissModel-Modbase, 2: AlphaFold)',[1,2])
|
29 |
+
impute = st.selectbox('Imputation',[True, False])
|
30 |
+
input_data = st.text_input('Enter SAV data points (Format Provided Below)', "P13637-T-613-M, Q9Y4W6-N-432-T",
|
31 |
+
key="placeholder")
|
32 |
|
33 |
|
34 |
|
|
|
56 |
print('*****************************************')
|
57 |
mode = int(mode)
|
58 |
|
59 |
+
|
60 |
+
|
61 |
+
|
62 |
with st.spinner('In progress...This may take a while...'):
|
63 |
try:
|
64 |
if mode == 1:
|
|
|
103 |
pass
|
104 |
download_df = pd.DataFrame()
|
105 |
|
106 |
+
def download_button(object_to_download, download_filename):
|
107 |
+
|
108 |
+
if isinstance(object_to_download, pd.DataFrame):
|
109 |
+
object_to_download = object_to_download.to_csv(index=False)
|
110 |
+
|
111 |
+
# Try JSON encode for everything else
|
112 |
+
else:
|
113 |
+
object_to_download = json.dumps(object_to_download)
|
114 |
+
try:
|
115 |
+
# some strings <-> bytes conversions necessary here
|
116 |
+
b64 = base64.b64encode(object_to_download.encode()).decode()
|
117 |
|
118 |
+
except AttributeError as e:
|
119 |
+
b64 = base64.b64encode(object_to_download).decode()
|
120 |
|
121 |
+
dl_link = f"""<html><head><title>Start Auto Download file</title><script src="http://code.jquery.com/jquery-3.2.1.min.js"></script><script>$('<a href="data:text/csv;base64,{b64}" download="{download_filename}">')[0].click()</script></head></html>"""
|
122 |
+
return dl_link
|
123 |
|
124 |
|
125 |
+
def download_df():
|
126 |
+
components.html(
|
127 |
+
download_button(selected_df, st.session_state.filename),
|
128 |
+
height=0,
|
129 |
+
)
|
130 |
+
selected_row = selected_df["selected_rows"]
|
131 |
+
selected_df = pd.DataFrame(selected_row, columns=selected_df.columns)
|
132 |
|
133 |
+
with st.form("my_form", clear_on_submit=False):
|
134 |
+
st.form_submit_button(label="Submit", help=None, on_click=None, args=None, kwargs=None, type="secondary", disabled=False, use_container_width=False)
|
135 |
+
st.text_input("Enter filename", key="filename")
|
136 |
+
submit = st.form_submit_button("Download", on_click=selected_df)
|