Subsetting populations

Hello!
I’m working on a big dataset of immune cells, where we sequenced total PBMCs.
After I’ve identified the different immune cell families with known signatures, I would like to select specific clusters and perform the reclustering of them to study more in detail the differences within that specific population.

My question is related to whether I have or not to use the code “sc.AnnData()” after the selection of the clusters.
To be more precise, this is the code:
(adata is the total object, while adata_reduced is the subsetting)

  1. adata_reduced = adata[adata.obs[‘leiden’].isin([‘1’, ‘6’])].copy()
  2. adata_reduced = sc.AnnData(X = adata_reduced.raw.X, obs = adata_reduced.obs, var = adata_reduced.var, layers = adata_reduced.layers)

Should I use the code in line 2 or after the subsetting I can directly proceed with the HVG selection and integration (I use scVI-tools), with new neighbors and PAGA and UMAP calculations?

Thanks a lot!

Hello @pmarzano,
It seems your second line is redundent.

You can use some code to assert yourself that the new object from line two is identical to the object you have created in line one.