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

sc.pp.subsample, allow for sampling with replacement #2854

Closed
AlexAdrian-Hamazaki opened this issue Feb 14, 2024 · 1 comment · Fixed by #943
Closed

sc.pp.subsample, allow for sampling with replacement #2854

AlexAdrian-Hamazaki opened this issue Feb 14, 2024 · 1 comment · Fixed by #943

Comments

@AlexAdrian-Hamazaki
Copy link

What kind of feature would you like to request?

Additional function parameters / changed functionality / changed defaults?

Please describe your wishes

Currently sc.pp.subsample does not allow for sampling with replacement.

When n_obs is provided, and it is larger than the size of the adata object, an error message from numpy.random.choice is given.
"obs_indices = np.random.choice(old_n_obs, size=new_n_obs, replace=False)"

It seems like replace is automatically set to False.

It would be great if sc.pp.subsample provided a paramater to change the np.random.choice's 'replace' parameter to True.

@ivirshup
Copy link
Member

It looks like there is an old stalled PR for this.

Would you want to pick that up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants