Scanpy: Filtering cells by barcodes?

Created on 4 Dec 2019  路  3Comments  路  Source: theislab/scanpy

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

Most helpful comment

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()

All 3 comments

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()

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Olivia117 picture Olivia117  路  4Comments

naity picture naity  路  5Comments

koalap-2018 picture koalap-2018  路  3Comments

Khalid-Usman picture Khalid-Usman  路  3Comments

sjfleming picture sjfleming  路  3Comments