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

Adding cell-volume size factor normalisation for spatial #330

Open
wlason opened this issue Feb 10, 2025 · 1 comment
Open

Adding cell-volume size factor normalisation for spatial #330

wlason opened this issue Feb 10, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@wlason
Copy link
Contributor

wlason commented Feb 10, 2025

This paper suggests that normalisation using cell volumes as size factors (instead of library sizes) for data with good segmentation results and scTransform for data with poor segmentation results performs better for spatially resolved data compared to single-cell lognorm from Scanpy.

https://doi.org/10.1186/s13059-024-03303-w

This is the summary of the considerations the Authors propose:

Image

I was hoping we can add these alternative normalisation methods to panpipes spatial preprocess workflow.
I think the scTransform is already added as norm_hvg_flavour: seurat, but the volume-based normalisation is only available in R.

@wlason wlason added the enhancement New feature or request label Feb 10, 2025
@wlason
Copy link
Contributor Author

wlason commented Feb 10, 2025

Suggested way to do this:

X = adata.layers['raw'].copy()
Xnorm = np.divide(X.todense().T, adata.obs['cell_area'].values).T * 1000
# logtransformation
Xnorm = np.log1p(Xnorm)

# convert back to a sparse matrix.
from scipy import sparse
adata.X = sparse.csr_matrix(Xnorm.copy())

Taken from the ELIXIR Spatial Transcriptomics Course.

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

No branches or pull requests

1 participant