diff --git a/docker-compose.yml b/docker-compose.yml index 71f6942..86f3be4 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.0 + image: bigdatainbiomedicine/simba-qc:0.2.1 diff --git a/src/sliders.py b/src/sliders.py index b53a619..5c23696 100644 --- a/src/sliders.py +++ b/src/sliders.py @@ -76,12 +76,12 @@ def return_of_adata_meta(): @reactive.effect def random_sample(): adata = _adata_qc.get() - sample_size = input['random_sample_size'].get() - if adata is None: return - - adata_sample = adata[np.random.choice(adata.obs.index, sample_size, replace=False)] + + sample_size = input['random_sample_size'].get() + + adata_sample = adata[np.random.choice(adata.obs.index, min(sample_size, len(adata.obs)), replace=False)] _adata_sample.set(adata_sample) @output