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

categorial array not stored in .uns in v0.7rc1 #292

Closed
picciama opened this issue Jan 12, 2020 · 2 comments
Closed

categorial array not stored in .uns in v0.7rc1 #292

picciama opened this issue Jan 12, 2020 · 2 comments

Comments

@picciama
Copy link

I am currently writing an interface for diffxpy/batchglm and MASS/MAST/edgeR since we are trying to compare the fitting/DE tools between available R packages and diffxpy.
v0.6.22 needed to be updated since it couldn't read in h5ad files any longer (probably due to the pandas update)

AnnData.write in v0.6.22 stored the levels of categorical variables in .uns. This had the advantage that reading the file with R (using rhdf5 library) was easily possible, since it recognized $var and $obs as data.frame object.
Since 0.7rc1, it is stored differently, so R now recognizes it as a list.
Here an example, with a condition and batch column in the obs dataframe after reading it in R:

Old structure (v0.6.22):

X$obs: data.frame with names(X$obs) = c('condition', 'column')

X$uns: $batch_categories
       $condition_categories

This is a data.frame and a list.

New structure (v0.7rc1):

X$obs: $`__categories`: $condition
                        $batch
       $condition
       $batch

This is a list.

Can you already tell me what the structure will be when 0.7 is officially released?

This is related to #171 I think (see comment #171 (comment)).

@ivirshup
Copy link
Member

We've moved to a new on-disk representation for dataframes which clears up some of the problems with how we represented categorical values (for example, if species was a categorical in obs and var, only one of those would be stored in uns). The documentation for this is on this #267, in particular here. Hope this helps!

@picciama
Copy link
Author

picciama commented Jan 13, 2020

Thanks for clarifying @ivirshup. The docs are also very nice and I implemented it so that it is working with >= anndata v0.7.

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

No branches or pull requests

2 participants