Metadata-Version: 2.4
Name: phypanda
Version: 2.0.0
Summary: a package for computing and maximizing phylogenetic diversity in phylogenetic networks
Author-email: Niels Holtgrefe <n.a.l.holtgrefe@tudelft.nl>
License: MIT License
        
        Copyright (c) 2025-2026 Niels Holtgrefe
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Repository, https://github.com/nholtgrefe/panda
Keywords: phylogenetics,phylogenetic network,phylogenetic diversity,PaNDA
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
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: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: phylozoo>=0.1.2
Requires-Dist: networkx>=3.0
Requires-Dist: scanwidth>=0.2.5
Requires-Dist: numba>=0.56
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx>=7.0.0; extra == "docs"
Requires-Dist: pydata-sphinx-theme>=0.15.0; extra == "docs"
Dynamic: license-file

[![PyPI](https://img.shields.io/pypi/v/phypanda)](https://pypi.org/project/phypanda/)
[![License](https://img.shields.io/github/license/nholtgrefe/panda)](https://github.com/nholtgrefe/panda/blob/main/LICENSE)
[![Docs](https://img.shields.io/badge/docs-stable-blue)](https://nholtgrefe.github.io/panda/)

# phypanda

**phypanda** is the Python library for **PaNDA** — phylogenetic diversity optimization on **directed phylogenetic networks**. It builds on [phylozoo](https://pypi.org/project/phylozoo/) for networks and [scanwidth](https://pypi.org/project/scanwidth/) for node- and edge-scanwidth–based dynamic programs, including budgeted **maximum all-paths diversity (MAPD)** and related max-tree / min-tree objectives.

## Key features

- **All-paths (MAPD)**: fixed-set scoring and budgeted maximization via **node-scanwidth FPT** (`nsw_fpt_budget`) and **edge-scanwidth FPT** (`esw_fpt`), with optional precomputed tree extensions.
- **Max-tree and min-tree PD**: budgeted max-tree PD and fixed-set min-tree PD using node-scanwidth DPs (Numba-accelerated merges where applicable).
- **High-level API**: `diversity`, `marginal_diversities`, `greedy_max_diversity`, `solve_max_diversity` dispatching over measure implementations.
- **GUI**: optional desktop interface for interactive exploration — see the [`gui/`](https://github.com/nholtgrefe/panda/tree/main/gui) folder.

## Installation

Install the package from PyPI:

```bash
pip install phypanda
```

From a local clone (editable install):

```bash
pip install -e .
```

Optional extras:

```bash
# development (pytest)
pip install phypanda[dev]

# build the Sphinx documentation
pip install phypanda[docs]
```

Runtime dependencies (installed automatically) include `phylozoo`, `networkx`, `scanwidth`, and `numba`. Several solvers require networks **without parallel edges**; see the documentation.

## Documentation

Installation, quickstart, measure overview, and full API reference:

**[https://nholtgrefe.github.io/panda/](https://nholtgrefe.github.io/panda/)**

*(Site is deployed from this repository; if a page is not live yet, build locally with `pip install -e ".[docs]"` and `sphinx-build -b html docs/source docs/build/html` — see `docs/README.md`.)*

**Maintainers:** publishing to PyPI and deploying docs use separate GitHub Actions workflows on a **`v*`** tag (docs can also be run manually); see [`RELEASING.md`](RELEASING.md).

## Using PaNDA beyond the library

- **GUI**: [gui/README.md](https://github.com/nholtgrefe/panda/tree/main/gui) — screenshots and Tk-based workflow.
- **Example network**: Xiphophorus eNewick in [`experiments/MAPPD/exp2_xiphophorus_network.txt`](https://github.com/nholtgrefe/panda/blob/main/experiments/MAPPD/exp2_xiphophorus_network.txt).
- **Experiments & data**: [experiments/](https://github.com/nholtgrefe/panda/tree/main/experiments) — MAPPD simulation materials under [`experiments/MAPPD/`](https://github.com/nholtgrefe/panda/tree/main/experiments/MAPPD), budgeted PD benchmarks under [`experiments/budgeted_PD/`](https://github.com/nholtgrefe/panda/tree/main/experiments/budgeted_PD).

## Citation

If you use **phypanda** or this repository, please cite the main PaNDA paper:

> **PaNDA: Efficient Optimization of Phylogenetic Diversity in Networks.**  
> *Niels Holtgrefe, Leo van Iersel, Ruben Meuwese, Yukihiro Murakami, Jannik Schestag.*  
> bioRxiv, 2025. doi: [10.1101/2025.11.14.688467](https://www.biorxiv.org/content/10.1101/2025.11.14.688467)

Several **additional budgeted algorithms** (notably node-scanwidth FPT formulations for phylogenetic diversity on networks) are described in:

> **Tractable Optimization of Budgeted Phylogenetic Diversity on Networks using Node-Scanwidth.**  
> *Niels Holtgrefe and Jannik Schestag.*

Cite this second reference when your work builds specifically on those node-scanwidth optimization results.
