Metadata-Version: 2.4
Name: phynetpy-rs
Version: 0.8.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
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: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Rust
Requires-Dist: numpy>=1.19.0
Requires-Dist: matplotlib>=3.3.0
Requires-Dist: networkx>=2.5
Requires-Dist: biopython>=1.78
Requires-Dist: python-nexus
Requires-Dist: pulp
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: coverage ; extra == 'dev'
Requires-Dist: maturin>=1.7,<2.0 ; extra == 'dev'
Requires-Dist: build ; extra == 'dev'
Requires-Dist: twine ; extra == 'dev'
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: coverage ; extra == 'test'
Requires-Dist: scipy>=1.5.0 ; extra == 'test'
Provides-Extra: dev
Provides-Extra: test
License-File: LICENSE
Summary: PhyNetPy with a Rust core: a library and framework for phylogenetic network inference, analysis, simulation and tooling. Installs the phynetpy package.
Keywords: phylogenetics,networks,biology,graphical modeling,methods,statistics,bayesian
Author-email: Mark Kessler <mak17@rice.edu>
License-Expression: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Bug Reports, https://github.com/markkessler66/PhyNetPy-RUST/issues
Project-URL: Homepage, https://github.com/markkessler66/PhyNetPy-RUST
Project-URL: Pure-Python PhyNetPy, https://github.com/NakhlehLab/PhyNetPy
Project-URL: Source, https://github.com/markkessler66/PhyNetPy-RUST

# PhyNetPy

PhyNetPy is a Python library for phylogenetic network inference and analysis. It
provides improved implementations of methods from PhyloNet, plus a framework for
building new Bayesian and simulation-based methods.

This repository is the Rust-core build of PhyNetPy, published on PyPI as
**`phynetpy-rs`**. The Python package it installs is still named `phynetpy`
and has the same classes, functions and module layout as the pure-Python
[PhyNetPy](https://github.com/NakhlehLab/PhyNetPy) 0.7.0; underneath, the
graph structures, parsers, likelihood kernels, simulators and search operators
run in the compiled extension `phynetpy._core`. Existing scripts work
unchanged. Because both distributions provide the `phynetpy` package, install
one or the other in a given environment, not both.

## Install

```bash
pip install phynetpy-rs
```

Wheels are published for Python 3.9 and later (one `abi3` wheel per platform
for Linux x86_64/aarch64, macOS Intel/Apple Silicon and Windows x64).
Installing from source needs a Rust toolchain (`rustup`), after which

```bash
pip install .
```

builds the extension with [maturin](https://www.maturin.rs).

## Quick start

```python
from phynetpy.infer import infer, score
from phynetpy.data import GeneTrees
from phynetpy.models import MSC
from phynetpy.criteria import MDC, Likelihood, PseudoLikelihood, Bayesian

gts = GeneTrees.from_file("gene_trees.nex", {"A": ["A1", "A2"], "B": ["B1"]})

result = infer(gts, model=MSC(), criterion=PseudoLikelihood())
print(result.best, result.score)

log_lik = score(result.best, gts, model=MSC(), criterion=Likelihood())
```

See `README.upstream.md` for the full method table, the three-axis design of
`infer` and `score`, and the DIMPLE pipeline. Nothing about that surface
changed in the port.

## Layout

| Path | What it holds |
| --- | --- |
| `python/phynetpy/` | The `phynetpy` package: the public API, thin wrappers over the core. |
| `src/` | The Rust crate behind `phynetpy._core`. |
| `src/graph/` | `Node`, `Edge`, `Network`, transactions, graph algorithms, Newick parsing. |
| `tests/` | Test suite (`pytest`; `-m "not slow"` skips long MCMC recovery runs). |
| `examples/` | Runnable end-to-end workflows. |
| `Guides/` | Installation, I/O, and validation guides. |

## Development

```bash
python -m venv .venv && . .venv/bin/activate
pip install maturin pytest scipy numpy matplotlib networkx biopython python-nexus pulp
maturin develop            # build the extension into the venv (add --release for speed)
python -m pytest -m "not slow"
```

The version lives in `python/phynetpy/_version.py` and `Cargo.toml`; keep the
two in step. `docs/PORTING.md` describes how the Rust core and the Python
facades fit together.

## Releasing

CI (`.github/workflows/release.yml`) builds wheels for Linux (x86_64,
aarch64), macOS (Intel, Apple Silicon) and Windows (x64) plus an sdist on
every push, and runs the test suite against each wheel. Pushing a version
tag publishes those artifacts to PyPI as `phynetpy-rs` through trusted
publishing:

```bash
git tag v0.8.0
git push origin v0.8.0
```

