How to show the cells on my umap projection based on barcodes

Thank you for the tool your team developed.

I want to show the cells on my umap projection based on barcodes.

I see you’ve shared similar code before.
https://github.com/scverse/scanpy/issues/946

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

When I tried this, I failed.

I’m sure the barcodes and adata.obs_names match, but the isin function is still returning False

Here are the barcodes I want (F1)

Below are barcodes in adata(F2)

As seen in the figure, the first barcode is an exact match.

However, when I run the following code,
BCadata.obs[‘TEST2’] = BCadata.obs_names.isin([‘Want_barcodes’])
All results are Fasle.(F3)

I’m sure that the barcodes can match, but I don’t know why the results of the isin function are all False. I wonder if you can help me? Thank you very much

I hope you are not keeping Want_barcodes quoted i.e. like ‘Want_barcodes’… because then it would be understood as a string and obviously you wouldn’t have any barcode matching the string ‘Want_barcodes’

Hello, thank you for your reply~

What data type should barcodes be in order to be correctly identified by isin?

I tried the ‘list’ as well as*‘Pandas. The core indexes. Base. The Index’*

Neither of these can be correctly identified