Squirrel pipeline#
The main Squirrel pipeline and the delta heuristic for inferring quartet profiles from distances, plus the scoring functions for evaluating networks.
squirrel#
- physquirrel.algorithms.squirrel.squirrel(profileset: SqQuartetProfileSet, outgroup: str | None = None, parallel: ParallelConfig | None = None, representative_mode: Literal['average', 'best'] = 'best', **kwargs: Any) SemiDirectedPhyNetwork | DirectedPhyNetwork#
Reconstruct a phylogenetic network from a squirrel quartet profile set.
Pipeline: 1. Compute T* tree. 2. Apply adapted quartet joining. 3. Iteratively contract least-supported splits (unresolve_tree). 4. For each contracted tree: resolve cycles, score with C-measure. 5. Return best network.
- Parameters:
profileset (SqQuartetProfileSet)
outgroup (str | None) – If provided, returns a DirectedPhyNetwork rooted at the outgroup edge.
parallel (ParallelConfig | None) – Parallelization config. None → sequential.
representative_mode ({'average', 'best'}) –
Controls how quartet profiles within each 4-subpartition are aggregated when computing the TSP distance matrix for cycle resolution.
'best'(default): vote (weighted by profile weight) for the plurality topology per 4-subpartition and use only that topology’s distance contributions. Mirrors the v1 behaviour of electing a single representative quarnet per 4-tuple of partition sets.'average': average rho-distance over all representative leaf-partitions. Reflects the full empirical distribution of quartet signals across taxa within each partition set.
**kwargs – Additional arguments passed to resolve_cycles (e.g. rho, tsp_threshold, weighted_distance).
- Return type:
SemiDirectedPhyNetwork | DirectedPhyNetwork
delta_heuristic#
- physquirrel.algorithms.delta_heuristic.delta_heuristic(distance_matrix: DistanceMatrix, lam: float = 0.3, weight: bool = True) SqQuartetProfileSet#
Infer quartet profiles from a distance matrix using the delta heuristic.
For each set of 4 taxa, computes delta = (d2 - d1) / (d2 - d0) where d0 <= d1 <= d2 are the three possible split distances. If delta < lam the quartet is a split; otherwise a 4-cycle. Reticulation leaves are assigned globally by highest delta sum.
- Parameters:
- Return type: