Metadata-Version: 2.4
Name: variantt
Version: 0.1.0
Summary: Polarised directional substitution asymmetry via ancestral-state reconstruction with Variant Tension (Tv) composition control
Author-email: Alper Karagöl <akaragol@mit.edu>, Taner Karagöl <karagolt@mit.edu>
License-Expression: MIT
Project-URL: Homepage, https://www.karagolresearch.com/variantt
Project-URL: Repository, https://github.com/karagol-alper/Tvariant
Project-URL: Preprint, https://doi.org/10.64898/2026.03.10.710752
Keywords: bioinformatics,molecular-evolution,ancestral-sequence-reconstruction,substitution-asymmetry,variant-tension,phylogenetics
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
Requires-Dist: scipy>=1.8.0
Dynamic: license-file

# variantt

[![PyPI version](https://img.shields.io/pypi/v/variantt)](https://pypi.org/project/variantt/) [![Web Platform](https://img.shields.io/badge/Web%20Platform-VariantT-0f4c5c)](https://www.karagolresearch.com/variantt) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

`variantt` quantifies polarised directional amino acid substitution asymmetry (`A(X->Y) = (N(X->Y) - N(Y->X)) / (N(X->Y) + N(Y->X))`) on rooted protein phylogenies via unbiased random-tie Fitch ancestral-state reconstruction, exact two-sided binomial tests with Benjamini-Hochberg false discovery rate control, reversible-model parametric bootstrap, alphabet-order bias auditing, and the frequency-only Variant Tension (`Tv`) composition control.

Unrooted alignments and single-column frequency ratios carry no directional branch polarity. `variantt` requires an explicit outgroup (`--outgroup`), basal clade (`--root-taxa`), or `--midpoint` root before reporting directional counts, and computes `Tv` alongside `A(X->Y)` on the same alignment to separate compositional asymmetry from true evolutionary directionality.

## Installation

```bash
pip install variantt
```

## Command-Line Usage

Run the built-in non-reversible and reversible simulation controls:

```bash
variantt --selftest
```

Analyse a FASTA alignment rooted on an outgroup regex with redundancy filtering and parametric bootstrap:

```bash
variantt --msa alignment.fasta \
         --outgroup "Danio|Xenopus|Latimeria" \
         --weight-threshold 0.98 \
         --min-events 10 \
         --bootstrap 50 \
         -o family_polarised
```

Compute per-site frequency-only `Tv` composition profiles across alignment columns:

```bash
variantt --msa alignment.fasta --tv-sites -o tv_profile.csv
```

## Python API

```python
from variantt import (
    analyse_alignment,
    selftest,
    tv_control,
    tv_site_profile,
    read_fasta,
    encode_alignment,
)

controls = selftest(quiet=True)

result = analyse_alignment(
    "alignment.fasta",
    outgroup="Danio|Xenopus",
    weight_threshold=0.98,
    min_events=10,
    bootstrap=50,
)
print(result["tested_pairs"][:5])
print("r(A, Tv) =", result["tv_correlation"])
```

## Citation

Karagöl, A., Karagöl, T. Variant Tension (Tv) as a Composition Control for Directional Substitution Asymmetry: Polarised Inference by Ancestral-State Reconstruction. *bioRxiv* (2026). https://doi.org/10.64898/2026.03.10.710752

## License

Released under the MIT License.
