Metadata-Version: 2.4
Name: nicheenergy
Version: 0.1.0
Summary: Disentanglement-based self-supervised framework for label-free spatial niche identification
Home-page: https://github.com/ZzzsHuqiaAao/NicheEnergy
Author: NicheEnergy contributors
License: BSD-3-Clause
Project-URL: Source, https://github.com/ZzzsHuqiaAao/NicheEnergy
Project-URL: Issues, https://github.com/ZzzsHuqiaAao/NicheEnergy/issues
Project-URL: Tutorial, https://github.com/ZzzsHuqiaAao/NicheEnergy/blob/main/NicheEnergy_tutorial_MERFISH.ipynb
Classifier: Programming Language :: Python :: 3.10
Classifier: License :: OSI Approved :: BSD License
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: <3.11,>=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: setuptools==75.8.0
Requires-Dist: numpy==1.26.4
Requires-Dist: pandas==2.3.3
Requires-Dist: scipy==1.15.2
Requires-Dist: anndata==0.8.0
Requires-Dist: mudata==0.2.2
Requires-Dist: scanpy==1.11.5
Requires-Dist: scikit-learn==1.7.2
Requires-Dist: statsmodels==0.14.6
Requires-Dist: torch==2.5.1
Requires-Dist: torch-geometric==2.7.0
Requires-Dist: pytorch-lightning==1.9.5
Requires-Dist: scvi-tools==0.20.3
Requires-Dist: py-pcha==0.1.3
Requires-Dist: jax==0.4.28
Requires-Dist: jaxlib==0.4.28
Requires-Dist: flax==0.8.5
Requires-Dist: optax==0.2.2
Requires-Dist: chex==0.1.90
Requires-Dist: numpyro==0.19.0
Requires-Dist: orbax-checkpoint==0.5.16
Dynamic: license-file

# NicheEnergy

NicheEnergy is a disentanglement-based self-supervised framework for identifying spatial niches. It learns intrinsic and niche states within a variational autoencoder using disentangled representation learning and state-modulated Dirichlet energy. NicheEnergy provides label-free niche identification across tissues and modalities and is implemented with scvi-tools and PyTorch.

![NicheEnergy overview](https://raw.githubusercontent.com/ZzzsHuqiaAao/NicheEnergy/main/fig1_github.svg)

## System requirements
### OS requirements
The tutorial uses an NVIDIA GPU and has been run on Linux x86_64 with Python 3.10.14 and PyTorch 2.5.1.

### Dependencies
See [setup.cfg](https://github.com/ZzzsHuqiaAao/NicheEnergy/blob/main/setup.cfg) for package dependencies and [config.txt](https://github.com/ZzzsHuqiaAao/NicheEnergy/blob/main/config.txt) for the pinned package versions.

## Installation

NicheEnergy requires Python 3.10. Install with:

```bash
pip install nicheenergy
```

See the [installation guide](https://github.com/ZzzsHuqiaAao/NicheEnergy/blob/main/nicheenergy/INSTALL.md) for GPU setup and installation from source.

## Documentation
The [MERFISH tutorial](https://github.com/ZzzsHuqiaAao/NicheEnergy/blob/main/NicheEnergy_tutorial_MERFISH.ipynb) shows training loss, z/s UMAPs colored by cell type, reference cortical layers and batch, spatial niche identification, state-modulated Dirichlet energy, and saving results. Dataset preparation and the study analyses are in the companion [NicheEnergy_reproducibility](https://github.com/ZzzsHuqiaAao/NicheEnergy_reproducibility) repository.

## Usage

For detailed usage, follow our tutorial:

- [Getting Started with NicheEnergy](https://github.com/ZzzsHuqiaAao/NicheEnergy/blob/main/NicheEnergy_tutorial_MERFISH.ipynb)

Data and preparation:

- [Original human MERFISH MTG data](https://drive.google.com/drive/folders/1jeAZge-0wJ1gkHEKC4P6PIalumn2A68p?usp=sharing)
- [MTG input preparation](https://github.com/ZzzsHuqiaAao/NicheEnergy_reproducibility/blob/main/benchmarking/MTG.ipynb) (`input.h5ad` and `obs.csv.gz`)
