Metadata-Version: 2.4
Name: xirt-torch
Version: 2.0.0
Summary: Multi-dimensional retention time prediction for linear and crosslinked peptides
Author-email: Sven Giese <sven.giese@hpi.de>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/gieses/xiRT
Project-URL: Documentation, https://gieses.github.io/xiRT/
Project-URL: Repository, https://github.com/gieses/xiRT
Project-URL: Issues, https://github.com/gieses/xiRT/issues
Keywords: proteomics,crosslinking,retention time,chromatography,PyTorch
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: <3.15,>=3.12
Description-Content-Type: text/markdown
License-File: LICENCE
Requires-Dist: torch<3,>=2.9
Requires-Dist: numpy<3,>=2
Requires-Dist: pandas<3,>=2.2
Requires-Dist: scipy>=1.14
Requires-Dist: scikit-learn>=1.6
Requires-Dist: biopython>=1.85
Requires-Dist: pyteomics>=4.7
Requires-Dist: pyyaml>=6
Requires-Dist: matplotlib>=3.9
Requires-Dist: seaborn<0.14,>=0.13
Requires-Dist: palettable>=3.3
Requires-Dist: statannotations>=0.7
Requires-Dist: pydantic<3,>=2.10
Requires-Dist: tqdm>=4.67
Requires-Dist: marimo>=0.25.1
Provides-Extra: cpu
Requires-Dist: torch<3,>=2.9; extra == "cpu"
Provides-Extra: cuda
Requires-Dist: torch<3,>=2.9; extra == "cuda"
Provides-Extra: esm
Requires-Dist: esm<3.3,>=3.2.3; python_version == "3.12" and extra == "esm"
Provides-Extra: experiments
Requires-Dist: lion-pytorch; extra == "experiments"
Provides-Extra: tracking
Requires-Dist: mlflow<4,>=3; extra == "tracking"
Provides-Extra: tensorboard
Requires-Dist: tensorboard; extra == "tensorboard"
Dynamic: license-file

# xiRT 2.0

![xiRT](docs/assets/xirt-logo.png)

Retention-time prediction for linear and crosslinked peptides using PyTorch.
The default model learns modification-aware peptide embeddings, shares a
recurrent encoder between crosslink branches, and predicts continuous RTs or
fraction labels. It runs on CPU or CUDA.

## Install and run

Requires Python 3.12–3.14; the default development interpreter is 3.13.
The PyPI distribution is **`xirt-torch`**; the Python import and CLI remain
`xirt`.

```bash
uv sync --locked --extra cpu
uv run --no-sync xirt -p xirt_params.yaml -s learning_params.yaml
# Edit the generated configurations for your input columns and targets.
uv run --no-sync xirt -i psms.csv -o results -x xirt_params.yaml -l learning_params.yaml
```

Replace `--extra cpu` with `--extra cuda` for the locked CUDA backend.
Optional extras provide local MLflow tracking (`tracking`), TensorBoard
(`tensorboard`), Lion (`experiments`), and local ESM-C embeddings
(`esm`, Python 3.12 only). ESM model access and licensing are separate.

## Fine-tuning

Native recurrent models support full fine-tuning, frozen-encoder head training,
and GRU-weight LoKr or LoRA. Checkpoints retain architecture and adapter settings.
See [fine-tuning](docs/fine-tuning.md) for the API, YAML and measured comparison.

TensorFlow is no longer an application dependency or supported backend.
Historical TF and PyTorch predictions, checkpoint provenance, tables and plots
are preserved under `benchmark-tf-torch/<cohort>/results/`.
PyTorch had lower mean held-out RMSE on two of five evaluated cohorts, not all
five. See [benchmark results](docs/benchmarks.md).
Keras `.h5` models cannot be loaded by xiRT 2.0.

## Examples

[CPU notebooks](docs/tutorials.md) cover training, checkpoint-based prediction
and all four fine-tuning strategies with 2,048 observed peptide pairs.
Training uses up to 150 epochs with validation-based early stopping:

```bash
uv run --no-sync marimo edit examples/train_predict.py --host 127.0.0.1
uv run --no-sync marimo edit examples/fine_tune.py --host 127.0.0.1
# Run both without a notebook server:
make examples
```

## Development

```bash
make sync
make check
make build
```

`pixi run sync` bootstraps the same locked uv environment. `make help` lists
documentation, notebook, test and release commands. Benchmark code lives in
`xirt/data_pipelines/benchmarks/` and is excluded from the production wheel.

[Documentation](https://gieses.github.io/xiRT/) ·
[Configuration](docs/configuration.md) · [Migration](docs/migration.md) ·
[Development](docs/development.md)

## Citation

Giese, S.H., Sinn, L.R., Wegner, F. et al. Retention time prediction using neural
networks increases identifications in crosslinking mass spectrometry.
*Nature Communications* **12**, 3237 (2021).
https://doi.org/10.1038/s41467-021-23441-0

Contributors: Sven Giese and Ludwig Sinn.
