$ show stephaneguindon/phyml
PhyML is a mature C command-line application for maximum-likelihood phylogenetic inference, with optional Bayesian MCMC dating (PhyTime) and spatial phylogeography (PhyREX) modes. It reads DNA/amino-acid alignments in PHYLIP/NEXUS format, estimates substitution-model parameters, performs NNI/SPR topology searches, computes branch supports (aLRT/SH/aBayes), and outputs Newick/NEXUS trees, site-likelihood files, ancestral sequences, and JSON traces. The code is organized around shared tree/edge/node C structures, a pattern-compressed likelihood engine (lk.c), numerical optimization (optimiz.c), and model-specific modules for molecular clocks, coalescent priors, and spatial diffusion models. The architecture is a monolith of C modules compiled into multiple executables via Autotools conditionals. Main entry points are src/main.c (PhyML), src/date.c (PhyTime), and src/phyrex.c (PhyREX); a command-line interface, interactive menu, and XML configuration are all supported. Optional MPI parallelism, BEAGLE hardware acceleration, and SSE/AVX vectorized likelihood kernels exist. The codebase is research-grade and actively maintained, but carries significant technical debt: heavy #ifdef use, large commented-out experimental blocks, stub functions, hardcoded simulation constants, and no automated test suite. It is a scientific application rather than a data pipeline, though it contains simulation and cross-validation research features. The most safely reusable components are the generic numerical routines: Brent/BFGS optimizers, a dense eigen-solver, and a broad statistical/RNG utility library. These are self-contained C implementations that can be extracted into other numerical projects with minimal modification. Likelihood, tree-search, and spatial-model modules are more tightly coupled to PhyML's internal data structures and are less directly reusable. The project serves as a reference implementation for many phylogenetics algorithms, but its engineering quality varies by module.
The LLM identified 5 files worth highlighting for reuse:
Implements generic Brent (golden-section/bracketing), BFGS multi-parameter optimization, and a spline-based 1-D optimizer, all driven by function pointers. The optimization functions are largely independent of phylogenetic data structures and can be extracted as a reusable scalar/multivariate minimization library.
A standalone real-matrix eigen-solver with balancing, Hessenberg reduction, and eigenvalue extraction, plus LU and Cholesky decompositions. Built for substitution-matrix exponentiation, it is a generic dense linear-algebra module usable in any numerical application.
A rich C library of statistical utilities: uniform/gamma/normal/Poisson/negative-binomial variates, truncated-normal samplers, CDFs/quantiles, incomplete gamma, Cholesky, matrix inversion, and Brownian bridge moments. The routines are self-contained and widely applicable to simulation and Bayesian inference projects.
AVX-optimized numerical kernels for likelihood calculations, including 256-bit double matrix-vector products, reductions, and partial-likelihood updates with FMA fallbacks. The alignment, vectorization, and loop-structure patterns are reusable for high-performance numeric workloads.
Implements chaining of multiple model/tree structures for mixture-model and partitioned-data likelihood evaluation, including combined likelihood scores, branch-length optimization, bootstrap, and cross-validation. The doubly-linked mixture-chain pattern is conceptually reusable for modular likelihood frameworks, though the code is coupled to PhyML's tree internals.