Skip to content

Add example for selecting a subset from a backed adata #117

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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

sgratiy
Copy link
Contributor

@sgratiy sgratiy commented Jul 23, 2021

Problem:
View of backed data does not allow adding annotations.
For example something like this would work for AnnData and View of AnnData in memory:
normalized_adata.uns['hvg']={"flavour":"hicat"}
but this fails for a View of backed data

Solution:
Explain users how to use AnnData when working with the subset of backed data by adding to the notebook the following:

# if wanting to work with a subset of data in backed mode (here choosing the first 1000 cells):
normalized_adata = normalized_adata[:1000,:].copy(filename='./data/normalized_subset.h5ad')
print(normalized_adata)

apparently this is by design. See the very end of the anndata blog post.
Validation:
HVG on a subset done this way does not fail:
image

Note:
if we follow this route, we should also add nice exception message if users do pass View to functions. Not sure how many modules are affected by this.

@sgratiy sgratiy requested review from MatthewAitken and JakeSAI July 23, 2021 23:32
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

Successfully merging this pull request may close these issues.

1 participant