fangjiang commited on
Commit
415fa16
·
1 Parent(s): 68ccde4

initial update

Browse files
Files changed (1) hide show
  1. app.py +17 -19
app.py CHANGED
@@ -355,7 +355,7 @@ custom_css = """
355
  border-width: 0 !important;
356
  }
357
  hr {
358
- margin: 2rem 0 0 0 !important;
359
  padding-bottom: 10px !important;
360
  }
361
  .input-choices {
@@ -368,6 +368,9 @@ hr {
368
  border-width: 0 !important;
369
  box-shadow: none !important;
370
  }
 
 
 
371
  </style>
372
  """
373
 
@@ -380,15 +383,14 @@ with gr.Blocks() as demo:
380
 
381
  gr.Markdown('<div class="h-1">Step 1. Upload images</div>')
382
  gr.Markdown('<div class="h-2">You may upload one or two files depending on your use case.</div>')
383
- gr.Markdown('<div class="h-2">Case 1: &nbsp; Upload a single file</div>')
384
  gr.Markdown('<div class="h-2"><ul><li>upload a TXT or CSV file that contains information about antibodies, rare heavy metal isotopes, and image channel names.</li>'
385
  '<li>files are following the CyTOF, IMC, or multiplex data convention.</li>'
386
  '</ul></div>')
387
- gr.Markdown('<div class="h-2">Case 2: &nbsp; Upload multiple files</div>')
388
  gr.Markdown('<div class="h-2"><ul><li>upload a TIFF file containing Regions of Interest (ROIs) stored as multiplexed images. <a href="https://qbrc.swmed.edu/labs/xiaoxie/download/multiplex/example_image.tiff" download target="_blank">Example ROI</a></li>'
389
  '<li>upload a Marker File listing the channels to identify the antibodies. <a href="https://github.com/QBRC/multiTAP/blob/main/example_data/markers_labels.txt" download target="_blank">Example Marker File</a></li>'
390
  '</ul></div><hr>')
391
-
392
 
393
  gr.Markdown('<div class="h-2">Select Input Case:</div>')
394
 
@@ -428,8 +430,7 @@ with gr.Blocks() as demo:
428
  gr.Markdown('<div class="h-1">Step 2. Modify Existing Channels</div>')
429
  gr.Markdown('<div class="h-2">(Required) Define channels designed to visualize nuclei. </div>')
430
  gr.Markdown('<div class="h-2">(Optional) Remove unwanted channel after visualizing the individual channels. </div>')
431
- gr.Markdown('<div class="h-2">(Optional) Define channels degisned to visualize membranes.</div>')
432
-
433
 
434
  with gr.Row(equal_height=True): # third row selects nuclei channels
435
  with gr.Column(scale=2):
@@ -457,7 +458,8 @@ with gr.Blocks() as demo:
457
 
458
  gr.Markdown('<br>')
459
  gr.Markdown('<div class="h-1">Step 3. Perform Cell Segmentation</div>')
460
- gr.Markdown('<div class="h-2">In this step, we perform cell segmentation based on the defined nuclei and membrane channels</div>')
 
461
  with gr.Row(): # This row defines cell radius and performs segmentation
462
  with gr.Column(scale=2):
463
  gr.Markdown('<div class="h-2">Cell Size:</div>')
@@ -471,8 +473,7 @@ with gr.Blocks() as demo:
471
 
472
  gr.Markdown('<br>')
473
  gr.Markdown('<div class="h-1">Step 4. Extract cell features</div>')
474
- 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>')
475
-
476
 
477
  cohort_state = gr.State(CytofCohort())
478
  with gr.Row(): # feature extraction related functinos
@@ -487,10 +488,9 @@ with gr.Blocks() as demo:
487
  outputs=[cytof_state, cohort_state, feat_df])
488
 
489
  gr.Markdown('<br>')
490
- gr.Markdown('<div class="h-1">Step 5. Downstream analysis</div>')
491
 
492
-
493
- gr.Markdown('<div class="h-2">(1) Co-expression Analysis</div>')
494
  with gr.Row(): # show co-expression and spatial analysis
495
  with gr.Column(scale=2):
496
  gr.Markdown('<div class="h-2">This analysis measures the level of co-expression for each pair of biomarkers by calculating the odds ratio between the observed co-occurrence and the expected expressing even</div>')
@@ -500,7 +500,7 @@ with gr.Blocks() as demo:
500
  with gr.Accordion("", open=True):
501
  co_exp_viz = gr.Plot(elem_classes='no-label no-border')
502
 
503
- gr.Markdown('<div class="h-2">(2) Spatial Interactoin Analysis</div>')
504
 
505
  def update_info_text(choice):
506
  if choice == "k-neighbor":
@@ -528,8 +528,8 @@ with gr.Blocks() as demo:
528
  gr.Markdown('<br>')
529
  gr.Markdown('<div class="h-1">Step 6. Visualize positive markers</div>')
530
  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>')
531
- gr.Markdown('<div class="h-2">(1) Validate the co-expression analysis results.</div>')
532
- gr.Markdown('<div class="h-2">(2) Validate teh spatial interaction analysis results.</div>')
533
 
534
 
535
  with gr.Row(): # two marker positive visualization - dropdown options
@@ -551,9 +551,7 @@ with gr.Blocks() as demo:
551
 
552
  gr.Markdown('<br>')
553
  gr.Markdown('<div class="h-1">Step 7. Phenogrpah Clustering</div>')
554
- gr.Markdown('<div class="h-2">Cells can be clustered into sub-groups based on the extracted single-cell data.</div>')
555
- gr.Markdown('<div class="h-2">Time reference: a 300MB IMC file takes about 2 minutes to compute.</div>')
556
-
557
 
558
  with gr.Row(): # add two plots to visualize phenograph results
559
  with gr.Column(scale=2):
@@ -575,7 +573,7 @@ with gr.Blocks() as demo:
575
  cluster_interact_btn.click(cluster_interaction_fn, inputs=[cytof_state, cohort_state], outputs=[cluster_interaction, cytof_state, cohort_state])
576
 
577
  gr.Markdown('<br>')
578
- gr.Markdown('<div class="h-2">In additional, you could visualizing the cluster assignments against the positive markers to oberve any patterns:</div>')
579
 
580
  with gr.Row():
581
  with gr.Column(scale=2):
 
355
  border-width: 0 !important;
356
  }
357
  hr {
358
+ margin: 1.5rem 0 0 0 !important;
359
  padding-bottom: 10px !important;
360
  }
361
  .input-choices {
 
368
  border-width: 0 !important;
369
  box-shadow: none !important;
370
  }
371
+ .bold {
372
+ font-weight: 600 !important;
373
+ }
374
  </style>
375
  """
376
 
 
383
 
384
  gr.Markdown('<div class="h-1">Step 1. Upload images</div>')
385
  gr.Markdown('<div class="h-2">You may upload one or two files depending on your use case.</div>')
386
+ gr.Markdown('<div class="h-2 bold">Case 1: &nbsp; Upload a single file</div>')
387
  gr.Markdown('<div class="h-2"><ul><li>upload a TXT or CSV file that contains information about antibodies, rare heavy metal isotopes, and image channel names.</li>'
388
  '<li>files are following the CyTOF, IMC, or multiplex data convention.</li>'
389
  '</ul></div>')
390
+ gr.Markdown('<div class="h-2 bold">Case 2: &nbsp; Upload multiple files</div>')
391
  gr.Markdown('<div class="h-2"><ul><li>upload a TIFF file containing Regions of Interest (ROIs) stored as multiplexed images. <a href="https://qbrc.swmed.edu/labs/xiaoxie/download/multiplex/example_image.tiff" download target="_blank">Example ROI</a></li>'
392
  '<li>upload a Marker File listing the channels to identify the antibodies. <a href="https://github.com/QBRC/multiTAP/blob/main/example_data/markers_labels.txt" download target="_blank">Example Marker File</a></li>'
393
  '</ul></div><hr>')
 
394
 
395
  gr.Markdown('<div class="h-2">Select Input Case:</div>')
396
 
 
430
  gr.Markdown('<div class="h-1">Step 2. Modify Existing Channels</div>')
431
  gr.Markdown('<div class="h-2">(Required) Define channels designed to visualize nuclei. </div>')
432
  gr.Markdown('<div class="h-2">(Optional) Remove unwanted channel after visualizing the individual channels. </div>')
433
+ gr.Markdown('<div class="h-2">(Optional) Define channels degisned to visualize membranes.</div><hr>')
 
434
 
435
  with gr.Row(equal_height=True): # third row selects nuclei channels
436
  with gr.Column(scale=2):
 
458
 
459
  gr.Markdown('<br>')
460
  gr.Markdown('<div class="h-1">Step 3. Perform Cell Segmentation</div>')
461
+ gr.Markdown('<div class="h-2">In this step, we perform cell segmentation based on the defined nuclei and membrane channels</div><hr>')
462
+
463
  with gr.Row(): # This row defines cell radius and performs segmentation
464
  with gr.Column(scale=2):
465
  gr.Markdown('<div class="h-2">Cell Size:</div>')
 
473
 
474
  gr.Markdown('<br>')
475
  gr.Markdown('<div class="h-1">Step 4. Extract cell features</div>')
476
+ gr.Markdown('<div class="h-2"><span class="bold">Note</span>: This step will take significantly longer than the previous ones. (A 300MB IMC file takes about 7 minutes to compute.)</div><hr>')
 
477
 
478
  cohort_state = gr.State(CytofCohort())
479
  with gr.Row(): # feature extraction related functinos
 
488
  outputs=[cytof_state, cohort_state, feat_df])
489
 
490
  gr.Markdown('<br>')
491
+ gr.Markdown('<div class="h-1">Step 5. Downstream analysis</div><hr>')
492
 
493
+ gr.Markdown('<div class="h-2 bold">(1) Co-expression Analysis</div>')
 
494
  with gr.Row(): # show co-expression and spatial analysis
495
  with gr.Column(scale=2):
496
  gr.Markdown('<div class="h-2">This analysis measures the level of co-expression for each pair of biomarkers by calculating the odds ratio between the observed co-occurrence and the expected expressing even</div>')
 
500
  with gr.Accordion("", open=True):
501
  co_exp_viz = gr.Plot(elem_classes='no-label no-border')
502
 
503
+ gr.Markdown('<div class="h-2 bold">(2) Spatial Interactoin Analysis</div>')
504
 
505
  def update_info_text(choice):
506
  if choice == "k-neighbor":
 
528
  gr.Markdown('<br>')
529
  gr.Markdown('<div class="h-1">Step 6. Visualize positive markers</div>')
530
  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>')
531
+ gr.Markdown('<div class="h-2 bold">(1) Validate the co-expression analysis results.</div>')
532
+ gr.Markdown('<div class="h-2 bold">(2) Validate teh spatial interaction analysis results.</div>')
533
 
534
 
535
  with gr.Row(): # two marker positive visualization - dropdown options
 
551
 
552
  gr.Markdown('<br>')
553
  gr.Markdown('<div class="h-1">Step 7. Phenogrpah Clustering</div>')
554
+ gr.Markdown('<div class="h-2">Cells can be clustered into sub-groups based on the extracted single-cell data. (A 300MB IMC file takes about 2 minutes to compute.)</div><hr>')
 
 
555
 
556
  with gr.Row(): # add two plots to visualize phenograph results
557
  with gr.Column(scale=2):
 
573
  cluster_interact_btn.click(cluster_interaction_fn, inputs=[cytof_state, cohort_state], outputs=[cluster_interaction, cytof_state, cohort_state])
574
 
575
  gr.Markdown('<br>')
576
+ gr.Markdown('<div class="h-2">In additional, you could visualizing the cluster assignments against the positive markers to oberve any patterns:</div><hr>')
577
 
578
  with gr.Row():
579
  with gr.Column(scale=2):