Spaces:
Runtime error
Runtime error
Commit ·
d6226ba
1
Parent(s): 5ad0271
toggle inputs on tf ko
Browse files
app.py
CHANGED
|
@@ -444,6 +444,12 @@ def perturb(gene, locus1, locus2, use_max_gene, tf_knockout):
|
|
| 444 |
return image_from_plot, violin_img, violin_img_new, violin_img_fc
|
| 445 |
|
| 446 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 447 |
|
| 448 |
with gr.Blocks(theme='WeixuanYuan/Soft_dark') as demo:
|
| 449 |
with gr.Row():
|
|
@@ -452,11 +458,12 @@ with gr.Blocks(theme='WeixuanYuan/Soft_dark') as demo:
|
|
| 452 |
with gr.Row():
|
| 453 |
max_gene_checkbox = gr.Checkbox(label="Max Gene", elem_id='max-gene-checkbox', scale=1, checked=False)
|
| 454 |
tf_ko = gr.Checkbox(label="TF KO", elem_id='tf-ko', scale=1, checked=False)
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
|
|
|
| 460 |
heatmap_button = gr.Button(value="Generate Heatmaps", elem_id='heatmap-button', scale=1)
|
| 461 |
with gr.Row():
|
| 462 |
out_heatmaps = []
|
|
@@ -492,6 +499,7 @@ with gr.Blocks(theme='WeixuanYuan/Soft_dark') as demo:
|
|
| 492 |
fn=perturb, cache_examples=os.getenv('SYSTEM') == 'spaces')
|
| 493 |
run_button.click(perturb, inputs, outputs=outputs)
|
| 494 |
heatmap_button.click(get_heatmaps, [in_locus, anchor1, anchor2, heatmap_size], outputs=out_heatmaps)
|
|
|
|
| 495 |
anchor1.change(get_heatmaps, [in_locus, anchor1, anchor2, heatmap_size], outputs=out_heatmaps)
|
| 496 |
anchor2.change(get_heatmaps, [in_locus, anchor1, anchor2, heatmap_size], outputs=out_heatmaps)
|
| 497 |
def set_loop(img, gene, locus1, locus2, heatmap_range, evt: gr.SelectData):
|
|
|
|
| 444 |
return image_from_plot, violin_img, violin_img_new, violin_img_fc
|
| 445 |
|
| 446 |
|
| 447 |
+
def update_on_tf_ko(tf_knockout):
|
| 448 |
+
if tf_knockout:
|
| 449 |
+
return gr.update(visible=False)
|
| 450 |
+
else:
|
| 451 |
+
return gr.update(visible=True)
|
| 452 |
+
|
| 453 |
|
| 454 |
with gr.Blocks(theme='WeixuanYuan/Soft_dark') as demo:
|
| 455 |
with gr.Row():
|
|
|
|
| 458 |
with gr.Row():
|
| 459 |
max_gene_checkbox = gr.Checkbox(label="Max Gene", elem_id='max-gene-checkbox', scale=1, checked=False)
|
| 460 |
tf_ko = gr.Checkbox(label="TF KO", elem_id='tf-ko', scale=1, checked=False)
|
| 461 |
+
with gr.Column() as heatmap_col:
|
| 462 |
+
anchor1 = gr.Textbox(label="Locus 1 (gene or genomic coords)", elem_id='anchor1', scale=1)
|
| 463 |
+
anchor2 = gr.Textbox(label="Locus 2 (gene or genomic coords)", elem_id='anchor2', scale=1)
|
| 464 |
+
heatmap_x = gr.Textbox(label="Heatmap X", elem_id='heatmap-x', scale=1, visible=False)
|
| 465 |
+
heatmap_y = gr.Textbox(label="Heatmap Y", elem_id='heatmap-y', scale=1, visible=False)
|
| 466 |
+
heatmap_size = gr.Slider(label="Heatmap Range", info="kb range aroung input gene locus to expand", minimum=50, maximum=5000, value=250)
|
| 467 |
heatmap_button = gr.Button(value="Generate Heatmaps", elem_id='heatmap-button', scale=1)
|
| 468 |
with gr.Row():
|
| 469 |
out_heatmaps = []
|
|
|
|
| 499 |
fn=perturb, cache_examples=os.getenv('SYSTEM') == 'spaces')
|
| 500 |
run_button.click(perturb, inputs, outputs=outputs)
|
| 501 |
heatmap_button.click(get_heatmaps, [in_locus, anchor1, anchor2, heatmap_size], outputs=out_heatmaps)
|
| 502 |
+
tf_ko.change(update_on_tf_ko, tf_ko, outputs=heatmap_col)
|
| 503 |
anchor1.change(get_heatmaps, [in_locus, anchor1, anchor2, heatmap_size], outputs=out_heatmaps)
|
| 504 |
anchor2.change(get_heatmaps, [in_locus, anchor1, anchor2, heatmap_size], outputs=out_heatmaps)
|
| 505 |
def set_loop(img, gene, locus1, locus2, heatmap_range, evt: gr.SelectData):
|