scverse / anndata

Annotated data.
http://anndata.readthedocs.io
BSD 3-Clause "New" or "Revised" License
577 stars 152 forks source link

Allowing `.X` to be None #467

Open ivirshup opened 3 years ago

ivirshup commented 3 years ago

Tracking issue for allowing X to be None.

When parts get ticked off they should be marked with the PR that fixed them.

TODO:

All of these need tests, some of them may already work.


There is a bit of ordering to do here.

flying-sheep commented 3 years ago

@rcannood which of the above points have been adressed by your PR?

rcannood commented 3 years ago

To begin:

There are also some basic checks for 'Views', but not everything mentioned above has been taken care of so it's still WIP.

ivirshup commented 2 years ago

I've fixed up many of these cases in #677.

I think .X is None is now in a fairly useable state, and think we're in an alright place to push the rest to the next release.

ivirshup commented 2 years ago

Adding a point to the checklist:

Gotta figure out what the shape of the object is when X is None. Currently we figure out the shape of an AnnData by checking the shapes of X, obs, and var and asserting everything else fits that. What we should probably start doing is resolving the shape from all elements, so an AnnData with just obsm/ varm can be created.


An interesting question is what happens if you only provide elements aligned to one axis. E.g. just obsm or obs. Is n_vars unknown or zero?

Is this allowed?

adata = AnnData(obs=obs)

Then what is n_vars. Would this be allowed after?

adata.varm["x"] = np.ones((20, 10))
ivirshup commented 2 months ago

We think this is probably closable but we need to verify