Spaces:
Running
Running
Download through markdown
Browse files- app/main.py +15 -4
app/main.py
CHANGED
@@ -33,7 +33,7 @@ args.add_argument("-n", "--host", type=str, default="127.0.0.1")
|
|
33 |
args = args.parse_args()
|
34 |
|
35 |
GET_CONFIG = load_config(
|
36 |
-
"/app/
|
37 |
)
|
38 |
GET_CONFIG.celltype.jacob = True
|
39 |
GET_CONFIG.celltype.num_cls = 2
|
@@ -124,7 +124,18 @@ def visualize_AF2(tf_pair, a):
|
|
124 |
|
125 |
def view_pdb(seg_pair, a):
|
126 |
pdb_path = a.pairs_data[seg_pair].pdb
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
|
129 |
|
130 |
def update_dropdown(x, label):
|
@@ -308,7 +319,7 @@ You can download specific segment pair PDB files by clicking 'Get PDB.'
|
|
308 |
segpair = gr.Dropdown(label="Seg pair")
|
309 |
segpair_btn = gr.Button(value="Get PDB")
|
310 |
pdb_html = gr.HTML(label="PDB HTML")
|
311 |
-
|
312 |
|
313 |
with gr.Row() as row:
|
314 |
with gr.Column():
|
@@ -332,7 +343,7 @@ You can download specific segment pair PDB files by clicking 'Get PDB.'
|
|
332 |
],
|
333 |
)
|
334 |
segpair_btn.click(
|
335 |
-
view_pdb, inputs=[segpair, af], outputs=[pdb_html, af]
|
336 |
)
|
337 |
celltype_btn.click(
|
338 |
load_and_plot_celltype,
|
|
|
33 |
args = args.parse_args()
|
34 |
|
35 |
GET_CONFIG = load_config(
|
36 |
+
"/app/atac_rna_data_processing/atac_rna_data_processing/config/GET"
|
37 |
)
|
38 |
GET_CONFIG.celltype.jacob = True
|
39 |
GET_CONFIG.celltype.num_cls = 2
|
|
|
124 |
|
125 |
def view_pdb(seg_pair, a):
|
126 |
pdb_path = a.pairs_data[seg_pair].pdb
|
127 |
+
if args.s3_uri:
|
128 |
+
bucket_name = f"{args.s3_uri}".split("//")[1].split("/")[0]
|
129 |
+
path_in_bucket = pdb_path.split("/", 1)[1]
|
130 |
+
file_name = pdb_path.split("/")[-1]
|
131 |
+
output_path = f"https://{bucket_name}.s3.amazonaws.com/{path_in_bucket}"
|
132 |
+
output_text = f"""
|
133 |
+
### Download PDB
|
134 |
+
[{file_name}]({output_path})
|
135 |
+
"""
|
136 |
+
else: # No download link if running locally
|
137 |
+
output_text = ""
|
138 |
+
return view_pdb_html(pdb_path, s3_file_sys=GET_CONFIG.s3_file_sys), a, output_text
|
139 |
|
140 |
|
141 |
def update_dropdown(x, label):
|
|
|
319 |
segpair = gr.Dropdown(label="Seg pair")
|
320 |
segpair_btn = gr.Button(value="Get PDB")
|
321 |
pdb_html = gr.HTML(label="PDB HTML")
|
322 |
+
pdb_download = gr.Markdown(label="Download PDB")
|
323 |
|
324 |
with gr.Row() as row:
|
325 |
with gr.Column():
|
|
|
343 |
],
|
344 |
)
|
345 |
segpair_btn.click(
|
346 |
+
view_pdb, inputs=[segpair, af], outputs=[pdb_html, af, pdb_download]
|
347 |
)
|
348 |
celltype_btn.click(
|
349 |
load_and_plot_celltype,
|