Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sera/issue random sample size #3

Merged
merged 5 commits into from
Jun 2, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/sliders.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,16 @@ 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:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be sufficient to check only once if adata is None

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okee

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return

obs_number = adata.n_obs
sample_size = input['random_sample_size']()

if int(sample_size) > int(obs_number):
sample_size = obs_number
ui.update_slider('random_sample_size', value=sample_size, max=obs_number)


if adata is None:
return
Expand Down