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

UMAP colouring beyond adata.X or adata.obs #1189

Closed
ajitjohnson opened this issue Apr 29, 2020 · 6 comments
Closed

UMAP colouring beyond adata.X or adata.obs #1189

ajitjohnson opened this issue Apr 29, 2020 · 6 comments
Labels

Comments

@ajitjohnson
Copy link

ajitjohnson commented Apr 29, 2020

Hi I think by default sc.pl.umap looks into adata.X and adata.obs for coloring UMAP. Is it possible to force the function to look into adata.uns or adata.obsm where the cells are ordered in the same manner as that of adata.obs.index. Thank you.

@ajitjohnson ajitjohnson changed the title UMAP color from beyond adata.X or adata.obs UMAP colouring beyond adata.X or adata.obs Apr 29, 2020
@LuckyMD
Copy link
Contributor

LuckyMD commented Apr 29, 2020

Why not store whatever you have in adata.uns that you want to colour by in adata.obs? adata.obs is designed specifically to store univariate data with dimensions of (n_obs,1). As colouring can also only work with univariate values, I currently don't really understand the need for this. Could you elaborate why this is needed?

@ajitjohnson
Copy link
Author

ajitjohnson commented Apr 29, 2020

Yes, that is what I currently do. It is just a matter of aesthetics. Since I have a large number of variables that I generate with custom functions, I wanted to store them separately based on what they represent in separate modules under (adata.uns).

Adding everything to adata.obs quickly gets cluttered. No worries just wanted to see if it was an option. Thank you.

@LuckyMD
Copy link
Contributor

LuckyMD commented Apr 29, 2020

I think adata.obsm could make sense, but adata.uns would maybe be a bit too messy given the unstructured nature and the assumptions and tests that would have to be added.

@ajitjohnson
Copy link
Author

ajitjohnson commented Apr 30, 2020

Yeah, that makes absolute sense.

Even better would be to add layers similar to adata.X and pass that into any function. Something like adata.obs_custom. In which case adata.obs_custom will inherit the same properties as that of adata.obs and users can make as many as they need in an organized manner. It will also allow users to store different values with the same column name (of course in different layers). e.g. adata.obs_custom['same_column_name'] and adata.obs_custom2['same_column_name']

@ivirshup
Copy link
Member

@ajitjohnson, I think you could use dataframes in obsm for that. We are planning on letting you plot colors from obsm, which is being worked on in this PR: scverse/anndata#342

@ajitjohnson
Copy link
Author

that sounds awesome.

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

No branches or pull requests

3 participants