scverse / scanpy

Single-cell analysis in Python. Scales to >1M cells.
https://scanpy.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.92k stars 602 forks source link

TCR and BCR genes and HVGs selection #2895

Closed pmarzano97 closed 8 months ago

pmarzano97 commented 8 months ago

Hello world! I've read in many papers that when performing a re-clustering of some populations, like T cells or B cells, prior to the step of integration and so on, they re-calculate the HVGs but excluding the TCR- or BCR-related genes, because they are donor-specific, especially when talking about BCR.

Can you help me how to remove the TCR- or BCR-related genes before computing the HVGs selection, but without removing them from the .var of the anndata, since I want to evaluate their expression during the step of cell annotation?

The code that I use to calculate the HVGs is the following: sc.pp.highly_variable_genes(adata, n_top_genes = 4000, flavor = "seurat_v3", layer = "raw", batch_key = 'sample_id', subset = False)

Thanks a lot! Paolo

flying-sheep commented 8 months ago

Hi! For questions like this, https://discourse.scverse.org/ is the better match. GitHub is more for bugs and feature requests. I’ll close this issue, but please add a link to your discourse post here once you made it.