Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subsetting / subclustering, use raw #826

Open
bobermayer opened this issue Sep 10, 2019 · 3 comments
Open

subsetting / subclustering, use raw #826

bobermayer opened this issue Sep 10, 2019 · 3 comments

Comments

@bobermayer
Copy link

when I select a subset of cells using ad_sub=ad[ad.obs['louvain']=='subcluster_of_interest',:], and then re-apply preprocessing routines, this will use only the genes of ad.X (variable over the entire dataset), but not those that are variable only within the subcluster and might be informative for its substructure even if the variance doesn't pass the cutoff when evaluated over the entire dataset. basically, the set of variable genes can only shrink by subsetting..

I'd propose to either use

tmp=ad[ad.obs['louvain']=='subcluster_of_interest',:]
ad_sub=sc.AnnData(tmp.raw.X,obs=tmp.obs,var=tmp.raw.var)

to "reset" the .X matrix (maybe there's a better way?)
or to make sc.pp.highly_variable_genes work on ad.raw.X

scanpy==1.4.4 anndata==0.6.22.post1 umap==0.3.10 numpy==1.16.4 scipy==1.2.1 pandas==0.25.1 scikit-learn==0.20.3 statsmodels==0.10.1 python-igraph==0.7.1 louvain==0.6.1
@chansigit
Copy link

I have the same question

@ajynair
Copy link

ajynair commented Feb 25, 2021

+1

1 similar comment
@li-xuyang28
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants