dylanplummer commited on
Commit
d1a5128
·
1 Parent(s): 32e7db6

test recon mean as original violin

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -356,6 +356,7 @@ def perturb(gene, locus1, locus2, use_max_gene):
356
  else:
357
  gene_idx = gene_idx_map[gene]
358
  rna.obs['log2FC'] = ism[:, gene_idx]
 
359
  rna.obs['new_mean'] = perterbed_rna_recon[:, gene_idx]
360
 
361
  fig = sc.pl.umap(rna,
@@ -378,7 +379,8 @@ def perturb(gene, locus1, locus2, use_max_gene):
378
  image_from_plot = image_from_plot[:, :, [1, 2, 3, 0]]
379
 
380
  fig, ax = plt.subplots(figsize=(6, 4))
381
- sc.pl.violin(rna, max_gene if use_max_gene else gene, groupby='celltype', layer='counts', show=False, ax=ax, rotation=90)
 
382
  ax.set_title(f'Normal {max_gene if use_max_gene else gene} expression')
383
  fig.tight_layout()
384
  fig.canvas.draw()
@@ -438,7 +440,8 @@ with gr.Blocks(theme='WeixuanYuan/Soft_dark') as demo:
438
  outputs = [out_img, out_violin, out_violin_new, out_violin_fc]
439
 
440
  gr.Examples(examples=[['INS', 'chr11:2,289,895', 'chr11:2,298,840', False],
441
- ['INS', 'INS', 'IGF1', False],
 
442
  ['TSPAN1', 'TSPAN1', 'PIK3R3', False],
443
  ['GCG', 'GCG', 'FAP', False],
444
  ['KRT19', 'chr17:22,220,637', 'chr17:39,591,813', False],
 
356
  else:
357
  gene_idx = gene_idx_map[gene]
358
  rna.obs['log2FC'] = ism[:, gene_idx]
359
+ rna.obs['old_mean'] = rna_recon[:, gene_idx]
360
  rna.obs['new_mean'] = perterbed_rna_recon[:, gene_idx]
361
 
362
  fig = sc.pl.umap(rna,
 
379
  image_from_plot = image_from_plot[:, :, [1, 2, 3, 0]]
380
 
381
  fig, ax = plt.subplots(figsize=(6, 4))
382
+ #sc.pl.violin(rna, max_gene if use_max_gene else gene, groupby='celltype', layer='counts', show=False, ax=ax, rotation=90)
383
+ sc.pl.violin(rna, 'old_mean', groupby='celltype', show=False, ax=ax, rotation=90)
384
  ax.set_title(f'Normal {max_gene if use_max_gene else gene} expression')
385
  fig.tight_layout()
386
  fig.canvas.draw()
 
440
  outputs = [out_img, out_violin, out_violin_new, out_violin_fc]
441
 
442
  gr.Examples(examples=[['INS', 'chr11:2,289,895', 'chr11:2,298,840', False],
443
+ ['OTUD3', 'chr1:20457786', 'chr1:20230413', False],
444
+ ['IRX2', 'chr5:2704405', 'chr5:2164879', False],
445
  ['TSPAN1', 'TSPAN1', 'PIK3R3', False],
446
  ['GCG', 'GCG', 'FAP', False],
447
  ['KRT19', 'chr17:22,220,637', 'chr17:39,591,813', False],