PhyNetPy Documentation

Library for the Development and Use of Phylogenetic Network Methods

ModelFactory Module v1.0.0

Component-based model building factory for constructing probabilistic phylogenetic models.

Author:
Mark Kessler
Last Edit:
3/11/25
Source:
ModelFactory.py

ModelComponent

class ModelComponent(ABC)

Abstract class (do not instantiate this), that represents the behavior for any phylogenetic network model component that gets fed into a ModelFactory.

Constructor

__init__(dependencies: set[type] = None) -> None

Initialize a model component that has a set of dependencies (component types) that must be added to the model before this component can be built.

Parameter Type Description
dependencies set[type] A set of model component types that need to be built first before this component can be added.

Methods

build(model: Model) -> None abstract

Given a model, hook up this component to it.

Parameter Type Description
model Model The model currently being built.

NetworkComponent

class NetworkComponent(ModelComponent)

Network Component Description: This component should be the first component built into the model, as most other components will be connected to the network in some way.

Constructor

__init__(dependencies: set[type] = None, net: Network = None, node_constructor: Callable = None) -> None

Builder for the network component of a phylogenetic model.

Parameter Type Description
dependencies set[type] list of component dependencies
net Network A network
node_constructor Callable A construction method for custom model network nodes.

Methods

build(model: Model) -> None

Attaches a network to the given Model

Parameter Type Description
model Model A Model object, most likely completely empty.

MSAComponent

class MSAComponent(ModelComponent)

Component that links network leaves with taxon data from a MSA object.

Constructor

__init__(dependencies: set[type] = None, aln: MSA = None, grouping: dict[str, str] = None) -> None

Initialize this MSA component.

Parameter Type Description
dependencies set[type] list of component dependencies
aln MSA MSA object that is associated with the network.
grouping dict[str, str], optional A dictionary that maps sequence names to group names.

Methods

build(model: Model) -> None

Attach the MSA object to the model by setting the data field for each leaf node.

Parameter Type Description
model Model The model that is being built.

ModelFactory

class ModelFactory

A factory class that builds a phylogenetic model from a set of model components.

Constructor

__init__(*items: ModelComponent) -> None

Initialize the model factory with a set of model components.

Methods

put(item: ModelComponent) -> None

Submit a model component to the factory.

Parameter Type Description
item ModelComponent A model component to be built.
build -> Model

Build the model from the components.

Returns: Model: The model that was built from the components.

Navigation

Modules

This Page