Spaces:
Sleeping
Sleeping
fangjiang commited on
Commit ·
f2af4e1
1
Parent(s): cf5dee2
initial update
Browse files
app.py
CHANGED
|
@@ -423,7 +423,7 @@ with gr.Blocks() as demo:
|
|
| 423 |
choices.change(fn=toggle_file_input, inputs=choices, outputs=[img_path, marker_path])
|
| 424 |
|
| 425 |
# img_viz = gr.Plot(label="Visualization of individual channels")
|
| 426 |
-
|
| 427 |
gr.Markdown('<div class="h-1">Step 2. Modify existing channels</div>')
|
| 428 |
gr.Markdown('<div class="h-2">(Required) Define channels designed to visualize nuclei. </div>')
|
| 429 |
gr.Markdown('<div class="h-2">(Optional) Remove unwanted channel after visualizing the individual channels. </div>')
|
|
@@ -454,7 +454,7 @@ with gr.Blocks() as demo:
|
|
| 454 |
# modifies the channels per user input
|
| 455 |
define_btn.click(fn=modify_channels, inputs=[cytof_original_state, selected_unwanted_channel, selected_nuclei, selected_membrane], outputs=[channel_feedback, cytof_state])
|
| 456 |
|
| 457 |
-
|
| 458 |
gr.Markdown('<div class="h-1">Step 3. Perform cell segmentation based on the defined nuclei and membrane channels</div>')
|
| 459 |
gr.Markdown('<hr>')
|
| 460 |
|
|
@@ -468,7 +468,7 @@ with gr.Blocks() as demo:
|
|
| 468 |
seg_viz = gr.Plot(label="Hover over graph to zoom, pan, save, etc.")
|
| 469 |
seg_btn.click(fn=cell_seg, inputs=[cytof_state, cell_radius], outputs=[seg_viz, cytof_state])
|
| 470 |
|
| 471 |
-
|
| 472 |
gr.Markdown('<div class="h-1">Step 4. Extract cell features</div>')
|
| 473 |
gr.Markdown('<div class="h-2">Note: This step will take significantly longer than the previous ones. A 300MB IMC file takes about 7 minutes to compute.</div>')
|
| 474 |
gr.Markdown('<hr>')
|
|
@@ -485,7 +485,7 @@ with gr.Blocks() as demo:
|
|
| 485 |
extract_btn.click(fn=feature_extraction, inputs=[cytof_state, cohort_state, norm_percentile],
|
| 486 |
outputs=[cytof_state, cohort_state, feat_df])
|
| 487 |
|
| 488 |
-
|
| 489 |
gr.Markdown('<div class="h-1">Step 5. Downstream analysis</div>')
|
| 490 |
gr.Markdown('<hr>')
|
| 491 |
|
|
@@ -522,7 +522,7 @@ with gr.Blocks() as demo:
|
|
| 522 |
co_exp_btn.click(fn=co_expression, inputs=[cytof_state, norm_percentile], outputs=[co_exp_viz, cytof_state])
|
| 523 |
# spatial_btn logic is in step6. This is populate the marker positive dropdown options
|
| 524 |
|
| 525 |
-
|
| 526 |
gr.Markdown('<div class="h-1">Step 6. Visualize positive markers</div>')
|
| 527 |
gr.Markdown('<div class="h-2">Select two markers for side-by-side comparison to visualize their positive states in cells. This serves two purposes. </div>')
|
| 528 |
gr.Markdown('<div class="h-2">(1) Validate the co-expression analysis results. High expression level should mean a similar number of positive markers within the two slides, whereas low expression level mean a large difference of in the number of positive markers. </div>')
|
|
@@ -545,7 +545,7 @@ with gr.Blocks() as demo:
|
|
| 545 |
)
|
| 546 |
pos_viz_btn.click(fn=viz_pos_marker_pair, inputs=[cytof_state, selected_marker1, selected_marker2, norm_percentile], outputs=[marker_pos_viz])
|
| 547 |
|
| 548 |
-
|
| 549 |
gr.Markdown('<div class="h-1">Step 7. Phenogrpah Clustering</div>')
|
| 550 |
gr.Markdown('<div class="h-2">Cells can be clustered into sub-groups based on the extracted single-cell data.</div>')
|
| 551 |
gr.Markdown('<div class="h-2">Time reference: a 300MB IMC file takes about 2 minutes to compute.</div>')
|
|
@@ -566,7 +566,7 @@ with gr.Blocks() as demo:
|
|
| 566 |
cluster_interaction = gr.Plot(label="Spatial interaction of clusters")
|
| 567 |
cluster_interact_btn.click(cluster_interaction_fn, inputs=[cytof_state, cohort_state], outputs=[cluster_interaction, cytof_state, cohort_state])
|
| 568 |
|
| 569 |
-
|
| 570 |
gr.Markdown('<div class="h-2">In additional, you could visualizing the cluster assignments against the positive markers to oberve any patterns:</div>')
|
| 571 |
gr.Markdown('<hr>')
|
| 572 |
with gr.Row():
|
|
|
|
| 423 |
choices.change(fn=toggle_file_input, inputs=choices, outputs=[img_path, marker_path])
|
| 424 |
|
| 425 |
# img_viz = gr.Plot(label="Visualization of individual channels")
|
| 426 |
+
|
| 427 |
gr.Markdown('<div class="h-1">Step 2. Modify existing channels</div>')
|
| 428 |
gr.Markdown('<div class="h-2">(Required) Define channels designed to visualize nuclei. </div>')
|
| 429 |
gr.Markdown('<div class="h-2">(Optional) Remove unwanted channel after visualizing the individual channels. </div>')
|
|
|
|
| 454 |
# modifies the channels per user input
|
| 455 |
define_btn.click(fn=modify_channels, inputs=[cytof_original_state, selected_unwanted_channel, selected_nuclei, selected_membrane], outputs=[channel_feedback, cytof_state])
|
| 456 |
|
| 457 |
+
|
| 458 |
gr.Markdown('<div class="h-1">Step 3. Perform cell segmentation based on the defined nuclei and membrane channels</div>')
|
| 459 |
gr.Markdown('<hr>')
|
| 460 |
|
|
|
|
| 468 |
seg_viz = gr.Plot(label="Hover over graph to zoom, pan, save, etc.")
|
| 469 |
seg_btn.click(fn=cell_seg, inputs=[cytof_state, cell_radius], outputs=[seg_viz, cytof_state])
|
| 470 |
|
| 471 |
+
|
| 472 |
gr.Markdown('<div class="h-1">Step 4. Extract cell features</div>')
|
| 473 |
gr.Markdown('<div class="h-2">Note: This step will take significantly longer than the previous ones. A 300MB IMC file takes about 7 minutes to compute.</div>')
|
| 474 |
gr.Markdown('<hr>')
|
|
|
|
| 485 |
extract_btn.click(fn=feature_extraction, inputs=[cytof_state, cohort_state, norm_percentile],
|
| 486 |
outputs=[cytof_state, cohort_state, feat_df])
|
| 487 |
|
| 488 |
+
|
| 489 |
gr.Markdown('<div class="h-1">Step 5. Downstream analysis</div>')
|
| 490 |
gr.Markdown('<hr>')
|
| 491 |
|
|
|
|
| 522 |
co_exp_btn.click(fn=co_expression, inputs=[cytof_state, norm_percentile], outputs=[co_exp_viz, cytof_state])
|
| 523 |
# spatial_btn logic is in step6. This is populate the marker positive dropdown options
|
| 524 |
|
| 525 |
+
|
| 526 |
gr.Markdown('<div class="h-1">Step 6. Visualize positive markers</div>')
|
| 527 |
gr.Markdown('<div class="h-2">Select two markers for side-by-side comparison to visualize their positive states in cells. This serves two purposes. </div>')
|
| 528 |
gr.Markdown('<div class="h-2">(1) Validate the co-expression analysis results. High expression level should mean a similar number of positive markers within the two slides, whereas low expression level mean a large difference of in the number of positive markers. </div>')
|
|
|
|
| 545 |
)
|
| 546 |
pos_viz_btn.click(fn=viz_pos_marker_pair, inputs=[cytof_state, selected_marker1, selected_marker2, norm_percentile], outputs=[marker_pos_viz])
|
| 547 |
|
| 548 |
+
|
| 549 |
gr.Markdown('<div class="h-1">Step 7. Phenogrpah Clustering</div>')
|
| 550 |
gr.Markdown('<div class="h-2">Cells can be clustered into sub-groups based on the extracted single-cell data.</div>')
|
| 551 |
gr.Markdown('<div class="h-2">Time reference: a 300MB IMC file takes about 2 minutes to compute.</div>')
|
|
|
|
| 566 |
cluster_interaction = gr.Plot(label="Spatial interaction of clusters")
|
| 567 |
cluster_interact_btn.click(cluster_interaction_fn, inputs=[cytof_state, cohort_state], outputs=[cluster_interaction, cytof_state, cohort_state])
|
| 568 |
|
| 569 |
+
|
| 570 |
gr.Markdown('<div class="h-2">In additional, you could visualizing the cluster assignments against the positive markers to oberve any patterns:</div>')
|
| 571 |
gr.Markdown('<hr>')
|
| 572 |
with gr.Row():
|