You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please describe your wishes and possible alternatives to achieve the desired result.
Right now AnnData.isbacked (i.e., X is None and AnnData.filename is present) is used for checking for a variety of different behaviors/conditions aside from just getting X:
I think these cases can succinctly be broken down into two categories:
Broken/unnecessary behavior I think 5 (because it is deprecated) and 2 fall into this category. To solve this I would propose just remove the behavior
Behavior that doesn't work anyway on h5py.Dataset, BaseCompressedSparseDataset or zarr.Array i.e., things that are broken if isbacked is False but the underlying class on X or a different elem is the same or similar to if it were True. This is 1, 3, 4, 6, and 8. For this we probably need a AnnData.predicate function or similar that crawls the AnnData object and checks for a condition at each "leaf node" i.e., is it an instance of class that has a certain attribute (like .T in case 4 above or copy where making a copy of e.g., a zarr.Array probably doesn't make sense). Here we would probably refactor {read,write}_dispatched to rely on this behavior as well and just factor out the "what do you do at a node" part to either read/write or return a boolean
The goal of this is to simplify things to the point where isbacked either doesn't exist or runs on the proposed predicate function. This would make #2357 much simpler because we can just take actions depending on whether any of the objects are "backed"
Please describe your wishes and possible alternatives to achieve the desired result.
Right now
AnnData.isbacked(i.e.,X is NoneandAnnData.filenameis present) is used for checking for a variety of different behaviors/conditions aside from just gettingX:AnnData.is_viewthis is meant to prevent accidentally reading a backed array into memory, I guess, since it will materializeXAnnData.Talthough this is actually just broken in general - you can't tranpose something backed and will get anAttributeErrorabout.Tonh5py.Dataset- again ????? fix: disallowtransposefor "raw" backed array objects #2399AnnData.concatenate: chore!: removeAnnData.concatenate#2370RawAnnData.__{del,set}item__: fix!: remove__delitem__and__setitem__from theAnnDataobject #2367copyofAnnDatafix: disallowcopyfor "backed" objects #2406I think these cases can succinctly be broken down into two categories:
h5py.Dataset,BaseCompressedSparseDatasetorzarr.Arrayi.e., things that are broken ifisbackedisFalsebut the underlying class onXor a different elem is the same or similar to if it wereTrue. This is 1, 3, 4, 6, and 8. For this we probably need aAnnData.predicatefunction or similar that crawls theAnnDataobject and checks for a condition at each "leaf node" i.e., is it an instance of class that has a certain attribute (like.Tin case 4 above orcopywhere making a copy of e.g., azarr.Arrayprobably doesn't make sense). Here we would probably refactor{read,write}_dispatchedto rely on this behavior as well and just factor out the "what do you do at a node" part to either read/write or return a booleanThe goal of this is to simplify things to the point where
isbackedeither doesn't exist or runs on the proposedpredicatefunction. This would make #2357 much simpler because we can just take actions depending on whether any of the objects are "backed"