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

Filtering cells by barcodes? #946

Closed
maxnguyen46 opened this issue Dec 4, 2019 · 3 comments
Closed

Filtering cells by barcodes? #946

maxnguyen46 opened this issue Dec 4, 2019 · 3 comments

Comments

@maxnguyen46
Copy link

maxnguyen46 commented Dec 4, 2019

Hello,

If I have a list of cells that I want to look at (and their corresponding barcodes), is it possible to filter to just those cells?

Thanks

@coh-racng
Copy link
Contributor

if you have the barcodes in a list, the following command will give you a new adata object filtered for those cells:

adata[barcodes].copy()

@maxnguyen46
Copy link
Author

Thanks for this.

One more question for you. If I want to color cells on my umap projection based on barcodes instead of by gene, is there an easy implementation of that? Thanks! @coh-racng

@coh-racng
Copy link
Contributor

adata.obs['filtered_barcodes'] = adata.obs_names.isin[barcodes]
sc.pl.umap(adata, color='filtered_barcodes')

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

3 participants