← Back to PhyNetPy

PhyNetPy Documentation

Library for the Development and Use of Phylogenetic Network Methods

PhyNetPy API Reference

Welcome to the PhyNetPy documentation. PhyNetPy is a comprehensive Python library for phylogenetic network analysis, providing tools for network construction, manipulation, simulation, and inference.

Version:
0.2.0
Authors:
Mark Kessler, Luay Nakhleh
Copyright:
2025

Module Index

Module Description
Alphabet Character-to-state mapping for biological sequence data (DNA, RNA, Protein, Codon, SNP)
BirthDeath Birth-death process network simulators (Yule and CBDP models)
GeneTrees Gene tree container and analysis utilities including consensus tree construction
GraphUtils Graph and network utility functions for topology analysis and manipulation
GTR Substitution models (GTR, K80, F81, JC, HKY, K81, SYM, TN93)
Matrix Data matrix storage and reduction for sequence alignments
MSA Multiple Sequence Alignment parsing, storage, and analysis
Network Core phylogenetic network data structures (Node, Edge, Graph, Network classes)
NetworkMoves Network topology modification operations (add/remove hybrid, NNI)
NetworkParser Nexus file and Newick string parsing utilities
Newick Newick format handling and Nexus file generation
PhyloNet PhyloNet Java wrapper for external phylogenetic analysis
Validation Comprehensive file format validation for phylogenetic data files

Getting Started

Installation

pip install phynetpy

Quick Example

from PhyNetPy.Network import Network, Node, Edge
from PhyNetPy.NetworkParser import NetworkParser

# Parse a network from a Nexus file
parser = NetworkParser("my_network.nex")
network = parser.get_network(0)

# Access network properties
print(f"Number of nodes: {len(network.V())}")
print(f"Number of edges: {len(network.E())}")
print(f"Leaves: {[leaf.label for leaf in network.get_leaves()]}")

Module Categories

Core Data Structures

  • Network - Node, Edge, Graph, and Network classes
  • MSA - Multiple sequence alignment handling
  • Matrix - Compressed data matrix representation

Simulation

Substitution Models

  • GTR - Time-reversible substitution models
  • Alphabet - Character state mappings

Analysis and Utilities

I/O and Parsing

Navigation

Modules