-
Notifications
You must be signed in to change notification settings - Fork 154
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 del adata.X
, adata.X = None
#463
Conversation
I don't think we currently allow I have come across a case recently where this would be useful, though I think it would take some doing to make the entire codebase work again if we allowed this. Maybe this could be opened as a feature request issue, and you could pitch your use case? |
Thanks for your input.
A possible use case I have is when working with read-only h5ad files: if your input is immutable, it may be interesting to exclude X from the output file to reduce the file size. |
At one point it was allowed, but I can say for certain that a lot of code has been written since then that does not expect For example: a = ad.AnnData(X=None, shape=(100, 200))
a.copy() Traceback---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-12-02bb7baf10a6> in <module>
----> 1 a.copy()
~/github/anndata/anndata/_core/anndata.py in copy(self, filename)
1428 X = _subset(self._adata_ref.X, (self._oidx, self._vidx)).copy()
1429 else:
-> 1430 X = self.X.copy()
1431 # TODO: Figure out what case this is:
1432 if X is not None:
AttributeError: 'NoneType' object has no attribute 'copy' At one point I think I saw If this is something we were to support more, it would need a fair amount of testing. |
Alright :) I hereby turn this PR into a feature request. I'd like What is the opinion of the major anndata developers? 👍 or 👎? If we agree |
Oops, I linked the wrong issue before. #330 is where this has come up before. Also I'm going to open this discussion as a new issue so it's more visible. |
ad.X = None
del adata.X
, adata.X = None
Great, thanks for implementing this and making the suggestion! |
Feature proposal for #464.
Need to test:
test_base.py > test_x_is_none()
)test_base.py > test_x_is_none()
)test_base.py > test_x_is_none()
)test_base.py > test_x_is_none()
)