Skip to content

Commit

Permalink
Merge pull request #6 from Mye-InfoBank/sera/float_issue
Browse files Browse the repository at this point in the history
Fix float32 JSON serialization
  • Loading branch information
nictru authored Jun 20, 2024
2 parents 0c9f532 + 099d346 commit ea1d4c8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"ms-python.black-formatter"
]
}
},
}

// Configure tool-specific properties.
// "customizations": {},
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ services:
dockerfile: Dockerfile
ports:
- 8080:8080
image: bigdatainbiomedicine/simba-qc:0.2.3
image: bigdatainbiomedicine/simba-qc:0.2.4
3 changes: 1 addition & 2 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import tempfile
import anndata as ad
import pandas as pd
import json

from sliders import slider_ui, slider_server
from distributions import distributions_server
Expand All @@ -18,7 +18,6 @@
'pct_counts_mt': 'Percentage of counts from mitochondrial genes',
})


app_ui = ui.page_navbar(
ui.nav_panel("1. Upload", ui.input_file("file_input", label="Upload your file", accept=".h5ad")),
ui.nav_panel("2. Metadata", metadata_ui("metadata")),
Expand Down
9 changes: 5 additions & 4 deletions src/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ def plot_scatter():
fig, ax = plt.subplots()

ax.scatter(
adata.obs[x_col],
adata.obs[y_col],
c=adata.obs[color_col],
adata.obs[x_col].astype(float),
adata.obs[y_col].astype(float),
c=adata.obs[color_col].astype(float),
s=dot_size,
cmap="viridis",
)
Expand Down Expand Up @@ -133,10 +133,11 @@ def plot_histograms():

return fig

@output
@render.text
def n_cells():
adata = _adata.get()

if adata is not None:
n_cells = adata.n_obs
n_cells = int(adata.n_obs)
return f"{n_cells} cells pass the current filtering thresholds"
16 changes: 8 additions & 8 deletions src/sliders.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def slider_sample():
if adata is None:
return

n_obs = adata.n_obs
n_obs = int(adata.n_obs)
return ui.input_slider(
"random_sample_size",
"Random sample size",
Expand Down Expand Up @@ -120,9 +120,9 @@ def slider_filters():
absolute = ui.input_slider(
f"{col}_absolute",
"Absolute value",
distributions[col]["min"],
distributions[col]["max"],
[distributions[col]["min"], distributions[col]["max"]],
float(distributions[col]["min"]),
float(distributions[col]["max"]),
[float(distributions[col]["min"]), float(distributions[col]["max"])],
)
panel = ui.accordion_panel(pretty_name, mads, absolute)
panels.append(panel)
Expand Down Expand Up @@ -155,12 +155,12 @@ def update_absolute_by_mads():
if mads is None or absolute is None:
continue

min_val = (
min_val = float((
distributions[col]["median"] - mads * distributions[col]["std"]
)
max_val = (
))
max_val = float((
distributions[col]["median"] + mads * distributions[col]["std"]
)
))

ui.update_slider(absolute_name, value=[min_val, max_val])

Expand Down

0 comments on commit ea1d4c8

Please sign in to comment.