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
allow sc.pp.subsample in backed mode when returning a copy #2624
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2624 +/- ##
=======================================
Coverage 72.00% 72.01%
=======================================
Files 105 105
Lines 11840 11844 +4
=======================================
+ Hits 8525 8529 +4
Misses 3315 3315
|
Appreciate the PR - let me know if I can be of any assistance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for opening this!
What happens if the object is backed, but copy=False
?
When the object is backed, but |
Could you throw a more informative error message for
? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor change, I would invert the loops. I think it makes more sense to consider the isbacked
cases together. So:
if data.isbacked:
if copy:
return data[obs_indices].to_memory()
else:
raise NotImplementedError(...)
else:
if copy:
...
Otherwise looking good! One minor change in the tests.
Co-authored-by: Isaac Virshup <ivirshup@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks!
* allow backed subsampling when returning a copy * no extra copying, added test * added description in release-notes * more informative error message for copy=False * Update scanpy/tests/test_preprocessing.py Co-authored-by: Isaac Virshup <ivirshup@gmail.com> * inverted branching --------- Co-authored-by: Eljas <eljas.roellin@gmail.com> Co-authored-by: Isaac Virshup <ivirshup@gmail.com>
Adresses issue #2495.
Suggested change to allow
sc.pp.subsample
in backed mode of AnnData, whencopy=True
insc.pp.subsample
Tagging @ivirshup.