[go: nahoru, domu]

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

getassaydata from scanpy object #870

Closed
koalap-2018 opened this issue Oct 13, 2019 · 4 comments
Closed

getassaydata from scanpy object #870

koalap-2018 opened this issue Oct 13, 2019 · 4 comments
Labels

Comments

@koalap-2018
Copy link

Hi guys,

I am trying to get the gene expression raw, log, scaled for just a couple of genes from the anndata object but i have tried doesnt seem to work. I just want a simple dataframe with the gene names as colum indexes and row info of the cells. this is waht i used to do in seurat. I am sure there is an easy way to do this in scanpy but just havent figure out.

geneX_df=as.data.frame(as.matrix(GetAssayData(object = anndata, slot = "data")["geneX",]))

Thanks!

@LuckyMD
Copy link
Contributor
LuckyMD commented Oct 13, 2019

Hi,

If adata is your anndata object, you can get the expression data from adata.X. Depending on what you did to the object before, that will contain differently pre-processed data.

If you want it for "Gene A", then you can use adata[:,'Gene A'].Xto get the expression value of Gene A in all cells.

You can of course put that into a pandas dataframe via pd.DataFrame()

@koalap-2018
Copy link
Author

Thanks @LuckyMD

@flying-sheep
Copy link
Member

Hi! I hope you’ll enjoy using scanpy. Beginner questions like this are more suited for https://scanpy.discourse.group/ or stackoverflow so we still have some overview over this bug tracker.

@koalap-2018
Copy link
Author

Great thanks so much!

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

No branches or pull requests

3 participants