Metadata-Version: 2.1
Name: salamander-learn
Version: 0.4.1
Summary: Salamander is a non-negative matrix factorization framework for signature analysis
License: MIT
Author: Benedikt Geiger
Maintainer: Benedikt Geiger
Maintainer-email: benedikt_geiger@hms.harvard.edu
Requires-Python: >=3.9,<3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: adjustText (>=0.8,<0.9)
Requires-Dist: anndata (>=0.10.5,<0.11.0)
Requires-Dist: fastcluster (>=1.2.6,<2.0.0)
Requires-Dist: matplotlib (>=3.7.1,<4.0.0)
Requires-Dist: mudata (>=0.2.3,<0.3.0)
Requires-Dist: numba (>=0.59,<0.60)
Requires-Dist: numpy (>=1.24.3,<2.0.0)
Requires-Dist: pandas (>=1.5.3,<2.0.0)
Requires-Dist: scikit-learn (>=1.3.0,<2.0.0)
Requires-Dist: scipy (>=1.10.1,<2.0.0)
Requires-Dist: seaborn (>=0.13.0,<0.14.0)
Requires-Dist: umap-learn (>=0.5.4,<0.6.0)
Description-Content-Type: text/markdown

# Salamander

[![Python versions supported][python-image]][python-url]
[![License][license-image]][license-url]
[![Code style][style-image]][style-url]

[python-image]: https://img.shields.io/badge/python-3.9%20|%203.10%20|%203.11-blue.svg
[python-url]: https://github.com/parklab/salamander
[license-image]: https://img.shields.io/badge/License-MIT-yellow.svg
[license-url]: https://github.com/parklab/salamander/blob/main/LICENSE
[style-image]: https://img.shields.io/badge/code%20style-black-000000.svg
[style-url]: https://github.com/psf/black

Salamander is a non-negative matrix factorization (NMF) framework for signature analysis build on top of [AnnData](https://anndata.readthedocs.io/en/latest/) and [MuData](https://mudata.readthedocs.io/en/latest/). It implements multiple NMF algorithms, common visualizations, and can be easily customized & expanded.

---

## Installation

PyPI:
```bash
pip install salamander-learn
```

## Usage

The following example illustrates the basic syntax:

```python
import anndata as ad
import salamander as sal

# initialize data
adata = ad.AnnData(...)

# NMF with Poisson noise
model = sal.models.KLNMF(n_signatures=5)
model.fit(adata)

# barplot
model.plot_signatures()

# stacked barplot
model.plot_exposures()

# signature correlation
model.plot_correlation()

# sample_correlation
model.plot_correlation(data="samples")

# dimensionality reduction of the exposures
model.plot_embeddings(method="umap")
```

For examples of how to customize any NMF algorithm and the plots, check out [the tutorial](https://github.com/parklab/salamander/blob/main/tutorial.ipynb). The following algorithms are currently available:
* [NMF with KL-divergence loss](https://proceedings.neurips.cc/paper_files/paper/2000/file/f9d1152547c0bde01830b7e8bd60024c-Paper.pdf)
* [minimum-volume NMF](https://browse.arxiv.org/pdf/1907.02404.pdf)
* [a variant of correlated NMF](https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=87224164eef14589b137547a3fa81f06eef9bbf4)

## License

MIT

## Changelog

Consult the [CHANGELOG](https://github.com/parklab/Salamander/blob/main/CHANGELOG.md) file for enhancements and fixes of each version.

