Running and saving PCA on different anndata layers
See original GitHub issue- Additional function parameters / changed functionality / changed defaults?
- New analysis tool: A simple analysis tool you have been using and are missing in
sc.tools
? - New plotting function: A kind of plot you would like to seein
sc.pl
? - External tools: Do you know an existing package that should go into
sc.external.*
? - Other?
I find using the adata.layers
really useful to compare normalisation strategies. I’d like to also be able to seamlessly run sc.tl.pca
on data stored in different layers of the same anndata
object.
At the moment my workaround is to set adata.X
before PCA and changing the key to the adata.obsm
element after:
adata.X = adata.layers["mylayer"]
sc.tl.pca(adata)
adata.obsm["mylayer_pca"] = adata.obsm["X_pca"]
Ideally I’d like to just be able to set a layer
argument in sc.tl.pca
, as in the plotting functions.
Any plans on linking data layers to dimensionality reductions?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Running and saving PCA on different anndata layers #1301
pca on data stored in different layers of the same anndata object. At the moment my workaround is to set adata.X before PCA...
Read more >scanpy_07_spatial - GitHub Pages
visium_sge() downloads the dataset from 10x genomics and returns an AnnData object that contains counts, images and spatial coordinates. We will calculate ...
Read more >scanpy.pl.pca — Scanpy 1.9.1 documentation - Read the Docs
Name of the AnnData object layer that wants to be plotted. By default adata.raw.X is plotted. If use_raw=False is set, then adata.X is...
Read more >Introduction to scvi-tools — scvi 0.7.0 documentation
Now it's time to run setup_anndata() , which alerts scvi-tools to the locations of various matrices inside the anndata. It's important to run...
Read more >anndata: annotated data in R - R-bloggers
anndata is a commonly used Python package for keeping track of data ... and anndata through reticulate, but run into issues converting some ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Is there any update on the progress of this?
Hi, you can also do this directly
adata.obsm["mylayer_pca"] = sc.tl.pca(adata.layers["mylayer"])