v0.3.0

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 →
27
Total Modules
15
New Modules
12
Updated Modules
GPU
Acceleration Support

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_newick and read_nexus/write_nexus functions with auto-detection of Newick convention (PhyNetPy / PhyloNet / Beast).
  • Simpler importsfrom PhyNetPy import read_nexus, read_newick instead of instantiating a parser class.
  • RemovedNetworkParser module (functionality fully absorbed by IO).
IO module docs →

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 Executor abstraction (NumPy on CPU, CuPy on CUDA).
  • Site batching — process large datasets in configurable batches to stay within memory limits.
  • Auto GPU detectionGPUSpecs performs pre-flight VRAM checks and falls back to CPU gracefully.
BiMarkers module docs →

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:

  • MUL class (Network module) — multi-labeled trees that represent the blob-level decomposition of a phylogenetic network.
  • Typed model nodes (ModelGraph) — LeafNode, InternalNode, ReticulationNode, RootNode, and RootAggregatorNode enable node-specific computation dispatch.
  • NodeVPI tensors (BiMarkers) — per-node probability bundles used during traversal.
Network module docs →

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 ProposalKernel ABC.
  • ModelMove — topology proposals: AddReticulation, RemoveReticulation, FlipReticulation, SwitchParentage, SPR.
MetropolisHastings docs →

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.

Docs →

Visitor New

Auto-dispatching visitor pattern: visit_leaf, visit_internal, visit_reticulation, visit_root.

Docs →

Traversal New

Iterator-based graph traversal with pre-order, post-order, and level-order modes. LevelParallelTraversal groups nodes by level for parallel execution.

Docs →

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, and Graph base class.
  • Added MUL class for multi-labeled trees (Tree of Blobs decomposition).
  • Node now exposes a label property in addition to get_name().
Docs →

GeneTrees Improved

  • Now includes concordance factor computation.
Docs →

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