Library for the Development and Use of Phylogenetic Network Methods
Welcome to the PhyNetPy documentation. PhyNetPy is a comprehensive Python library for phylogenetic network analysis, providing tools for network construction, manipulation, simulation, and inference.
| 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 |
pip install phynetpy
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()]}")