diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 017f37a..2475fde 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -22,7 +22,7 @@ "ms-python.black-formatter" ] } - }, + } // Configure tool-specific properties. // "customizations": {}, diff --git a/docker-compose.yml b/docker-compose.yml index b3261c7..5bae1dc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,4 +5,4 @@ services: dockerfile: Dockerfile ports: - 8080:8080 - image: bigdatainbiomedicine/simba-qc:0.2.3 + image: bigdatainbiomedicine/simba-qc:0.2.4 diff --git a/src/app.py b/src/app.py index a0c3461..992f448 100644 --- a/src/app.py +++ b/src/app.py @@ -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 @@ -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")), diff --git a/src/plots.py b/src/plots.py index f9d36c1..55cc19e 100644 --- a/src/plots.py +++ b/src/plots.py @@ -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", ) @@ -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" diff --git a/src/sliders.py b/src/sliders.py index 77c22a2..e696dab 100644 --- a/src/sliders.py +++ b/src/sliders.py @@ -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", @@ -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) @@ -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])