PhyNetPy Release Notes
A major release introducing a unified I/O system, a blazing-fast vectorized BiMarkers algorithm with GPU support, Tree of Blobs decomposition, a full MCMC inference pipeline, and much more.
View Full Documentation →Highlights
Unified IO Module New
The new IO module consolidates all file-format handling into a single, clean API.
It replaces the former NetworkParser class and absorbs functionality that was previously
spread across multiple modules.
What changed
- New format support — FASTA (
read_fasta,write_fasta), VCF (read_vcf,write_vcf), and more. - Improved Newick & Nexus — dedicated
read_newick/write_newickandread_nexus/write_nexusfunctions with auto-detection of Newick convention (PhyNetPy / PhyloNet / Beast). - Simpler imports —
from PhyNetPy import read_nexus, read_newickinstead of instantiating a parser class. - Removed —
NetworkParsermodule (functionality fully absorbed byIO).
Vectorized BiMarkers Algorithm New
A completely new SNP (biallelic marker) likelihood module built from the ground up for performance. The vectorized approach drastically reduces compute times and opens the door to GPU acceleration.
Key features
- Vectorized computation — sparse merge/split tensor operations replace element-wise loops.
- GPU support — transparent CPU-to-GPU switching via the new
Executorabstraction (NumPy on CPU, CuPy on CUDA). - Site batching — process large datasets in configurable batches to stay within memory limits.
- Auto GPU detection —
GPUSpecsperforms pre-flight VRAM checks and falls back to CPU gracefully.
Tree of Blobs Decomposition Improved
Networks can now be decomposed into a Tree of Blobs for more efficient likelihood computation. This is supported by several new and updated components:
MULclass (Network module) — multi-labeled trees that represent the blob-level decomposition of a phylogenetic network.- Typed model nodes (
ModelGraph) —LeafNode,InternalNode,ReticulationNode,RootNode, andRootAggregatorNodeenable node-specific computation dispatch. NodeVPItensors (BiMarkers) — per-node probability bundles used during traversal.
Full MCMC Inference Pipeline New
v0.3.0 ships a complete Bayesian inference stack, from model construction to posterior sampling:
- ModelFactory — component-based, dependency-aware model assembly.
- State — dual-model (current / proposed) accept/reject management.
- MetropolisHastings & HillClimbing — pluggable search algorithms with
ProposalKernelABC. - ModelMove — topology proposals:
AddReticulation,RemoveReticulation,FlipReticulation,SwitchParentage,SPR.
Architecture & Design Patterns
v0.3.0 introduces a formal design-pattern layer that decouples what to compute, how to dispatch, and in what order to traverse.
Strategy New
Abstract interface for node-level computations: compute_at_leaf, compute_at_internal, compute_at_reticulation, compute_at_root.
Visitor New
Auto-dispatching visitor pattern: visit_leaf, visit_internal, visit_reticulation, visit_root.
Traversal New
Iterator-based graph traversal with pre-order, post-order, and level-order modes. LevelParallelTraversal groups nodes by level for parallel execution.
New Modules
| Module | Category | Description |
|---|---|---|
| IO | I/O | Unified file I/O: FASTA, VCF, Newick, Nexus with format auto-detection and cross-convention conversion. |
| BiMarkers | Inference | Vectorized SNP likelihood computation with GPU acceleration and site batching. |
| MetropolisHastings | Inference | MCMC and Hill Climbing search algorithms with pluggable proposal kernels. |
| State | Inference | Dual-model accept/reject state management for MCMC chains. |
| ModelGraph | Models | Probabilistic graphical model with typed nodes and visitor-pattern support. |
| ModelFactory | Models | Component-based, dependency-aware model builder. |
| ModelMove | Models | Network topology moves for MCMC: Add/Remove/Flip reticulation, SPR, etc. |
| Strategy | Infrastructure | Abstract Strategy interface for node-level computations. |
| Visitor | Infrastructure | Abstract Visitor interface with auto-dispatching by node type. |
| Traversal | Infrastructure | Iterator-based graph traversal: pre-order, post-order, level-order, parallel level. |
| Executor | Infrastructure | CPU/GPU computation backend abstraction (NumPy / CuPy). |
| graph_core | Infrastructure | Low-level graph data structures with optional Cython acceleration. |
| Phylo | Core | Core Branch class for edge attributes (length, inheritance probability). |
| SNPSimulator | Simulation | Forward-in-time SNP data simulator with random network generation (Yule process). |
| Logger | Infrastructure | Minimal structured logging for debugging model moves and inference. |
Updated Modules
Network Improved
- Added
NodeSet,UEdge(undirected edge),EdgeSet, andGraphbase class. - Added
MULclass for multi-labeled trees (Tree of Blobs decomposition). Nodenow exposes alabelproperty in addition toget_name().
Other Shared Modules
The following modules received documentation updates and sidebar navigation improvements:
Alphabet, BirthDeath, GraphUtils, GTR,
Matrix, MSA, NetworkMoves, Newick,
PhyloNet, Validation.
Bug Fixes
- Various stability and correctness fixes across the codebase.
- Improved error handling and validation throughout shared modules.
Migration from v0.2.0
Import changes
Top-level imports are now optional and the import name matches install name:
Before: from PhyNetPy.Network import Network, Node, Edge
After: from phynetpy import Network, Node, Edge
NetworkParser removed
Before: from PhyNetPy.NetworkParser import NetworkParser
After: from phynetpy import read_nexus, read_newick
Installation
pip install phynetpy