Skip to content

imsb-uke/nichepca

Repository files navigation

NichePCA

Tests

Package for PCA-based spatial domain identification in single-cell spatial transcriptomics data

Getting started

Given an AnnData object adata, you can run nichepca starting from raw counts as follows:

import scanpy as sc
import nichepca as npc

npc.wf.nichepca(adata, knn=25)
sc.pp.neighbors(adata, use_rep="X_npca")
sc.tl.leiden(adata, resolution=0.5)

If you have multiple samples in adata.obs['sample'], you can provide the key sample to npc.wf.nichepca:

npc.wf.nichepca(adata, knn=25, sample_key="sample")

If you have cell type labels in adata.obs['cell_type'], you can directly provide them to nichepca as follows:

npc.wf.nichepca(adata, knn=25, obs_key='cell_type')

The nichepca functiopn also allows to customize the original ("norm", "log1p", "agg", "pca") pipeline, e.g., without median normalization:

npc.wf.nichepca(adata, knn=25, pipeline=["log1p", "agg", "pca"])

or with "pca" before "agg":

npc.wf.nichepca(adata, knn=25, pipeline=["norm", "log1p", "pca", "agg"])

or without "pca" at all:

npc.wf.nichepca(adata, knn=25, pipeline=["norm", "log1p", "agg"])

Setting parameters

We found that higher number of neighbors e.g., knn=25 lead to better results in brain tissue, while knn=10 works well for kidney data. We recommend to qualitatively optimize these parameters on a small subset of your data. The number of PCs (n_comps=30 by default) seems to have negligible effect on the results.

Installation

You need to have Python 3.10 or newer installed on your system. If you don't have Python installed, we recommend installing Mambaforge or Miniconda.

To create a new conda environment with Python 3.10:

conda create -n npc-env python=3.10 -y
conda activate npc-env

There are several options to install nichepca:

  1. Install the latest development version:
pip install git+https://github.com/imsb-uke/nichepca.git@main

Release notes

See the changelog.

Contact

For questions and help requests, you can reach out in the scverse discourse. If you found a bug, please use the issue tracker.

Citation

t.b.a

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages