Metadata-Version: 2.5
Name: sae-neuropeptide-predictor
Version: 0.1.1
Summary: Predict neuropeptide precursors from protein sequences using InterPLM sparse-autoencoder features from ESM2.
Project-URL: Homepage, https://github.com/akulikova64/sae-neuropeptide-predictor
Project-URL: Repository, https://github.com/akulikova64/sae-neuropeptide-predictor
Author: Anastasiya V. Kulikova
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.10
Requires-Dist: biopython>=1.84
Requires-Dist: fair-esm>=2.0
Requires-Dist: h5py>=3.0
Requires-Dist: huggingface-hub>=0.24
Requires-Dist: joblib>=1.3
Requires-Dist: numpy>=1.26
Requires-Dist: pandas>=2.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: scikit-learn>=1.5
Requires-Dist: torch>=2.1
Requires-Dist: tqdm>=4.60
Requires-Dist: transformers>=4.44
Provides-Extra: dev
Requires-Dist: build; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: twine; extra == 'dev'
Description-Content-Type: text/markdown

# sae-neuropeptide-predictor

Predicts whether a protein sequence is a **neuropeptide precursor**, using sparse
autoencoder (SAE) features decoded from ESM2 protein language model embeddings via
[InterPLM](https://github.com/ElanaPearl/InterPLM).

See [`Sparse autoencoder features from InterPLM predict neuropeptide precursors among
secreted proteins`](#reference) for the method and validation across mouse, zebrafish,
*C. elegans*, and *Drosophila*.

## Install

```bash
pip install sae-neuropeptide-predictor
```

This package also requires **`interplm`**, which isn't distributed on PyPI and must be
installed separately:

```bash
pip install git+https://github.com/ElanaPearl/InterPLM.git@93e22fb7be6790f20faf06d6b3ffee41adb2db5a
```

Requires Python 3.10+. The first prediction call downloads the ESM2-650M model and SAE
weights (~2.5GB) from Hugging Face Hub and caches them locally — after that, everything
runs offline.

## Usage

```python
from sae_neuropeptide_predictor import NeuropeptideClassifier

clf = NeuropeptideClassifier()

# Single sequence
result = clf.predict("MKSIYFVAGLFVMLVQGSWQRSLQDTEEKSRSFSASQADPLSDPDQMNEDKRHSQGTFTSDYSKYLDSRRAQDFVQWLMNTKRNRNNIAKRHDEFERHAEGTFTSDVSSYLEGQAAKEFIAWLVKGRGRRDFPEEVAIVEELGRRHADGSFSDEMNTILDNLAARDFINWLIQTKITDRK")
print(result.probability, result.prediction)  # 0.9966 1

# Many sequences at once (reuses the already-loaded model)
results = clf.predict_many({"seq_a": "MGMRMM...", "seq_b": "MKSIYF..."})

# A FASTA file, optionally writing an Entry,probability,prediction CSV
results = clf.predict_fasta("sequences.fasta", out_path="results.csv")
```

`prediction` is `1` if `probability >= threshold` (default `0.7`), else `0`.
Pass `NeuropeptideClassifier(threshold=0.5)` to change it.

## Command-line usage

```bash
sae-neuropeptide-predict --fasta sequences.fasta --out results.csv
```

Add `--threshold 0.5` to change the prediction cutoff, or `-v` to see model-loading progress.

## Reference

Kulikova, A.V., Bookout, A.L., Koch, T.L., & Safavi-Hemami, H. *Sparse autoencoder
features from InterPLM predict neuropeptide precursors among secreted proteins.*

## License

MIT
