# Filter genes in a subset of cells

**URL:** <https://discourse.scverse.org/t/filter-genes-in-a-subset-of-cells/668>\
**Category:** Help\
**Created:** [August 8, 2022, 8:09am UTC](https://discourse.scverse.org/t/filter-genes-in-a-subset-of-cells/668 "2022-08-08T08:09:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wangjiawen2013](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/wangjiawen2013/32/25_2.png) [@wangjiawen2013](https://discourse.scverse.org/u/wangjiawen2013)\
**Post date:** [August 8, 2022, 8:09am UTC](https://discourse.scverse.org/t/filter-genes-in-a-subset-of-cells/668/1 "2022-08-08T08:09:59Z")

</div>

Hi,  
I subset a adata using:  
adata\_subset = adata[adata.obs[‘leiden’]=‘0’].copy()  
Then I wanna filter genes because some genes will become all-zero becuase the reduced cell number.  
I found that the results are the same:  
adata\_subset.X = adata\_subset.raw.X  
sc.pp.filter\_genes(min\_cells=1).  
And:  
use sc.pp.filter\_genes(min\_cells=1) only, without adata\_subset.X = adata\_subset.raw.X.  
So I wanna know which data (scaled data in adata\_subset.X or adata\_subset.raw.X) that sc.pp.filter\_genes() use.

Besides,  
After I set adata\_subset.X = adata\_subset.raw.X，I ran sc.tl.rank\_genes\_groups(), will the results be the same when setting use\_raw=True and use\_raw=False ?
