Spaces:
Runtime error
Runtime error
Commit ·
dd2eb16
1
Parent(s): 45e97b2
fix new counts
Browse files
app.py
CHANGED
|
@@ -173,7 +173,7 @@ def perturb(gene, locus1, locus2):
|
|
| 173 |
# get integer index of gene
|
| 174 |
gene_idx = gene_idx_map[gene]
|
| 175 |
rna.obs['log2FC'] = ism[:, gene_idx]
|
| 176 |
-
rna.
|
| 177 |
|
| 178 |
fig = sc.pl.umap(rna,
|
| 179 |
color=['celltype', 'log2FC'],
|
|
@@ -203,7 +203,7 @@ def perturb(gene, locus1, locus2):
|
|
| 203 |
violin_img = violin_img[:, :, [1, 2, 3, 0]]
|
| 204 |
|
| 205 |
fig, ax = plt.subplots(figsize=(6, 3))
|
| 206 |
-
sc.pl.violin(rna,
|
| 207 |
ax.set_title(f'{gene} expression after perturbation')
|
| 208 |
fig.canvas.draw()
|
| 209 |
violin_img_new = np.frombuffer(fig.canvas.tostring_argb(), dtype=np.uint8)
|
|
|
|
| 173 |
# get integer index of gene
|
| 174 |
gene_idx = gene_idx_map[gene]
|
| 175 |
rna.obs['log2FC'] = ism[:, gene_idx]
|
| 176 |
+
rna.obs['new_counts'] = perterbed_rna_recon[:, gene_idx]
|
| 177 |
|
| 178 |
fig = sc.pl.umap(rna,
|
| 179 |
color=['celltype', 'log2FC'],
|
|
|
|
| 203 |
violin_img = violin_img[:, :, [1, 2, 3, 0]]
|
| 204 |
|
| 205 |
fig, ax = plt.subplots(figsize=(6, 3))
|
| 206 |
+
sc.pl.violin(rna, 'new_counts', groupby='celltype', show=False, ax=ax)
|
| 207 |
ax.set_title(f'{gene} expression after perturbation')
|
| 208 |
fig.canvas.draw()
|
| 209 |
violin_img_new = np.frombuffer(fig.canvas.tostring_argb(), dtype=np.uint8)
|