Metadata-Version: 2.4
Name: routecost
Version: 0.1.0
Summary: Exact deposit-agreement diagnostics and multi-step substitution route epistasis from deep mutational scans
Author-email: Taner Karagöl <karagolt@mit.edu>, Alper Karagöl <akaragol@mit.edu>
License-Expression: MIT
Project-URL: Homepage, https://www.tanerkaragol.com/toolkits-resources
Project-URL: Repository, https://github.com/karagol-taner/two-step-substitution-routes
Project-URL: Preprint, https://doi.org/10.64898/2026.11.17.767252
Keywords: bioinformatics,deep-mutational-scanning,epistasis,protein-design,mavedb,mutational-pathways
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.20.0
Dynamic: license-file

# routecost

[![PyPI version](https://img.shields.io/pypi/v/routecost)](https://pypi.org/project/routecost/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

`routecost` quantifies multi-step amino acid substitution routes across paired deep mutational scans (MaveDB score-set URNs or local CSV/TSV files) and runs the pre-analysis Spearman rank agreement test that determines whether two scans can be compared on a shared biological scale.

230 of the 380 ordered pairs of standard amino acids require more than a single nucleotide change. Single-parent mutational scans measure only the direct substitution from one background; wherever the same protein has been assayed on two parental sequences that differ at one or more positions, `routecost` extracts the double-difference routing residuals, dispersion-matched shared-parent control nulls, and exact single-difference rank correlations.

## Installation

```bash
pip install routecost
```

## Command-Line Usage

Compare two MaveDB score-set URNs directly:

```bash
routecost --a urn:mavedb:00000044-a-1 --b urn:mavedb:00000668-a-1 -o routes.csv
```

Compare two local CSV or TSV deep mutational scan tables (`hgvs_pro` + `score`, or `pos`/`wt`/`alt`/`score` columns):

```bash
routecost --csv-a scan_parent1.csv --seq-a MKTIIALSYIFCLVFA \
          --csv-b scan_parent2.csv --seq-b MKTIIALSYVFCLVFA \
          -o routes.csv
```

Run the exact rank-agreement check (`rho_test` at differing positions, `rho_control` across shared-parent positions, and predictor attenuation ceiling):

```bash
routecost --csv-a scan_parent1.csv --seq-a MKTIIALSYIFCLVFA \
          --csv-b scan_parent2.csv --seq-b MKTIIALSYVFCLVFA \
          --exact-test
```

Query minimum nucleotide base changes and single-step codon intermediates between any two amino acids:

```bash
routecost --codon-path W M
```

## Python API

```python
from routecost import (
    load_csv_scan,
    analyse_routes,
    exact_agreement_test,
    codon_pathway,
)

info = codon_pathway("V", "T")
print(info["min_base_changes"], info["single_step_intermediates"])

scan_a = load_csv_scan("scan_a.csv", sequence="MKTIIALSYIFCLVFA", name="parent_A")
scan_b = load_csv_scan("scan_b.csv", sequence="MKTIIALSYVFCLVFA", name="parent_B")

rows, control_pool = analyse_routes(scan_a, scan_b, matched_null=True)
agreement = exact_agreement_test(scan_a, scan_b)
```

## Citation

Karagöl, T., Karagöl, A. Most substitutions need more than one base change and an exact test tells which deposited scans measure the route. *bioRxiv* (2026). https://doi.org/10.64898/2026.11.17.767252

## License

Released under the MIT License.
