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

Export to Anndata (after integration) #19

Open
DaminK opened this issue Nov 7, 2024 · 0 comments
Open

Export to Anndata (after integration) #19

DaminK opened this issue Nov 7, 2024 · 0 comments

Comments

@DaminK
Copy link

DaminK commented Nov 7, 2024

Thanks for all the work you put in this cool package!

I was wondering if you are considering adding an Anndata export / interface to easily transfer aligned scRNA datasets back into a single anndata object for further downstream analysis. If this is available somewhere please point it out as I couldn't find it in the source code.

It should be feasible and would enable many less technical people to use your package for preprocessing for other use-cases.

A simple (inefficient) approach to implement this is as follows:

#Integration with LIGER
adatas_liger = pyliger.create_liger([adata1,adata2,adata3, ...])
... normalize, select_genes, scale_not_center, optimize_ALS, quantile_norm ...

#Export in a shared Anndata & store transformed gene expression
adata_shared = ad.concat([adata1,adata2,adata3, ...],axis =0, join="outer") 
adata_shared.obsm["X_liger"] = np.zeros(adata_shared.X.shape)
for i,gene in tqdm(enumerate(adata_shared.var.index)):
    adata_shared.obsm["X_liger"][:,i] =  pyliger.plotting._utilities.get_gene_values(adatas_liger, gene)

I have a small working prototype for my own export, if you are interested in merging this (after optimizing it by not using calling get_gene_values for indivdual genes and rather perform this operation parallelized on all genes), let me know and I will open a pull request. One might also want to include the computed factorizations (as obsm and varm according to best practizes for other factorizations in anndata)

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

No branches or pull requests

1 participant